Merge lp:~larryprice/libertine/cc-prevent-rewrite into lp:libertine

Proposed by Larry Price
Status: Merged
Approved by: Christopher Townsend
Approved revision: 392
Merged at revision: 399
Proposed branch: lp:~larryprice/libertine/cc-prevent-rewrite
Merge into: lp:libertine
Diff against target: 57 lines (+14/-19)
2 files modified
python/libertine/ContainersConfig.py (+13/-14)
tools/libertine-container-manager (+1/-5)
To merge this branch: bzr merge lp:~larryprice/libertine/cc-prevent-rewrite
Reviewer Review Type Date Requested Status
Christopher Townsend (community) Approve
Libertine CI Bot continuous-integration Approve
Review via email: mp+316568@code.launchpad.net

Commit message

Preventing rewriting existing data in ContainersConfig.

Description of the change

Preventing rewriting existing data in ContainersConfig.

To post a comment you must log in.
Revision history for this message
Libertine CI Bot (libertine-ci-bot) wrote :

PASSED: Continuous integration, rev:392
https://jenkins.canonical.com/libertine/job/lp-libertine-ci/372/
Executed test runs:
    SUCCESS: https://jenkins.canonical.com/libertine/job/build/712
    SUCCESS: https://jenkins.canonical.com/libertine/job/test-0-autopkgtest/label=amd64,release=xenial+overlay,testname=default/583
    SUCCESS: https://jenkins.canonical.com/libertine/job/test-0-autopkgtest/label=amd64,release=zesty,testname=default/583
    SUCCESS: https://jenkins.canonical.com/libertine/job/test-0-autopkgtest/label=i386,release=xenial+overlay,testname=default/583
    SUCCESS: https://jenkins.canonical.com/libertine/job/test-0-autopkgtest/label=i386,release=zesty,testname=default/583
    SUCCESS: https://jenkins.canonical.com/libertine/job/build-0-fetch/722
    SUCCESS: https://jenkins.canonical.com/libertine/job/build-2-binpkg/arch=amd64,release=xenial+overlay/703
        deb: https://jenkins.canonical.com/libertine/job/build-2-binpkg/arch=amd64,release=xenial+overlay/703/artifact/output/*zip*/output.zip
    SUCCESS: https://jenkins.canonical.com/libertine/job/build-2-binpkg/arch=amd64,release=zesty/703
        deb: https://jenkins.canonical.com/libertine/job/build-2-binpkg/arch=amd64,release=zesty/703/artifact/output/*zip*/output.zip
    SUCCESS: https://jenkins.canonical.com/libertine/job/build-2-binpkg/arch=i386,release=xenial+overlay/703
        deb: https://jenkins.canonical.com/libertine/job/build-2-binpkg/arch=i386,release=xenial+overlay/703/artifact/output/*zip*/output.zip
    SUCCESS: https://jenkins.canonical.com/libertine/job/build-2-binpkg/arch=i386,release=zesty/703
        deb: https://jenkins.canonical.com/libertine/job/build-2-binpkg/arch=i386,release=zesty/703/artifact/output/*zip*/output.zip

Click here to trigger a rebuild:
https://jenkins.canonical.com/libertine/job/lp-libertine-ci/372/rebuild

review: Approve (continuous-integration)
Revision history for this message
Christopher Townsend (townsend) wrote :

+1

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'python/libertine/ContainersConfig.py'
2--- python/libertine/ContainersConfig.py 2017-01-25 18:48:36 +0000
3+++ python/libertine/ContainersConfig.py 2017-02-07 14:21:45 +0000
4@@ -102,21 +102,20 @@
5 if not container:
6 return
7
8- if (type(value) is str or
9- type(value) is bool):
10- container[key] = value
11- elif type(value) is dict:
12- if key not in container:
13- container[key] = [value]
14- else:
15- container[key].append(value)
16- elif type(value) is list:
17- if key not in container:
18- container[key] = value
19- else:
20- container[key] = container[key] + value
21+ if type(value) is dict:
22+ if key not in container:
23+ newvalue = [value]
24+ else:
25+ newvalue = container[key].copy()
26+ newvalue.append(value)
27+ elif type(value) is list and key in container:
28+ newvalue = container[key] + value
29+ else:
30+ newvalue = value
31
32- write_container_config_file(self.container_list)
33+ if container.get(key, None) != newvalue:
34+ container[key] = newvalue
35+ write_container_config_file(self.container_list)
36
37 def _set_array_object_value_by_key(self, container_id, array_key, object_key, matcher, key, value):
38 container = self._get_container_entry(container_id)
39
40=== modified file 'python/libertine/Libertine.py'
41=== modified file 'python/libertine/LxdContainer.py'
42=== modified file 'tools/libertine-container-manager'
43--- tools/libertine-container-manager 2017-02-01 21:13:14 +0000
44+++ tools/libertine-container-manager 2017-02-07 14:21:45 +0000
45@@ -340,11 +340,7 @@
46 libertine.utils.get_logger().error("Configuring freeze is only valid on LXC and LXD container types.")
47 sys.exit(1)
48
49- current_freeze = self.containers_config.get_freeze_on_stop(container_id)
50- config_freeze = args.freeze == 'enable'
51-
52- if current_freeze != config_freeze:
53- self.containers_config.update_freeze_on_stop(container_id, config_freeze)
54+ self.containers_config.update_freeze_on_stop(container_id, args.freeze == 'enable')
55
56 else:
57 libertine.utils.get_logger().error("Configure called with no subcommand. See configure --help for usage.")

Subscribers

People subscribed via source and target branches