Merge lp:~aisrael/charms/trusty/vem/lint-cleanup into lp:charms/trusty/vem

Proposed by Adam Israel
Status: Merged
Approved by: Charles Butler
Approved revision: 6
Merge reported by: Charles Butler
Merged at revision: not available
Proposed branch: lp:~aisrael/charms/trusty/vem/lint-cleanup
Merge into: lp:charms/trusty/vem
Diff against target: 120 lines (+21/-18)
4 files modified
Makefile (+11/-7)
hooks/common.py (+8/-8)
hooks/config_changed.py (+2/-2)
revision (+0/-1)
To merge this branch: bzr merge lp:~aisrael/charms/trusty/vem/lint-cleanup
Reviewer Review Type Date Requested Status
Charles Butler (community) Approve
Review via email: mp+234406@code.launchpad.net

Description of the change

Removed legacy revision file
Fixed lint issues w/hooks/common.py and hooks/config_changed.py
Added virtualenv to Makefile so dependencies are met through automated tests.

I wasn't able to fully run the tests. It might be something with my environment (running under vagrant). nova-compute was failing to fully install because the upstart script was attempting to modprobe nbd. I manually modprobed the module on the host machine, commented out the modprobe in /etc/init/nova-compute.conf and was able to start nova-compute, but I wasn't able to continue the tests with that workaround.

To post a comment you must log in.
Revision history for this message
Charles Butler (lazypower) wrote :

Adam,

Thanks for the proofing, lint, and CI cleanup!

The tests fail when being run against a cloud provider, but this is not in relation to your changes to fixup proof and run the tests in a provided virtualenv.

I'm going to merge this with a follow up ping to Jorge Niedbalski who is the technical contact that has worked with cisco on the production of this charm.

Thanks again for your efforts +1 LGTM

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'Makefile'
2--- Makefile 2014-08-27 23:27:48 +0000
3+++ Makefile 2014-09-12 00:52:48 +0000
4@@ -1,6 +1,11 @@
5 #!/usr/bin/make
6 PYTHON := /usr/bin/env python
7-
8+
9+.venv:
10+ sudo apt-get install -y python-apt python-virtualenv
11+ virtualenv .venv --system-site-packages
12+ .venv/bin/pip install -I nose testtools mock amulet
13+
14 build: sync-charm-helpers lint
15
16 lint:
17@@ -9,12 +14,11 @@
18
19 clean:
20 @find . -name '*.pyc' -delete
21+ @rm -rf .venv
22
23-unit_test:
24+unit_test: .venv
25 @echo Starting unit tests...
26- PYTHONPATH=$(PYTHON_PATH):hooks/ nosetests --nologcapture unit_tests
27- #@$(PYTHON) /usr/bin/nosetests --nologcapture --with-coverage unit_tests
28+ PYTHONPATH=$(PYTHON_PATH):hooks/ .venv/bin/nosetests --nologcapture unit_tests
29
30-test:
31- #@pip install -r test_requirements.txt
32- @PYTHONPATH=$(PYTHON_PATH):hooks/ nosetests --nologcapture tests/
33+test: .venv
34+ @N1KV_SOURCE="ppa:cisco-n1kv/n1kv-updates" PYTHONPATH=$(PYTHON_PATH):hooks/ .venv/bin/nosetests --nologcapture tests/
35
36=== modified file 'hooks/common.py'
37--- hooks/common.py 2014-08-28 00:05:02 +0000
38+++ hooks/common.py 2014-09-12 00:52:48 +0000
39@@ -23,11 +23,11 @@
40 # Supporting functions
41 ###############################################################################
42
43-#------------------------------------------------------------------------------
44+# ------------------------------------------------------------------------------
45 # get_host_specific_config: Returns the appropriate config for the desired
46 # hostname
47 #
48-#------------------------------------------------------------------------------
49+# ------------------------------------------------------------------------------
50 def get_host_specific_config(hostname):
51 mapping = yaml.load(config('mapping'), Loader=yaml.loader.BaseLoader)
52 print mapping
53@@ -58,11 +58,11 @@
54 return host_conf
55
56
57-#------------------------------------------------------------------------------
58+# ------------------------------------------------------------------------------
59 # update_n1kv_config: Updates the /etc/n1kv/n1kv.conf file with the latest
60 # updated values in the data.yaml
61 #
62-#------------------------------------------------------------------------------
63+# ------------------------------------------------------------------------------
64 def update_n1kv_config():
65 juju_log("update_n1kv_config")
66 with open('data.yaml', 'r') as f:
67@@ -88,10 +88,10 @@
68 subprocess.call(["vemcmd", "reread", "config"])
69
70
71-#------------------------------------------------------------------------------
72+# ------------------------------------------------------------------------------
73 # ifconfig: ifconfig int <int-name> <up/down>
74 #
75-#------------------------------------------------------------------------------
76+# ------------------------------------------------------------------------------
77 def ifconfig(interface, state):
78 juju_log("ifconfig %s %s" % (interface, state))
79 try:
80@@ -100,10 +100,10 @@
81 subprocess.call(['juju-log', str(e)])
82
83
84-#------------------------------------------------------------------------------
85+# ------------------------------------------------------------------------------
86 # enable_uplink: Enable uplink interfaces
87 #
88-#------------------------------------------------------------------------------
89+# ------------------------------------------------------------------------------
90 def enable_uplink(uplink_conf):
91 uplink_conf = \
92 uplink_conf.replace(', ', '\n').replace(',', '\n').split('\n')
93
94=== modified file 'hooks/config_changed.py'
95--- hooks/config_changed.py 2014-08-27 23:27:48 +0000
96+++ hooks/config_changed.py 2014-09-12 00:52:48 +0000
97@@ -18,7 +18,7 @@
98 temp = f.read()
99 data = yaml.load(temp, Loader=yaml.loader.BaseLoader)
100 if ((config('n1kv-source') != data["n1kv_conf"]["n1kv-source"]) or
101- (config('n1kv-version') != data["n1kv_conf"]["n1kv-version"])):
102+ (config('n1kv-version') != data["n1kv_conf"]["n1kv-version"])):
103 subprocess.call("hooks/install")
104 data["n1kv_conf"]["n1kv-source"] = config('n1kv-source')
105 data["n1kv_conf"]["n1kv-version"] = config('n1kv-version')
106@@ -48,7 +48,7 @@
107 subprocess.call(["sysctl", "-p", "/etc/sysctl.d/60-n1kv.conf"])
108
109 common.update_n1kv_config()
110- #Enable all required uplink on the host (ifconfig <interface> up)
111+ # Enable all required uplink on the host (ifconfig <interface> up)
112 common.enable_uplink(data["n1kv_conf"]["uplink_profile"])
113 common.enable_uplink(data["n1kv_conf"]["vtep_config"])
114
115
116=== removed file 'revision'
117--- revision 2014-08-28 00:09:30 +0000
118+++ revision 1970-01-01 00:00:00 +0000
119@@ -1,1 +0,0 @@
120-9

Subscribers

People subscribed via source and target branches

to all changes: