Fix update and db interface used in commited data

This commit is contained in:
Dmitry Shulyak 2015-09-15 11:25:16 +03:00
parent 97e3f95fdb
commit 4e63b71128
2 changed files with 6 additions and 5 deletions

View File

@ -313,9 +313,8 @@ def init_cli_resource():
k, v = arg.split('=') k, v = arg.split('=')
args_parsed.update({k: v}) args_parsed.update({k: v})
click.echo('Updating resource {} with args {}'.format(name, args_parsed)) click.echo('Updating resource {} with args {}'.format(name, args_parsed))
all = sresource.load_all() res = sresource.load(name)
r = all[name] res.update(args_parsed)
r.update(args_parsed)
@resource.command() @resource.command()
@click.option('--check-missing-connections', default=False, is_flag=True) @click.option('--check-missing-connections', default=False, is_flag=True)

View File

@ -152,11 +152,13 @@ class Data(collections.MutableMapping):
def __init__(self, path): def __init__(self, path):
self.path = path self.path = path
self.store = {}
r = db.get(path, collection=db.COLLECTIONS.state_data, r = db.get(path, collection=db.COLLECTIONS.state_data,
return_empty=True, db_convert=False) return_empty=True, db_convert=False)
if r: if r:
self.store = r or self.store self.store = r.get('properties', {})
else:
self.store = {}
def __getitem__(self, key): def __getitem__(self, key):
return self.store[key] return self.store[key]