Merge lp:~psivaa/uci-engine/rabbitmq-restish-with-proxy into lp:uci-engine/mthood

Proposed by Para Siva
Status: Merged
Merged at revision: 418
Proposed branch: lp:~psivaa/uci-engine/rabbitmq-restish-with-proxy
Merge into: lp:uci-engine/mthood
Diff against target: 262 lines (+105/-4)
9 files modified
charms/precise/rabbitmq-worker/config.yaml (+12/-0)
charms/precise/rabbitmq-worker/hooks/hooks.py (+37/-3)
charms/precise/restish/config.yaml (+8/-1)
charms/precise/restish/hooks/hooks.py (+29/-0)
juju-deployer/branch-source-builder.yaml.tmpl (+5/-0)
juju-deployer/deploy.py (+2/-0)
juju-deployer/image-builder.yaml.tmpl (+5/-0)
juju-deployer/lander.yaml.tmpl (+2/-0)
juju-deployer/test-runner.yaml.tmpl (+5/-0)
To merge this branch: bzr merge lp:~psivaa/uci-engine/rabbitmq-restish-with-proxy
Reviewer Review Type Date Requested Status
Vincent Ladeuil (community) Approve
Review via email: mp+220503@code.launchpad.net

Commit message

Making rabbitmq and restish charm deployments with proxy. Should be similar changes to the lander-jenkins and python-django. Also contains change to the rabbitmq upstart job to include the proxy env variables.

Description of the change

Making rabbitmq and restish charm deployments with proxy. Spotting is not easy when the charm silently ignores packages listed in yaml for installation :/. Should be similar changes to the lander-jenkins and python-django. Also contains change to the rabbitmq upstart job to include the proxy env variables.

To post a comment you must log in.
Revision history for this message
Andy Doan (doanac) wrote :

one comment about the jinja stuff again

418. By Para Siva

Better conditional logic for private-public cloud in rabbitmq charm upstart job

419. By Para Siva

Adding no_proxy for the keystone, swift hosts

420. By Para Siva

no_proxy in deploy and yaml files

Revision history for this message
Para Siva (psivaa) wrote :

This could go in to mthood branch before parking that for a bit.

Revision history for this message
Vincent Ladeuil (vila) wrote :

Thanks for the hard work, let's get that in.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'charms/precise/rabbitmq-worker/config.yaml'
--- charms/precise/rabbitmq-worker/config.yaml 2014-03-10 22:25:00 +0000
+++ charms/precise/rabbitmq-worker/config.yaml 2014-05-29 10:25:18 +0000
@@ -18,6 +18,18 @@
18 pip-packages:18 pip-packages:
19 type: string19 type: string
20 description: "Pip packages required for this service"20 description: "Pip packages required for this service"
21 proxy-url:
22 type: string
23 default: ""
24 description: "The http proxy url for private clouds."
25 no-proxy:
26 type: string
27 default: ""
28 description: "The host ips to bypass proxy."
29 ppa-gpg-key:
30 type: string
31 default: ""
32 description: GPG key fingerprint for the PPA
21 install_root:33 install_root:
22 type: string34 type: string
23 description: "The root directory the service will be installed in"35 description: "The root directory the service will be installed in"
2436
=== modified file 'charms/precise/rabbitmq-worker/hooks/hooks.py'
--- charms/precise/rabbitmq-worker/hooks/hooks.py 2014-03-10 22:25:00 +0000
+++ charms/precise/rabbitmq-worker/hooks/hooks.py 2014-05-29 10:25:18 +0000
@@ -81,15 +81,42 @@
81 subprocess.check_call(args)81 subprocess.check_call(args)
8282
8383
84def setup_apt_proxy(config):
85 proxy_url = config['proxy-url']
86 apt_conf = textwrap.dedent("""\
87 Acquire::http::proxy "%s";
88 Acquire::https::proxy "%s";
89 Acquire::HTTP::PROXY "%s";
90 Acquire::HTTPS::PROXY "%s";
91 """ % (proxy_url, proxy_url, proxy_url, proxy_url))
92 with open('/etc/apt/apt.conf.d/95proxies', 'w') as f:
93 f.write(apt_conf)
94
95
96def import_ppa_keys(config):
97 cmd = ['apt-key', 'adv', '--keyserver', 'keyserver.ubuntu.com',
98 '--recv-keys', config['ppa-gpg-key']]
99 try:
100 subprocess.check_call(cmd)
101 except:
102 juju_log(MSG_ERROR, "Error importing repo key")
103
104
84def install(config):105def install(config):
85 charmhelpers.fetch.configure_sources(update=True)
86
87 pkgs = [x for x in config.get('packages', '').split(' ') if x]106 pkgs = [x for x in config.get('packages', '').split(' ') if x]
88 pkgs.append('python-amqplib')107 pkgs.append('python-amqplib')
89 pkgs.append('python-pip')108 pkgs.append('python-pip')
90 pkgs.append('bzr')109 pkgs.append('bzr')
91110
111 if config['proxy-url']:
112 juju_info('Setting up apt with {}'.format(config['proxy-url']))
113 setup_apt_proxy(config)
114
115 if config['ppa-gpg-key']:
116 juju_info('Importing key for {}'.format(config['ppa-gpg-key']))
117 import_ppa_keys(config)
92 juju_info('installing apt packages...')118 juju_info('installing apt packages...')
119 charmhelpers.fetch.configure_sources(update=True)
93 charmhelpers.fetch.apt_install(pkgs)120 charmhelpers.fetch.apt_install(pkgs)
94121
95 pip_pkgs = [x for x in config.get('pip-packages', '').split(' ') if x]122 pip_pkgs = [x for x in config.get('pip-packages', '').split(' ') if x]
@@ -129,14 +156,21 @@
129 setuid {uid}156 setuid {uid}
130 setgid {gid}157 setgid {gid}
131 chdir {sdir}158 chdir {sdir}
132159 {proxy}
133 exec {main}160 exec {main}
134 ''')161 ''')
162 proxy = ''
163 if config['proxy-url']:
164 url = config['proxy-url']
165 no_proxy = config['no-proxy']
166 proxy = ('env http_proxy={}\nenv https_proxy={}\n'
167 'env no_proxy={}\n'.format(url, url, no_proxy))
135 params = {168 params = {
136 'main': config['main'],169 'main': config['main'],
137 'sdir': _service_dir(config),170 'sdir': _service_dir(config),
138 'uid': config.get('uid', 'nobody'),171 'uid': config.get('uid', 'nobody'),
139 'gid': config.get('gid', 'nogroup'),172 'gid': config.get('gid', 'nogroup'),
173 'proxy': proxy,
140 }174 }
141 path = '/etc/init/{}.conf'.format(_service_name(config))175 path = '/etc/init/{}.conf'.format(_service_name(config))
142 with tempfile.NamedTemporaryFile('w', delete=False) as f:176 with tempfile.NamedTemporaryFile('w', delete=False) as f:
143177
=== modified file 'charms/precise/restish/config.yaml'
--- charms/precise/restish/config.yaml 2014-03-10 22:25:00 +0000
+++ charms/precise/restish/config.yaml 2014-05-29 10:25:18 +0000
@@ -41,7 +41,14 @@
41 type: string41 type: string
42 default: '/'42 default: '/'
43 description: The vhost in the rabbitMQ server.43 description: The vhost in the rabbitMQ server.
4444 proxy-url:
45 type: string
46 default: ""
47 description: The http proxy url for private clouds.
48 ppa-gpg-key:
49 type: string
50 default: ""
51 description: GPG key fingerprint for the PPA
45 # required for the gunicorn charm:52 # required for the gunicorn charm:
46 port:53 port:
47 type: int54 type: int
4855
=== modified file 'charms/precise/restish/hooks/hooks.py'
--- charms/precise/restish/hooks/hooks.py 2014-03-10 22:25:00 +0000
+++ charms/precise/restish/hooks/hooks.py 2014-05-29 10:25:18 +0000
@@ -6,6 +6,7 @@
6import subprocess6import subprocess
7import sys7import sys
8import time8import time
9import textwrap
910
10import charmhelpers.fetch11import charmhelpers.fetch
1112
@@ -82,12 +83,40 @@
82 subprocess.check_call(args)83 subprocess.check_call(args)
8384
8485
86def setup_apt_proxy(config):
87 proxy_url = config['proxy-url']
88 apt_conf = textwrap.dedent("""\
89 Acquire::http::proxy "%s";
90 Acquire::https::proxy "%s";
91 Acquire::HTTP::PROXY "%s";
92 Acquire::HTTPS::PROXY "%s";
93 """ % (proxy_url, proxy_url, proxy_url, proxy_url))
94 with open('/etc/apt/apt.conf.d/95proxies', 'w') as f:
95 f.write(apt_conf)
96
97
98def import_ppa_keys(config):
99 cmd = ['apt-key', 'adv', '--keyserver', 'keyserver.ubuntu.com',
100 '--recv-keys', config['ppa-gpg-key']]
101 try:
102 subprocess.check_call(cmd)
103 except:
104 juju_log(MSG_ERROR, "Error importing repo key")
105
106
85def install(config):107def install(config):
86 pkgs = [x for x in config['packages'].split(' ') if x]108 pkgs = [x for x in config['packages'].split(' ') if x]
87 pkgs.append('bzr')109 pkgs.append('bzr')
88 pkgs.append('python-restish')110 pkgs.append('python-restish')
89111
90 juju_info('installing apt packages...')112 juju_info('installing apt packages...')
113 if config['proxy-url']:
114 juju_info('Setting up apt with {}'.format(config['proxy-url']))
115 setup_apt_proxy(config)
116 if config['ppa-gpg-key']:
117 juju_info('Importing key for {}'.format(config['ppa-gpg-key']))
118 import_ppa_keys(config)
119
91 charmhelpers.fetch.configure_sources(update=True)120 charmhelpers.fetch.configure_sources(update=True)
92 charmhelpers.fetch.apt_install(pkgs)121 charmhelpers.fetch.apt_install(pkgs)
93122
94123
=== modified file 'juju-deployer/branch-source-builder.yaml.tmpl'
--- juju-deployer/branch-source-builder.yaml.tmpl 2014-03-14 10:37:28 +0000
+++ juju-deployer/branch-source-builder.yaml.tmpl 2014-05-29 10:25:18 +0000
@@ -8,6 +8,8 @@
8 vcs: ${CI_CODE_SOURCE}8 vcs: ${CI_CODE_SOURCE}
9 branch: ${CI_BRANCH}9 branch: ${CI_BRANCH}
10 tarball: ${CI_PAYLOAD_URL}10 tarball: ${CI_PAYLOAD_URL}
11 proxy-url: ${CI_PRIVATE_HTTP_PROXY}
12 ppa-gpg-key: ${CI_PPA_GPG_KEY}
11 python_path: ./branch-source-builder:./ci-utils13 python_path: ./branch-source-builder:./ci-utils
12 # need non-default package python-amqplib for this service14 # need non-default package python-amqplib for this service
13 packages: "python-webtest python-mock python-jinja2 python-amqplib"15 packages: "python-webtest python-mock python-jinja2 python-amqplib"
@@ -29,6 +31,9 @@
29 vcs: ${CI_CODE_SOURCE}31 vcs: ${CI_CODE_SOURCE}
30 branch: ${CI_BRANCH}32 branch: ${CI_BRANCH}
31 tarball: ${CI_PAYLOAD_URL}33 tarball: ${CI_PAYLOAD_URL}
34 proxy-url: ${CI_PRIVATE_HTTP_PROXY}
35 no-proxy: ${CI_PRIVATE_NO_PROXY}
36 ppa-gpg-key: ${CI_PPA_GPG_KEY}
32 unit-config: include-base64://configs/unit_config.yaml37 unit-config: include-base64://configs/unit_config.yaml
33 packages: "dput python-dput python-swiftclient lazr.enum"38 packages: "dput python-dput python-swiftclient lazr.enum"
34 install_sources: |39 install_sources: |
3540
=== modified file 'juju-deployer/deploy.py'
--- juju-deployer/deploy.py 2014-05-07 01:25:30 +0000
+++ juju-deployer/deploy.py 2014-05-29 10:25:18 +0000
@@ -77,6 +77,8 @@
77 'CI_MASTER_PPA': 'ppa:ci-engineering-airline/ci-archive',77 'CI_MASTER_PPA': 'ppa:ci-engineering-airline/ci-archive',
78 }78 }
79 missing_required = []79 missing_required = []
80 if not os.environ.get('CI_PRIVATE_NO_PROXY'):
81 missing_required.append('CI_PRIVATE_NO_PROXY')
80 for key in cheetah_vars:82 for key in cheetah_vars:
81 if key not in os.environ or len(os.environ[key]) == 0:83 if key not in os.environ or len(os.environ[key]) == 0:
82 default = cheetah_vars[key]84 default = cheetah_vars[key]
8385
=== modified file 'juju-deployer/image-builder.yaml.tmpl'
--- juju-deployer/image-builder.yaml.tmpl 2014-03-14 10:37:28 +0000
+++ juju-deployer/image-builder.yaml.tmpl 2014-05-29 10:25:18 +0000
@@ -8,6 +8,8 @@
8 vcs: ${CI_CODE_SOURCE}8 vcs: ${CI_CODE_SOURCE}
9 branch: ${CI_BRANCH}9 branch: ${CI_BRANCH}
10 tarball: ${CI_PAYLOAD_URL}10 tarball: ${CI_PAYLOAD_URL}
11 proxy-url: ${CI_PRIVATE_HTTP_PROXY}
12 ppa-gpg-key: ${CI_PPA_GPG_KEY}
11 python_path: ./image-builder:./ci-utils13 python_path: ./image-builder:./ci-utils
12 packages: "python-webtest python-mock python-jinja2 python-amqplib"14 packages: "python-webtest python-mock python-jinja2 python-amqplib"
13 json_status_path: api/v1/status15 json_status_path: api/v1/status
@@ -28,6 +30,9 @@
28 vcs: ${CI_CODE_SOURCE}30 vcs: ${CI_CODE_SOURCE}
29 branch: ${CI_BRANCH}31 branch: ${CI_BRANCH}
30 tarball: ${CI_PAYLOAD_URL}32 tarball: ${CI_PAYLOAD_URL}
33 proxy-url: ${CI_PRIVATE_HTTP_PROXY}
34 no-proxy: ${CI_PRIVATE_NO_PROXY}
35 ppa-gpg-key: ${CI_PPA_GPG_KEY}
31 packages: "qemu-utils python-glanceclient python-swiftclient"36 packages: "qemu-utils python-glanceclient python-swiftclient"
32 uid: root37 uid: root
33 unit-config: include-base64://configs/unit_config.yaml38 unit-config: include-base64://configs/unit_config.yaml
3439
=== modified file 'juju-deployer/lander.yaml.tmpl'
--- juju-deployer/lander.yaml.tmpl 2014-05-20 12:33:46 +0000
+++ juju-deployer/lander.yaml.tmpl 2014-05-29 10:25:18 +0000
@@ -7,6 +7,8 @@
7 vcs: ${CI_CODE_SOURCE}7 vcs: ${CI_CODE_SOURCE}
8 branch: ${CI_BRANCH}8 branch: ${CI_BRANCH}
9 tarball: ${CI_PAYLOAD_URL}9 tarball: ${CI_PAYLOAD_URL}
10 proxy-url: ${CI_PRIVATE_HTTP_PROXY}
11 ppa-gpg-key: ${CI_PPA_GPG_KEY}
10 python_path: "./lander:./ci-utils"12 python_path: "./lander:./ci-utils"
11 # need non-default package python-amqplib for this service13 # need non-default package python-amqplib for this service
12 packages: "python-webtest python-mock python-jinja2 python-jenkins"14 packages: "python-webtest python-mock python-jinja2 python-jenkins"
1315
=== modified file 'juju-deployer/test-runner.yaml.tmpl'
--- juju-deployer/test-runner.yaml.tmpl 2014-03-10 22:25:00 +0000
+++ juju-deployer/test-runner.yaml.tmpl 2014-05-29 10:25:18 +0000
@@ -13,6 +13,8 @@
13 vcs: ${CI_CODE_SOURCE}13 vcs: ${CI_CODE_SOURCE}
14 branch: ${CI_BRANCH}14 branch: ${CI_BRANCH}
15 tarball: ${CI_PAYLOAD_URL}15 tarball: ${CI_PAYLOAD_URL}
16 proxy-url: ${CI_PRIVATE_HTTP_PROXY}
17 ppa-gpg-key: ${CI_PPA_GPG_KEY}
16 python_path: test_runner:ci-utils18 python_path: test_runner:ci-utils
17 json_status_path: api/v1/status19 json_status_path: api/v1/status
1820
@@ -35,6 +37,9 @@
35 vcs: ${CI_CODE_SOURCE}37 vcs: ${CI_CODE_SOURCE}
36 branch: ${CI_BRANCH}38 branch: ${CI_BRANCH}
37 tarball: ${CI_PAYLOAD_URL}39 tarball: ${CI_PAYLOAD_URL}
40 proxy-url: ${CI_PRIVATE_HTTP_PROXY}
41 no-proxy: ${CI_PRIVATE_NO_PROXY}
42 ppa-gpg-key: ${CI_PPA_GPG_KEY}
38 packages: "python-requests python-novaclient python-swiftclient"43 packages: "python-requests python-novaclient python-swiftclient"
39 unit-config: include-base64://configs/unit_config.yaml44 unit-config: include-base64://configs/unit_config.yaml
40 uid: root45 uid: root

Subscribers

People subscribed via source and target branches