(g|s)etstate for manifest

This commit is contained in:
Anders Ingemann 2014-11-24 17:42:33 +01:00
parent aa9616f4a6
commit 150b15bb4f
3 changed files with 18 additions and 6 deletions

View file

@ -86,8 +86,7 @@ def setup_loggers(opts):
def run(manifest, debug=False, pause_on_error=False, dry_run=False):
log.info('test')
return 'derp'
return manifest
"""Runs the bootstrapping process
:params Manifest manifest: The manifest to run the bootstrapping process for

View file

@ -15,6 +15,7 @@ class Manifest(object):
Currently, immutability is not enforced and it would require a fair amount of code
to enforce it, instead we just rely on tasks behaving properly.
"""
def __init__(self, path=None, data=None):
"""Initializer: Given a path we load, validate and parse the manifest.
To create the manifest from dynamic data instead of the contents of a file,
@ -130,3 +131,14 @@ class Manifest(object):
:raises ManifestError: With absolute certainty
"""
raise ManifestError(message, self.path, data_path)
def __getstate__(self):
return {'path': self.path,
'data': self.data}
def __setstate__(self, vals):
self.path = vals.path
self.load(vals.data)
self.initialize()
self.validate()
self.parse()

View file

@ -34,10 +34,11 @@ def main():
server = manager.rpc_server
# Everything has been set up, begin the bootstrapping process
server.run(None,
ret = server.run(manifest,
debug=opts['--debug'],
pause_on_error=False,
dry_run=opts['--dry-run'])
logging.getLogger(__name__).info(ret)
finally:
manager.stop()