Merge lp:~hopem/maas-deployer/env-vars into lp:~maas-deployers/maas-deployer/next

Proposed by Edward Hope-Morley
Status: Work in progress
Proposed branch: lp:~hopem/maas-deployer/env-vars
Merge into: lp:~maas-deployers/maas-deployer/next
Diff against target: 63 lines (+19/-0)
3 files modified
examples/deployment.yaml (+4/-0)
maas_deployer/vmaas/templates/cloud-init.cfg (+6/-0)
maas_deployer/vmaas/vm.py (+9/-0)
To merge this branch: bzr merge lp:~hopem/maas-deployer/env-vars
Reviewer Review Type Date Requested Status
MAAS Deployers Pending
Review via email: mp+284104@code.launchpad.net
To post a comment you must log in.
lp:~hopem/maas-deployer/env-vars updated
60. By Edward Hope-Morley

more

61. By Edward Hope-Morley

more

62. By Edward Hope-Morley

more

Unmerged revisions

62. By Edward Hope-Morley

more

61. By Edward Hope-Morley

more

60. By Edward Hope-Morley

more

59. By Edward Hope-Morley

more

58. By Edward Hope-Morley

[hopem,r=]

Add env_vars config to deployment.yaml to inject
environment variables into MAAS vm.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'examples/deployment.yaml'
2--- examples/deployment.yaml 2015-09-23 15:57:45 +0000
3+++ examples/deployment.yaml 2016-02-02 20:46:40 +0000
4@@ -34,6 +34,10 @@
5 # Apt http proxy setting(s)
6 #apt_http_proxy:
7
8+ # System environment variables
9+ #env_vars:
10+ # http_proxy:
11+
12 # Package sources. These will be used on the MAAS controller.
13 apt_sources:
14 - ppa:maas/stable
15
16=== modified file 'maas_deployer/vmaas/templates/cloud-init.cfg'
17--- maas_deployer/vmaas/templates/cloud-init.cfg 2015-12-04 16:19:01 +0000
18+++ maas_deployer/vmaas/templates/cloud-init.cfg 2016-02-02 20:46:40 +0000
19@@ -36,6 +36,12 @@
20 {{network_config}}
21 path: /etc/network/interfaces
22
23+{% if env_vars %}
24+bootcmd:
25+ - bash -c 'echo -e "{{ env_vars }}" > /etc/profile.d/maas-deployer.sh'
26+ - chmod 644 /etc/profile.d/maas-deployer.sh
27+ {% endif %}
28+
29 packages:
30 # MAAS Core Packages
31 - maas
32
33=== modified file 'maas_deployer/vmaas/vm.py'
34--- maas_deployer/vmaas/vm.py 2015-09-23 15:57:45 +0000
35+++ maas_deployer/vmaas/vm.py 2016-02-02 20:46:40 +0000
36@@ -301,6 +301,7 @@
37 self.node_group_ifaces = params.get('node_group_ifaces')
38 self.apt_http_proxy = params.get('apt_http_proxy')
39 self.apt_sources = params.get('apt_sources')
40+ self.env_vars = params.get('env_vars')
41
42 def _get_cloud_image_info(self):
43 """
44@@ -443,11 +444,19 @@
45 etc_net_interfaces = ["%s%s" % (indent, l.rstrip()) for l in
46 etc_net_interfaces]
47
48+ if self.env_vars:
49+ env_vars = ["export %s=%s" % (k,v) for k,v in
50+ self.env_vars.iteritems()]
51+ env_vars = "\\n".join(env_vars)
52+ else:
53+ env_vars = None
54+
55 parms = {
56 'hostname': self.name,
57 'user': self.user,
58 'password': self.password,
59 'ssh_key': self._get_ssh_key(),
60+ 'env_vars': env_vars,
61 'apt_http_proxy': self.apt_http_proxy,
62 'apt_sources': self.apt_sources,
63 'network_config': '\n'.join(etc_net_interfaces)

Subscribers

People subscribed via source and target branches