Merge lp:~macgreagoir/charms/trusty/heat/instance_user into lp:~openstack-charmers-archive/charms/trusty/heat/next

Proposed by Mick Gregg
Status: Merged
Merged at revision: 64
Proposed branch: lp:~macgreagoir/charms/trusty/heat/instance_user
Merge into: lp:~openstack-charmers-archive/charms/trusty/heat/next
Diff against target: 182 lines (+109/-2)
6 files modified
config.yaml (+7/-0)
hooks/heat_context.py (+12/-0)
hooks/heat_utils.py (+2/-0)
templates/icehouse/heat.conf (+79/-0)
templates/kilo/heat.conf (+1/-1)
unit_tests/test_heat_context.py (+8/-1)
To merge this branch: bzr merge lp:~macgreagoir/charms/trusty/heat/instance_user
Reviewer Review Type Date Requested Status
Liam Young (community) Approve
Ryan Beisner Pending
Review via email: mp+276499@code.launchpad.net

This proposal supersedes a proposal from 2015-05-06.

Commit message

[macgreagoir] Make heat.conf instance_user item configurable.

Description of the change

Made heat.conf instance_user configurable, as required for Icehouse

To post a comment you must log in.
Revision history for this message
uosci-testing-bot (uosci-testing-bot) wrote : Posted in a previous version of this proposal

charm_lint_check #4410 heat-next for macgreagoir mp258385
    LINT OK: passed

Build: http://10.245.162.77:8080/job/charm_lint_check/4410/

Revision history for this message
uosci-testing-bot (uosci-testing-bot) wrote : Posted in a previous version of this proposal

charm_unit_test #4135 heat-next for macgreagoir mp258385
    UNIT OK: passed

Build: http://10.245.162.77:8080/job/charm_unit_test/4135/

Revision history for this message
uosci-testing-bot (uosci-testing-bot) wrote : Posted in a previous version of this proposal

charm_amulet_test #4009 heat-next for macgreagoir mp258385
    AMULET FAIL: amulet-test missing

AMULET Results (max last 2 lines):
INFO:root:Search string not found in makefile target commands.
ERROR:root:No make target was executed.

Full amulet test output: http://paste.ubuntu.com/10997560/
Build: http://10.245.162.77:8080/job/charm_amulet_test/4009/

Revision history for this message
Ryan Beisner (1chb1n) wrote : Posted in a previous version of this proposal

Please see this example and adjust the proposed Makefile accordingly:
http://bazaar.launchpad.net/~openstack-charmers/charms/trusty/keystone/next/view/head:/Makefile#L12

You can take that section verbatim.

Thanks again!

review: Needs Fixing
Revision history for this message
uosci-testing-bot (uosci-testing-bot) wrote : Posted in a previous version of this proposal

charm_lint_check #4411 heat-next for macgreagoir mp258385
    LINT OK: passed

Build: http://10.245.162.77:8080/job/charm_lint_check/4411/

Revision history for this message
uosci-testing-bot (uosci-testing-bot) wrote : Posted in a previous version of this proposal

charm_unit_test #4136 heat-next for macgreagoir mp258385
    UNIT OK: passed

Build: http://10.245.162.77:8080/job/charm_unit_test/4136/

Revision history for this message
uosci-testing-bot (uosci-testing-bot) wrote : Posted in a previous version of this proposal

charm_amulet_test #4010 heat-next for macgreagoir mp258385
    AMULET OK: passed

Build: http://10.245.162.77:8080/job/charm_amulet_test/4010/

Revision history for this message
Ryan Beisner (1chb1n) wrote : Posted in a previous version of this proposal

Woot! FYI, full amulet output @ http://paste.ubuntu.com/10997892/

Revision history for this message
Ryan Beisner (1chb1n) wrote : Posted in a previous version of this proposal

I have work in progress about to land for heat amulet coverage, but if this MP lands first, that is ok. I'm happy to rebase and resolve any conflicts on my side.

However, if my stuff lands first, then this MP will likely have conflicts and the contributor will have to rework this MP a bit.

Revision history for this message
uosci-testing-bot (uosci-testing-bot) wrote : Posted in a previous version of this proposal

charm_lint_check #7870 heat-next for macgreagoir mp258385
    LINT OK: passed

Build: http://10.245.162.77:8080/job/charm_lint_check/7870/

Revision history for this message
uosci-testing-bot (uosci-testing-bot) wrote : Posted in a previous version of this proposal

charm_unit_test #7291 heat-next for macgreagoir mp258385
    UNIT OK: passed

Build: http://10.245.162.77:8080/job/charm_unit_test/7291/

Revision history for this message
uosci-testing-bot (uosci-testing-bot) wrote : Posted in a previous version of this proposal

charm_amulet_test #5760 heat-next for macgreagoir mp258385
    AMULET FAIL: amulet-test failed

AMULET Results (max last 2 lines):
make: *** [functional_test] Error 1
ERROR:root:Make target returned non-zero.

Full amulet test output: http://paste.ubuntu.com/12057843/
Build: http://10.245.162.77:8080/job/charm_amulet_test/5760/

Revision history for this message
uosci-testing-bot (uosci-testing-bot) wrote :

charm_lint_check #13105 heat-next for macgreagoir mp276499
    LINT OK: passed

Build: http://10.245.162.77:8080/job/charm_lint_check/13105/

Revision history for this message
uosci-testing-bot (uosci-testing-bot) wrote :

charm_unit_test #12217 heat-next for macgreagoir mp276499
    UNIT OK: passed

Build: http://10.245.162.77:8080/job/charm_unit_test/12217/

Revision history for this message
uosci-testing-bot (uosci-testing-bot) wrote :

charm_amulet_test #7721 heat-next for macgreagoir mp276499
    AMULET OK: passed

Build: http://10.245.162.77:8080/job/charm_amulet_test/7721/

Revision history for this message
Ryan Beisner (1chb1n) wrote :

Thank you for your work on this.

I wonder if the heat.conf template file will need to be split by OpenStack release, so that instance_user is not rendered after Juno? I see that the option is still present as of the Kilo Heat docs, and that it has been dropped as of the Liberty Heat docs.

The amulet test for heat doesn't yet exercise Liberty, so we don't know the impact of using or not using this option at that version. I imagine it will handle it gracefully, but we should confirm.

Otherwise, these look like sound changes to me.

For reference:
http://docs.openstack.org/juno/config-reference/content/ch_configuring-openstack-orchestration.html

http://docs.openstack.org/kilo/config-reference/content/ch_configuring-openstack-orchestration.html

http://docs.openstack.org/liberty/config-reference/content/ch_configuring-openstack-orchestration.html

Revision history for this message
Liam Young (gnuoy) wrote :

Hi, thanks for the MP! I agree with Ryan, if the setting is not used for Juno and above can we either split the templates up into Openstack series specific folders as we have with the other openstack charms or change the context so that the instance_user is only added to the context if Openstack release < Juno and update the template to only add an instance_user setting if instance user variable is set

review: Needs Fixing
47. By Mick Gregg

Merged with next

48. By Mick Gregg

[macgreagoir] Moved instance_user heat.conf change to icehouse/ template; updated kilo/ template

Revision history for this message
Mick Gregg (macgreagoir) wrote :

The setting is still used up to Juno, and requires the 'instance_user=' option in heat.conf. I've added a template for icehouse and updated the kilo one, with both using the new config option.

Revision history for this message
Mick Gregg (macgreagoir) wrote :

> The setting is still used up to Juno, and requires the 'instance_user=' option
> in heat.conf. I've added a template for icehouse and updated the kilo one,
> with both using the new config option.

Correction: "still used up to Kilo", hence the kilo template update

Revision history for this message
uosci-testing-bot (uosci-testing-bot) wrote :

charm_unit_test #13758 heat-next for macgreagoir mp276499
    UNIT OK: passed

Build: http://10.245.162.77:8080/job/charm_unit_test/13758/

Revision history for this message
uosci-testing-bot (uosci-testing-bot) wrote :

charm_lint_check #14755 heat-next for macgreagoir mp276499
    LINT OK: passed

Build: http://10.245.162.77:8080/job/charm_lint_check/14755/

Revision history for this message
uosci-testing-bot (uosci-testing-bot) wrote :

charm_amulet_test #8076 heat-next for macgreagoir mp276499
    AMULET FAIL: amulet-test failed

AMULET Results (max last 2 lines):
make: *** [functional_test] Error 1
ERROR:root:Make target returned non-zero.

Full amulet test output: http://paste.ubuntu.com/13629060/
Build: http://10.245.162.77:8080/job/charm_amulet_test/8076/

49. By Mick Gregg

Merge with next

Revision history for this message
uosci-testing-bot (uosci-testing-bot) wrote :

charm_lint_check #16599 heat-next for macgreagoir mp276499
    LINT OK: passed

Build: http://10.245.162.77:8080/job/charm_lint_check/16599/

Revision history for this message
uosci-testing-bot (uosci-testing-bot) wrote :

charm_unit_test #15502 heat-next for macgreagoir mp276499
    UNIT OK: passed

Build: http://10.245.162.77:8080/job/charm_unit_test/15502/

Revision history for this message
uosci-testing-bot (uosci-testing-bot) wrote :

charm_amulet_test #8521 heat-next for macgreagoir mp276499
    AMULET OK: passed

Build: http://10.245.162.77:8080/job/charm_amulet_test/8521/

Revision history for this message
Liam Young (gnuoy) wrote :

Hi Mick,

Thanks for your work on this. approved

Liam

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'config.yaml'
--- config.yaml 2015-11-16 09:14:33 +0000
+++ config.yaml 2016-01-05 15:04:28 +0000
@@ -40,6 +40,13 @@
40 default: heat40 default: heat
41 type: string41 type: string
42 description: Database name42 description: Database name
43 instance-user:
44 default:
45 type: string
46 description: |
47 The default user for new instances. This option is deprecated as of Juno.
48 If left empty, Heat will use the default user set up with your cloud
49 image (for OS::Nova::Server) or 'ec2-user' (for AWS::EC2::Instance).
43 region:50 region:
44 default: RegionOne51 default: RegionOne
45 type: string52 type: string
4653
=== modified file 'hooks/heat_context.py'
--- hooks/heat_context.py 2015-04-02 12:25:23 +0000
+++ hooks/heat_context.py 2016-01-05 15:04:28 +0000
@@ -96,3 +96,15 @@
9696
97 external_ports = API_PORTS.values()97 external_ports = API_PORTS.values()
98 service_namespace = 'heat'98 service_namespace = 'heat'
99
100
101class InstanceUserContext(context.OSContextGenerator):
102
103 def __call__(self):
104 ctxt = {}
105
106 instance_user = ''
107 if config('instance-user'):
108 instance_user = config('instance-user')
109 ctxt['instance_user'] = instance_user
110 return ctxt
99111
=== modified file 'hooks/heat_utils.py'
--- hooks/heat_utils.py 2015-11-16 09:14:33 +0000
+++ hooks/heat_utils.py 2016-01-05 15:04:28 +0000
@@ -38,6 +38,7 @@
38 API_PORTS,38 API_PORTS,
39 HeatIdentityServiceContext,39 HeatIdentityServiceContext,
40 EncryptionContext,40 EncryptionContext,
41 InstanceUserContext,
41 HeatApacheSSLContext,42 HeatApacheSSLContext,
42 HeatHAProxyContext,43 HeatHAProxyContext,
43)44)
@@ -86,6 +87,7 @@
86 HeatIdentityServiceContext(service=SVC, service_user=SVC),87 HeatIdentityServiceContext(service=SVC, service_user=SVC),
87 HeatHAProxyContext(),88 HeatHAProxyContext(),
88 EncryptionContext(),89 EncryptionContext(),
90 InstanceUserContext(),
89 context.SyslogContext(),91 context.SyslogContext(),
90 context.LogLevelContext(),92 context.LogLevelContext(),
91 context.BindHostContext()]93 context.BindHostContext()]
9294
=== added directory 'templates/icehouse'
=== added file 'templates/icehouse/heat.conf'
--- templates/icehouse/heat.conf 1970-01-01 00:00:00 +0000
+++ templates/icehouse/heat.conf 2016-01-05 15:04:28 +0000
@@ -0,0 +1,79 @@
1[DEFAULT]
2use_syslog = {{ use_syslog }}
3verbose = {{ verbose }}
4debug = {{ debug }}
5log_dir = /var/log/heat
6# Icehouse expects 'instance_user=' to allow the image's default user
7# Not including instance_user at all results in 'ec2-user' being used
8instance_user={{ instance_user }}
9instance_driver=heat.engine.nova
10plugin_dirs=/usr/lib64/heat,/usr/lib/heat
11environment_dir=/etc/heat/environment.d
12deferred_auth_method=password
13host=heat
14auth_encryption_key={{ encryption_key }}
15
16{% if database_host -%}
17# < Icehouse db config
18sql_connection = {{ database_type }}://{{ database_user }}:{{ database_password }}@{{ database_host }}/{{ database }}{% if database_ssl_ca %}?ssl_ca={{ database_ssl_ca }}{% if database_ssl_cert %}&ssl_cert={{ database_ssl_cert }}&ssl_key={{ database_ssl_key }}{% endif %}{% endif %}
19{% endif %}
20
21{% if rabbitmq_host or rabbitmq_hosts -%}
22rabbit_userid = {{ rabbitmq_user }}
23rabbit_virtual_host = {{ rabbitmq_virtual_host }}
24rabbit_password = {{ rabbitmq_password }}
25{% if rabbitmq_hosts -%}
26rabbit_hosts = {{ rabbitmq_hosts }}
27{% if rabbitmq_ha_queues -%}
28rabbit_ha_queues = True
29rabbit_durable_queues = False
30{% endif -%}
31{% else -%}
32rabbit_host = {{ rabbitmq_host }}
33{% endif -%}
34{% if rabbit_ssl_port -%}
35rabbit_use_ssl = True
36rabbit_port = {{ rabbit_ssl_port }}
37{% if rabbit_ssl_ca -%}
38kombu_ssl_ca_certs = {{ rabbit_ssl_ca }}
39{% endif -%}
40{% endif -%}
41{% endif %}
42
43{% if auth_host -%}
44[keystone_authtoken]
45auth_uri = {{ service_protocol }}://{{ service_host }}:{{ service_port }}/v2.0
46auth_host = {{ auth_host }}
47auth_port = {{ auth_port }}
48auth_protocol = {{ auth_protocol }}
49admin_tenant_name = {{ admin_tenant_name }}
50admin_user = {{ admin_user }}
51admin_password = {{ admin_password }}
52signing_dir = {{ signing_dir }}
53{% endif %}
54
55[ec2_authtoken]
56auth_uri = {{service_protocol }}://{{ service_host }}:{{ service_port }}/v2.0
57keystone_ec2_uri = {{service_protocol }}://{{ service_host }}:{{ service_port }}/v2.0/ec2tokens
58
59{% if database_host -%}
60[database]
61connection = {{ database_type }}://{{ database_user }}:{{ database_password }}@{{ database_host }}/{{ database }}{% if database_ssl_ca %}?ssl_ca={{ database_ssl_ca }}{% if database_ssl_cert %}&ssl_cert={{ database_ssl_cert }}&ssl_key={{ database_ssl_key }}{% endif %}{% endif %}
62{% endif -%}
63
64[paste_deploy]
65api_paste_config=/etc/heat/api-paste.ini
66
67[heat_api]
68{% if api_listen_port -%}
69bind_port={{ api_listen_port }}
70{% else -%}
71bind_port=8004
72{% endif %}
73
74[heat_api_cfn]
75{% if api_cfn_listen_port -%}
76bind_port={{ api_cfn_listen_port }}
77{% else -%}
78bind_port=8000
79{% endif %}
080
=== modified file 'templates/kilo/heat.conf'
--- templates/kilo/heat.conf 2015-10-30 10:53:01 +0000
+++ templates/kilo/heat.conf 2016-01-05 15:04:28 +0000
@@ -3,7 +3,7 @@
3debug = False3debug = False
4verbose = False4verbose = False
5log_dir = /var/log/heat5log_dir = /var/log/heat
6instance_user=ec2-user6instance_user={{ instance_user }}
7instance_driver=heat.engine.nova7instance_driver=heat.engine.nova
8plugin_dirs=/usr/lib64/heat,/usr/lib/heat8plugin_dirs=/usr/lib64/heat,/usr/lib/heat
9environment_dir=/etc/heat/environment.d9environment_dir=/etc/heat/environment.d
1010
=== modified file 'unit_tests/test_heat_context.py'
--- unit_tests/test_heat_context.py 2014-04-16 08:19:26 +0000
+++ unit_tests/test_heat_context.py 2016-01-05 15:04:28 +0000
@@ -4,7 +4,8 @@
44
5TO_PATCH = [5TO_PATCH = [
6 'get_encryption_key',6 'get_encryption_key',
7 'generate_ec2_tokens'7 'generate_ec2_tokens',
8 'config'
8]9]
910
1011
@@ -19,6 +20,12 @@
19 heat_context.EncryptionContext()(),20 heat_context.EncryptionContext()(),
20 {'encryption_key': 'key'})21 {'encryption_key': 'key'})
2122
23 def test_instance_user_empty_configuration(self):
24 self.config.return_value = None
25 self.assertEquals(
26 heat_context.InstanceUserContext()(),
27 {'instance_user': ''})
28
22 @patch('charmhelpers.contrib.openstack.'29 @patch('charmhelpers.contrib.openstack.'
23 'context.IdentityServiceContext.__call__')30 'context.IdentityServiceContext.__call__')
24 def test_identity_configuration(self, __call__):31 def test_identity_configuration(self, __call__):

Subscribers

People subscribed via source and target branches