mirror of
https://github.com/kevingruesser/bootstrap-vz.git
synced 2025-08-24 07:26:29 +00:00
Fix serialization of DictClass
using it in Queue.put somehow broke it
This commit is contained in:
parent
51e9e29b24
commit
3c642e0b02
2 changed files with 21 additions and 14 deletions
|
@ -78,20 +78,6 @@ class BootstrapInformation(object):
|
||||||
:return: The manifest_vars dictionary
|
:return: The manifest_vars dictionary
|
||||||
:rtype: dict
|
:rtype: dict
|
||||||
"""
|
"""
|
||||||
class DictClass(dict):
|
|
||||||
"""Tiny extension of dict to allow setting and getting keys via attributes
|
|
||||||
"""
|
|
||||||
def __getattr__(self, name):
|
|
||||||
return self[name]
|
|
||||||
|
|
||||||
def __setattr__(self, name, value):
|
|
||||||
self[name] = value
|
|
||||||
|
|
||||||
def __delattr__(self, name):
|
|
||||||
del self[name]
|
|
||||||
|
|
||||||
def __getstate__(self):
|
|
||||||
return self.__dict__
|
|
||||||
|
|
||||||
def set_manifest_vars(obj, data):
|
def set_manifest_vars(obj, data):
|
||||||
"""Runs through the manifest and creates DictClasses for every key
|
"""Runs through the manifest and creates DictClasses for every key
|
||||||
|
@ -139,3 +125,23 @@ class BootstrapInformation(object):
|
||||||
def __setstate__(self, state):
|
def __setstate__(self, state):
|
||||||
for key in state:
|
for key in state:
|
||||||
self.__dict__[key] = state[key]
|
self.__dict__[key] = state[key]
|
||||||
|
|
||||||
|
|
||||||
|
class DictClass(dict):
|
||||||
|
"""Tiny extension of dict to allow setting and getting keys via attributes
|
||||||
|
"""
|
||||||
|
def __getattr__(self, name):
|
||||||
|
return self[name]
|
||||||
|
|
||||||
|
def __setattr__(self, name, value):
|
||||||
|
self[name] = value
|
||||||
|
|
||||||
|
def __delattr__(self, name):
|
||||||
|
del self[name]
|
||||||
|
|
||||||
|
def __getstate__(self):
|
||||||
|
return self.__dict__
|
||||||
|
|
||||||
|
def __setstate__(self, state):
|
||||||
|
for key in state:
|
||||||
|
self[key] = state[key]
|
||||||
|
|
|
@ -6,6 +6,7 @@ log = logging.getLogger(__name__)
|
||||||
|
|
||||||
supported_classes = ['bootstrapvz.base.manifest.Manifest',
|
supported_classes = ['bootstrapvz.base.manifest.Manifest',
|
||||||
'bootstrapvz.base.bootstrapinfo.BootstrapInformation',
|
'bootstrapvz.base.bootstrapinfo.BootstrapInformation',
|
||||||
|
'bootstrapvz.base.bootstrapinfo.DictClass',
|
||||||
'bootstrapvz.common.fs.loopbackvolume.LoopbackVolume',
|
'bootstrapvz.common.fs.loopbackvolume.LoopbackVolume',
|
||||||
'bootstrapvz.common.fs.qemuvolume.QEMUVolume',
|
'bootstrapvz.common.fs.qemuvolume.QEMUVolume',
|
||||||
'bootstrapvz.common.fs.virtualdiskimage.VirtualDiskImage',
|
'bootstrapvz.common.fs.virtualdiskimage.VirtualDiskImage',
|
||||||
|
|
Loading…
Add table
Reference in a new issue