diff options
author | Michael Hwang <mhwang@research.att.com> | 2017-09-12 17:28:37 -0400 |
---|---|---|
committer | Michael Hwang <mhwang@research.att.com> | 2017-09-12 17:30:38 -0400 |
commit | 9d0a254d0bcd6e966c47f2656527274ab1787d97 (patch) | |
tree | d13c8afc7d40087fa840ad0f537ec31a666df97e /docker/dockerplugin/utils.py | |
parent | 9444408bb1ab548995a81d4efe678d298aca66df (diff) |
Combine all task inputs for create and start
Change-Id: Ia86d3b26b5ecccd636fb171b3967f924b0cb1250
Issue-Id: DCAEGEN2-91
Signed-off-by: Michael Hwang <mhwang@research.att.com>
Diffstat (limited to 'docker/dockerplugin/utils.py')
-rw-r--r-- | docker/dockerplugin/utils.py | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/docker/dockerplugin/utils.py b/docker/dockerplugin/utils.py index ed680c2..c45af68 100644 --- a/docker/dockerplugin/utils.py +++ b/docker/dockerplugin/utils.py @@ -20,9 +20,24 @@ import string import random +import collections def random_string(n): """Random generate an ascii string of "n" length""" corpus = string.ascii_lowercase + string.ascii_uppercase + string.digits return ''.join(random.choice(corpus) for x in range(n)) + + +def update_dict(d, u): + """Recursively updates dict + + Update dict d with dict u + """ + for k, v in u.iteritems(): + if isinstance(v, collections.Mapping): + r = update_dict(d.get(k, {}), v) + d[k] = r + else: + d[k] = u[k] + return d |