ConfD User Community

Attaching to the init transaction in phase 0 using Python


#1

Section 5.11 of the ConfD 6.0.3 User Guide describes how to attach to confd in phase 0 to perform an upgrade of data in the CDB.

The User Guide example and the examples.confd source code are all in C. I am trying to do this using Python, using the unit tests source code for the pyapi as an example, but it is not easy to reverse-engineer this Python API. I understand that the Python API is supposed to be a mirror of the C API, but I am left guessing as to the details.

I have:

sys.path.append("/opt/tailf/confd/src/confd/pyapi")
import _confd as confd
etc.
etc.
sock = socket.socket()
confd.maapi.connect(sock, ‘127.0.0.1’, confd.CONFD_PORT)
trans = confd.maapi.attach_init(sock)
confd.maapi.set_namespace(sock, trans, ‘http://my.org/my-namespace’)
etc.
etc.
confd.maapi.set_elem2(sock, trans, myData, ‘/my-path/my-data’)
etc.
etc.
confd.maapi.close(sock)

My error occurs early on – the set_namespace() call fails with “an integer is required”. The value of trans is -2. This is an integer, but I’m guessing it’s not correct. What should be the value of the init transaction? What does -2 mean? Confd is in phase 0 at this time.

Is there any API call I am missing? I know that I am not supposed to close the transaction because it’s the init transaction. And I know that there is no user session for the same reason.
Thank you very much.


#2

You can address your Python related questions to support via the RT system.


#3

Hi,

Was this reported as a bug finally? We face a very similar issue in Confd6.2 so please
let us know if this is fixed in a later version.

Thank you,
Dimitra


#4

I have not filed a bug.