Comment 7 for bug 1165104

Revision history for this message
Bruno Nova (brunonova) wrote :

I think the debug message "ERROR:oneconf.networksync:WebClient server answering but not available" is important.

I've been looking at the code (or trying to) and, at around line 171 of oneconf/networksync/__init__.py, the call self.infraclient.server_status() is returning <b'"ok"'> instead of <ok>, at least for me.
If I "hack" the if in that line to give True, an error occurs next:

Traceback (most recent call last):
  File "/home/bruno/src/oneconf/oneconf/networksync/__init__.py", line 112, in _network_state_changed
    self._refresh_can_sync()
  File "/home/bruno/src/oneconf/oneconf/networksync/__init__.py", line 81, in _refresh_can_sync
    self.process_sync()
  File "/home/bruno/src/oneconf/oneconf/networksync/__init__.py", line 231, in process_sync
    full_hosts_list = self.infraclient.list_machines()
  File "/usr/lib/python3/dist-packages/piston_mini_client/validators.py", line 120, in wrapper
    return func(self, *args, **kwargs)
  File "/home/bruno/src/oneconf/oneconf/networksync/infraclient_pristine.py", line 41, in list_machines
    return ast.literal_eval(self._get('list-machines/', scheme=AUTHENTICATED_API_SCHEME))
  File "/usr/lib/python3.3/ast.py", line 86, in literal_eval
    return _convert(node_or_string)
  File "/usr/lib/python3.3/ast.py", line 85, in _convert
    raise ValueError('malformed node or string: ' + repr(node))
ValueError: malformed node or string: b'[\n {\n "hostname": "XXXXX", \n "logo_checksum": "X", \n "uuid": "XXXXX", \n "packages_checksum": "XXXXX"\n }\n]'

Notice the <b'...'> in the last line. Why is that? Maybe something wrong in the self._get() method? (where is that one defined?)
Sorry if I'm completely wrong.