Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cannot dump job description from exported recipe run data file #204

Open
jtluka opened this issue Jun 16, 2021 · 1 comment
Open

cannot dump job description from exported recipe run data file #204

jtluka opened this issue Jun 16, 2021 · 1 comment

Comments

@jtluka
Copy link
Collaborator

jtluka commented Jun 16, 2021

Running following script fails with an exception.

#!/usr/bin/python3

from lnst.Controller.Recipe import import_recipe_run

f = import_recipe_run('./lnst-run-data-0.lrc')

for r in f.results:
    print(type(r))
    print(r.__dict__)
    try:
        print(r._job.__dict__)
    except:
        pass
    print(r.description)
<class 'lnst.Controller.RecipeResults.JobStartResult'>
{'_timestamp': 1623850365.611658, '_success': True, '_job': <lnst.Controller.Job.Job object at 0x7f51ab8f9c50>}
{'_what': 'ip -4 route add 192.168.7.0/24 dev t_vxlan0', '_expect': True, '_json': False, '_netns': None, '_desc': None, '_level': <ResultLevel.IMPORTANT: 1>, '_res': {'passed': True, 'res_data': {'stdout': '', 'stderr': ''}, 'type': 'result'}, '_id': 0}
Traceback (most recent call last):
  File "./read.py", line 14, in <module>
    print(r.description)
  File "/usr/lib/python3.6/site-packages/lnst-14_-py3.6.egg/lnst/Controller/RecipeResults.py", line 85, in description
    return "Job started: {}".format(str(self.job))
  File "/usr/lib/python3.6/site-packages/lnst-14_-py3.6.egg/lnst/Controller/Job.py", line 222, in __str__
    attrs.append("host(%s)" % self.host.hostid)
  File "/usr/lib/python3.6/site-packages/lnst-14_-py3.6.egg/lnst/Controller/Job.py", line 80, in host
    return self._netns.initns
AttributeError: 'NoneType' object has no attribute 'initns'
@jtluka
Copy link
Collaborator Author

jtluka commented Jun 16, 2021

Seems the netns is reset in this method when pickling the RecipeRun object.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant