Merge lp:~corey.bryant/charms/trusty/keystone/git into lp:~openstack-charmers-archive/charms/trusty/keystone/next

Proposed by Corey Bryant
Status: Merged
Merged at revision: 142
Proposed branch: lp:~corey.bryant/charms/trusty/keystone/git
Merge into: lp:~openstack-charmers-archive/charms/trusty/keystone/next
Diff against target: 1298 lines (+792/-65)
26 files modified
.bzrignore (+1/-0)
Makefile (+4/-2)
README.md (+60/-0)
actions.yaml (+2/-0)
actions/git_reinstall.py (+45/-0)
charm-helpers-hooks.yaml (+1/-0)
config.yaml (+16/-0)
hooks/charmhelpers/contrib/openstack/utils.py (+4/-1)
hooks/charmhelpers/contrib/python/debug.py (+56/-0)
hooks/charmhelpers/contrib/python/rpdb.py (+58/-0)
hooks/charmhelpers/contrib/python/version.py (+34/-0)
hooks/keystone_hooks.py (+11/-2)
hooks/keystone_utils.py (+102/-7)
templates/git/logging.conf (+39/-0)
tests/10-basic-precise-essex (+0/-9)
tests/11-basic-precise-folsom (+0/-11)
tests/12-basic-precise-grizzly (+0/-11)
tests/13-basic-precise-havana (+0/-11)
tests/16-basic-trusty-icehouse-git (+9/-0)
tests/17-basic-trusty-juno (+11/-0)
tests/18-basic-trusty-juno-git (+12/-0)
tests/basic_deployment.py (+23/-2)
unit_tests/__init__.py (+1/-0)
unit_tests/test_actions_git_reinstall.py (+95/-0)
unit_tests/test_keystone_hooks.py (+111/-6)
unit_tests/test_keystone_utils.py (+97/-3)
To merge this branch: bzr merge lp:~corey.bryant/charms/trusty/keystone/git
Reviewer Review Type Date Requested Status
Ryan Beisner (community) Needs Fixing
James Page Needs Fixing
Billy Olsen Needs Fixing
Review via email: mp+242864@code.launchpad.net
To post a comment you must log in.
Revision history for this message
uosci-testing-bot (uosci-testing-bot) wrote :

UOSCI bot says:
charm_lint_check #1228 keystone-next for corey.bryant mp242864
    LINT OK: passed

LINT Results (max last 5 lines):
  I: config.yaml: option ssl_ca has no default value
  I: config.yaml: option os-public-network has no default value
  I: config.yaml: option os-admin-network has no default value
  I: config.yaml: option ssl_cert has no default value
  I: config.yaml: option os-internal-network has no default value

Full lint test output: http://paste.ubuntu.com/9252812/
Build: http://10.98.191.181:8080/job/charm_lint_check/1228/

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

UOSCI bot says:
charm_unit_test #1062 keystone-next for corey.bryant mp242864
    UNIT FAIL: unit-test failed

UNIT Results (max last 5 lines):
  hooks/keystone_utils 423 234 45% 228, 246, 268-273, 277-282, 312-324, 331-340, 347-362, 369-377, 382-392, 399-425, 430-439, 444-458, 463-485, 490-507, 521-544, 553-558, 563, 570-580, 585-593, 598-603, 607-614, 622-627, 638-653, 657-665, 690-691, 770, 773, 822-835, 859-863, 867-879, 884-887, 892-918, 923-946, 951, 962
  TOTAL 835 445 47%
  Ran 38 tests in 3.505s
  FAILED (errors=8)
  make: *** [unit_test] Error 1

Full unit test output: http://paste.ubuntu.com/9252831/
Build: http://10.98.191.181:8080/job/charm_unit_test/1062/

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

UOSCI bot says:
charm_amulet_test #531 keystone-next for corey.bryant mp242864
    AMULET FAIL: amulet-test failed

AMULET Results (max last 5 lines):
  juju-test.conductor DEBUG : Calling "juju destroy-environment -y osci-sv10"
  WARNING cannot delete security group "juju-osci-sv10-0". Used by another environment?
  juju-test INFO : Results: 2 passed, 1 failed, 0 errored
  ERROR subprocess encountered error code 1
  make: *** [test] Error 1

Full amulet test output: http://paste.ubuntu.com/9252982/
Build: http://10.98.191.181:8080/job/charm_amulet_test/531/

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

UOSCI bot says:
charm_lint_check #1298 keystone-next for corey.bryant mp242864
    LINT OK: passed

LINT Results (max last 5 lines):
  I: config.yaml: option ssl_ca has no default value
  I: config.yaml: option os-public-network has no default value
  I: config.yaml: option os-admin-network has no default value
  I: config.yaml: option ssl_cert has no default value
  I: config.yaml: option os-internal-network has no default value

Full lint test output: http://paste.ubuntu.com/9331788/
Build: http://10.98.191.181:8080/job/charm_lint_check/1298/

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

UOSCI bot says:
charm_unit_test #1132 keystone-next for corey.bryant mp242864
    UNIT FAIL: unit-test failed

UNIT Results (max last 5 lines):
  hooks/keystone_utils 423 234 45% 228, 246, 268-273, 277-282, 312-324, 331-340, 347-362, 369-377, 382-392, 399-425, 430-439, 444-458, 463-485, 490-507, 521-544, 553-558, 563, 570-580, 585-593, 598-603, 607-614, 622-627, 638-653, 657-665, 690-691, 770, 773, 822-835, 859-863, 867-879, 884-887, 892-918, 923-946, 951, 962
  TOTAL 835 445 47%
  Ran 38 tests in 3.459s
  FAILED (errors=8)
  make: *** [unit_test] Error 1

Full unit test output: http://paste.ubuntu.com/9331790/
Build: http://10.98.191.181:8080/job/charm_unit_test/1132/

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

UOSCI bot says:
charm_amulet_test #564 keystone-next for corey.bryant mp242864
    AMULET FAIL: amulet-test failed

AMULET Results (max last 5 lines):
  juju-test.conductor DEBUG : Calling "juju destroy-environment -y osci-sv07"
  WARNING cannot delete security group "juju-osci-sv07-0". Used by another environment?
  juju-test INFO : Results: 2 passed, 1 failed, 0 errored
  ERROR subprocess encountered error code 1
  make: *** [test] Error 1

Full amulet test output: http://paste.ubuntu.com/9331907/
Build: http://10.98.191.181:8080/job/charm_amulet_test/564/

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

UOSCI bot says:
charm_lint_check #1305 keystone-next for corey.bryant mp242864
    LINT OK: passed

LINT Results (max last 5 lines):
  I: config.yaml: option ssl_ca has no default value
  I: config.yaml: option os-public-network has no default value
  I: config.yaml: option os-admin-network has no default value
  I: config.yaml: option ssl_cert has no default value
  I: config.yaml: option os-internal-network has no default value

Full lint test output: http://paste.ubuntu.com/9351204/
Build: http://10.98.191.181:8080/job/charm_lint_check/1305/

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

UOSCI bot says:
charm_unit_test #1139 keystone-next for corey.bryant mp242864
    UNIT FAIL: unit-test failed

UNIT Results (max last 5 lines):
  hooks/keystone_utils 423 234 45% 228, 246, 268-273, 277-282, 312-324, 331-340, 347-362, 369-377, 382-392, 399-425, 430-439, 444-458, 463-485, 490-507, 521-544, 553-558, 563, 570-580, 585-593, 598-603, 607-614, 622-627, 638-653, 657-665, 690-691, 770, 773, 822-835, 859-863, 867-879, 884-887, 892-918, 923-946, 951, 962
  TOTAL 835 445 47%
  Ran 38 tests in 3.299s
  FAILED (errors=8)
  make: *** [unit_test] Error 1

Full unit test output: http://paste.ubuntu.com/9351206/
Build: http://10.98.191.181:8080/job/charm_unit_test/1139/

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

UOSCI bot says:
charm_amulet_test #571 keystone-next for corey.bryant mp242864
    AMULET FAIL: amulet-test failed

AMULET Results (max last 5 lines):
  juju-test.conductor DEBUG : Calling "juju destroy-environment -y osci-sv05"
  WARNING cannot delete security group "juju-osci-sv05-0". Used by another environment?
  juju-test INFO : Results: 2 passed, 1 failed, 0 errored
  ERROR subprocess encountered error code 1
  make: *** [test] Error 1

Full amulet test output: http://paste.ubuntu.com/9351283/
Build: http://10.98.191.181:8080/job/charm_amulet_test/571/

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

UOSCI bot says:
charm_lint_check #1314 keystone-next for corey.bryant mp242864
    LINT OK: passed

LINT Results (max last 5 lines):
  I: config.yaml: option ssl_ca has no default value
  I: config.yaml: option os-public-network has no default value
  I: config.yaml: option os-admin-network has no default value
  I: config.yaml: option ssl_cert has no default value
  I: config.yaml: option os-internal-network has no default value

Full lint test output: http://paste.ubuntu.com/9354900/
Build: http://10.98.191.181:8080/job/charm_lint_check/1314/

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

UOSCI bot says:
charm_unit_test #1148 keystone-next for corey.bryant mp242864
    UNIT FAIL: unit-test failed

UNIT Results (max last 5 lines):
  hooks/keystone_utils 423 234 45% 228, 246, 268-273, 277-282, 312-324, 331-340, 347-362, 369-377, 382-392, 399-425, 430-439, 444-458, 463-485, 490-507, 521-544, 553-558, 563, 570-580, 585-593, 598-603, 607-614, 622-627, 638-653, 657-665, 690-691, 770, 773, 822-835, 859-863, 867-879, 884-887, 892-918, 923-946, 951, 962
  TOTAL 835 445 47%
  Ran 38 tests in 3.238s
  FAILED (errors=8)
  make: *** [unit_test] Error 1

Full unit test output: http://paste.ubuntu.com/9354908/
Build: http://10.98.191.181:8080/job/charm_unit_test/1148/

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

UOSCI bot says:
charm_amulet_test #580 keystone-next for corey.bryant mp242864
    AMULET FAIL: amulet-test failed

AMULET Results (max last 5 lines):
  ERROR waited for 10m0s without being able to connect: ssh: connect to host 10.210.0.82 port 22: No route to host
  juju-test.conductor WARNING : Could not bootstrap osci-sv10, got Bootstrap returned with an exit > 0. Skipping
  juju-test INFO : Results: 1 passed, 0 failed, 2 errored
  ERROR subprocess encountered error code 124
  make: *** [test] Error 124

Full amulet test output: http://paste.ubuntu.com/9355005/
Build: http://10.98.191.181:8080/job/charm_amulet_test/580/

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

UOSCI bot says:
charm_unit_test #1150 keystone-next for corey.bryant mp242864
    UNIT FAIL: unit-test failed

UNIT Results (max last 5 lines):
   413 2% 20-962
  TOTAL 835 822 2%
  Ran 3 tests in 0.003s
  FAILED (errors=3)
  make: *** [unit_test] Error 1

Full unit test output: http://paste.ubuntu.com/9355731/
Build: http://10.98.191.181:8080/job/charm_unit_test/1150/

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

UOSCI bot says:
charm_lint_check #1316 keystone-next for corey.bryant mp242864
    LINT OK: passed

LINT Results (max last 5 lines):
  I: config.yaml: option ssl_ca has no default value
  I: config.yaml: option os-public-network has no default value
  I: config.yaml: option os-admin-network has no default value
  I: config.yaml: option ssl_cert has no default value
  I: config.yaml: option os-internal-network has no default value

Full lint test output: http://paste.ubuntu.com/9355730/
Build: http://10.98.191.181:8080/job/charm_lint_check/1316/

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

UOSCI bot says:
charm_amulet_test #582 keystone-next for corey.bryant mp242864
    AMULET FAIL: amulet-test failed

AMULET Results (max last 5 lines):
  juju-test.conductor DEBUG : Calling "juju destroy-environment -y osci-sv07"
  WARNING cannot delete security group "juju-osci-sv07-0". Used by another environment?
  juju-test INFO : Results: 1 passed, 2 failed, 0 errored
  ERROR subprocess encountered error code 2
  make: *** [test] Error 2

Full amulet test output: http://paste.ubuntu.com/9355789/
Build: http://10.98.191.181:8080/job/charm_amulet_test/582/

Revision history for this message
Billy Olsen (billy-olsen) wrote :

A few general comments below and in-line (some really belong on the charm-helpers merge and I acknowledge that, but it was seen while reviewing this change). Mainly the test portion needs resolution...

- Needed to do an additional make sync to get unit_tests to run & successful deployment
- Needed to mock out git_install_requested, though it doesn't appear to have broken any tests when locally mocked, but no new coverage either.

Bigger comments which are outside the scope of this review (but I want to capture them)

- It'd be kind of nice if there was a way to specify the equivalent GIT_BASE variable as in devstack's stackrc (as I had to change to https:// instead of git:// to run in our stack).

- hacluster will work with the keystone service since its only carrying the vip across the api endpoints in an active-active. However, this won't be the case for all services... but being able to run ha against tree is quite nice.

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

UOSCI bot says:
charm_lint_check #96 keystone-next for corey.bryant mp242864
    LINT OK: passed

LINT Results (max last 5 lines):
  I: config.yaml: option ssl_ca has no default value
  I: config.yaml: option os-public-network has no default value
  I: config.yaml: option os-admin-network has no default value
  I: config.yaml: option ssl_cert has no default value
  I: config.yaml: option os-internal-network has no default value

Full lint test output: pastebin not avail., cmd error
Build: http://10.230.18.80:8080/job/charm_lint_check/96/

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

UOSCI bot says:
charm_unit_test #96 keystone-next for corey.bryant mp242864
    UNIT FAIL: unit-test failed

UNIT Results (max last 5 lines):
   413 2% 20-962
  TOTAL 835 822 2%
  Ran 3 tests in 0.003s
  FAILED (errors=3)
  make: *** [unit_test] Error 1

Full unit test output: pastebin not avail., cmd error
Build: http://10.230.18.80:8080/job/charm_unit_test/96/

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

UOSCI bot says:
charm_amulet_test #56 keystone-next for corey.bryant mp242864
    AMULET FAIL: amulet-test failed

AMULET Results (max last 5 lines):
  juju-test.conductor DEBUG : Tearing down osci-sv04 juju environment
  juju-test.conductor DEBUG : Calling "juju destroy-environment -y osci-sv04"
  juju-test INFO : Results: 1 passed, 2 failed, 0 errored
  ERROR subprocess encountered error code 2
  make: *** [test] Error 2

Full amulet test output: pastebin not avail., cmd error
Build: http://10.230.18.80:8080/job/charm_amulet_test/56/

Revision history for this message
Corey Bryant (corey.bryant) wrote :

Note that those who are interested can easily test this with these scripts (see the README):
https://code.launchpad.net/~corey.bryant/+junk/smack-stack

Revision history for this message
Corey Bryant (corey.bryant) wrote :

Billy, thanks for the review and sorry for my delay in responding. I replied to all of your comments.

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

charm_lint_check #206 keystone-next for corey.bryant mp242864
    LINT OK: passed

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

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

charm_unit_test #235 keystone-next for corey.bryant mp242864
    UNIT OK: passed

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

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

charm_amulet_test #254 keystone-next for corey.bryant mp242864
    AMULET FAIL: amulet-test failed

AMULET Results (max last 2 lines):
  ERROR subprocess encountered error code 1
  make: *** [test] Error 1

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

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

charm_lint_check #799 keystone-next for corey.bryant mp242864
    LINT OK: passed

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

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

charm_unit_test #828 keystone-next for corey.bryant mp242864
    UNIT FAIL: unit-test failed

UNIT Results (max last 2 lines):
  FAILED (errors=1, failures=2)
  make: *** [unit_test] Error 1

Full unit test output: http://paste.ubuntu.com/9763452/
Build: http://10.245.162.77:8080/job/charm_unit_test/828/

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

charm_amulet_test #988 keystone-next for corey.bryant mp242864
    AMULET OK: passed

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

Revision history for this message
Corey Bryant (corey.bryant) wrote :

adding inline comment from review with James

Revision history for this message
Corey Bryant (corey.bryant) wrote :

more inline comments from review with James

Revision history for this message
Corey Bryant (corey.bryant) wrote :

1 more inline comment

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

charm_lint_check #2784 keystone-next for corey.bryant mp242864
    LINT OK: passed

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

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

charm_unit_test #2575 keystone-next for corey.bryant mp242864
    UNIT OK: passed

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

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

charm_amulet_test #2623 keystone-next for corey.bryant mp242864
    AMULET OK: passed

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

129. By Corey Bryant

Drop .git suffixes from README

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

charm_lint_check #2786 keystone-next for corey.bryant mp242864
    LINT OK: passed

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

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

charm_unit_test #2577 keystone-next for corey.bryant mp242864
    UNIT OK: passed

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

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

charm_amulet_test #2625 keystone-next for corey.bryant mp242864
    AMULET OK: passed

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

130. By Corey Bryant

Add config file and log file to git upstart template

131. By Corey Bryant

Merge next branch

132. By Corey Bryant

Update git_post_install unit test

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

charm_lint_check #2969 keystone-next for corey.bryant mp242864
    LINT OK: passed

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

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

charm_unit_test #2760 keystone-next for corey.bryant mp242864
    UNIT OK: passed

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

Revision history for this message
James Page (james-page) :
review: Needs Fixing
133. By Corey Bryant

Sync charm-helpers

134. By Corey Bryant

Simplify openstack-origin-git default

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

charm_amulet_test #2751 keystone-next for corey.bryant mp242864
    AMULET OK: passed

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

135. By Corey Bryant

Merge next branch

136. By Corey Bryant

unit test updates

Revision history for this message
James Page (james-page) wrote :

As far as I'm concerned this is good to land once the proxy use has been resolved, so we don't have to hardcode the Canonical internal proxy into the codebase.

137. By Corey Bryant

Sync charm-helpers

138. By Corey Bryant

Use http(s)_proxy from openstack-origin-git yaml

139. By Corey Bryant

Merge next branch

140. By Corey Bryant

Fix amulet test errors

141. By Corey Bryant

Sync charm-helpers

142. By Corey Bryant

Drop tags

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

charm_lint_check #3074 keystone-next for corey.bryant mp242864
    LINT OK: passed

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

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

charm_lint_check #3075 keystone-next for corey.bryant mp242864
    LINT OK: passed

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

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

charm_unit_test #2863 keystone-next for corey.bryant mp242864
    UNIT OK: passed

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

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

charm_amulet_test #2893 keystone-next for corey.bryant mp242864
    AMULET OK: passed

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

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

FYI, full amulet output @ http://paste.ubuntu.com/10763812/.

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

charm_lint_check #3108 keystone-next for corey.bryant mp242864
    LINT OK: passed

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

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

charm_unit_test #2896 keystone-next for corey.bryant mp242864
    UNIT OK: passed

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

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

charm_amulet_test #2935 keystone-next for corey.bryant mp242864
    AMULET OK: passed

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

143. By Corey Bryant

Pass list of config_files to git.upstart template

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

charm_lint_check #3164 keystone-next for corey.bryant mp242864
    LINT OK: passed

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

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

charm_unit_test #2952 keystone-next for corey.bryant mp242864
    UNIT FAIL: unit-test failed

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

Full unit test output: http://paste.ubuntu.com/10775161/
Build: http://10.245.162.77:8080/job/charm_unit_test/2952/

144. By Corey Bryant

Unit test updates for config file template change

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

charm_amulet_test #2956 keystone-next for corey.bryant mp242864
    AMULET FAIL: amulet-test failed

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

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

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

charm_lint_check #3166 keystone-next for corey.bryant mp242864
    LINT OK: passed

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

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

charm_unit_test #2954 keystone-next for corey.bryant mp242864
    UNIT OK: passed

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

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

charm_amulet_test #2958 keystone-next for corey.bryant mp242864
    AMULET FAIL: amulet-test failed

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

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

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

Please reconsider hard-coding squid proxy values to the Canonical internal http proxy. If we do this, then when third parties attempt to contribute to the charm, they won't be able to run the tests successfully.

Instead, it would be safer to detect whether or not the AMULET_HTTP_PROXY environment variable is set, and if it is, proceed to set http_proxy and https_proxy equal to AMULET_HTTP_PROXY.

This is regarding _configure_services in the tests/basic_deployment.py file.

Thank you!

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

PS ^^ I won't add that to all of the **git MPs, as this is the one on the frontier. ;-) But please interpret that comment as applying to all of them. Thanks again!

145. By Corey Bryant

Get http_proxy from AMULET_HTTP_PROXY env var

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

charm_lint_check #3283 keystone-next for corey.bryant mp242864
    LINT OK: passed

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

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

charm_unit_test #3071 keystone-next for corey.bryant mp242864
    UNIT OK: passed

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

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

charm_amulet_test #3100 keystone-next for corey.bryant mp242864
    AMULET OK: passed

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

146. By Corey Bryant

Move deploy from source template files to templates/git

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

charm_lint_check #3289 keystone-next for corey.bryant mp242864
    LINT OK: passed

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

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

charm_unit_test #3077 keystone-next for corey.bryant mp242864
    UNIT OK: passed

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

147. By Corey Bryant

Add templates/git/logging.conf

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

charm_lint_check #3290 keystone-next for corey.bryant mp242864
    LINT OK: passed

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

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

charm_unit_test #3078 keystone-next for corey.bryant mp242864
    UNIT OK: passed

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

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

charm_amulet_test #3106 keystone-next for corey.bryant mp242864
    AMULET OK: passed

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

Revision history for this message
Corey Bryant (corey.bryant) wrote :

I don't understand the conflicts so I'm leaving this as is. I don't think they are issues.

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

charm_lint_check #3295 keystone-next for corey.bryant mp242864
    LINT OK: passed

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

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

charm_unit_test #3083 keystone-next for corey.bryant mp242864
    UNIT OK: passed

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

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

charm_amulet_test #3107 keystone-next for corey.bryant mp242864
    AMULET OK: passed

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

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

charm_amulet_test #3112 keystone-next for corey.bryant mp242864
    AMULET OK: passed

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

148. By Corey Bryant

Bulk copy files to /etc/keystone

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

charm_lint_check #3300 keystone-next for corey.bryant mp242864
    LINT OK: passed

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

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

charm_unit_test #3088 keystone-next for corey.bryant mp242864
    UNIT OK: passed

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

149. By Corey Bryant

Turn DEBUG on by default for amulet tests

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

charm_amulet_test #3118 keystone-next for corey.bryant mp242864
    AMULET FAIL: amulet-test failed

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

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

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

charm_lint_check #3302 keystone-next for corey.bryant mp242864
    LINT OK: passed

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

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

charm_unit_test #3090 keystone-next for corey.bryant mp242864
    UNIT OK: passed

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

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

charm_amulet_test #3121 keystone-next for corey.bryant mp242864
    AMULET OK: passed

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

150. By Corey Bryant

Run config-changed hook after git-reinstall action installs from source

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

charm_lint_check #3314 keystone-next for corey.bryant mp242864
    LINT OK: passed

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

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

charm_unit_test #3102 keystone-next for corey.bryant mp242864
    UNIT OK: passed

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

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

charm_amulet_test #3135 keystone-next for corey.bryant mp242864
    AMULET OK: passed

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

151. By Corey Bryant

Fixup test_git_reinstall_exception()

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

charm_lint_check #3393 keystone-next for corey.bryant mp242864
    LINT OK: passed

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

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

charm_unit_test #3181 keystone-next for corey.bryant mp242864
    UNIT OK: passed

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

152. By Corey Bryant

Merge next branch

153. By Corey Bryant

Sync charm-helpers

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

charm_lint_check #3401 keystone-next for corey.bryant mp242864
    LINT OK: passed

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

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

charm_unit_test #3189 keystone-next for corey.bryant mp242864
    UNIT OK: passed

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

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

charm_amulet_test #3183 keystone-next for corey.bryant mp242864
    AMULET OK: passed

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

154. By Corey Bryant

Move config_changed into try block

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

charm_amulet_test #3194 keystone-next for corey.bryant mp242864
    AMULET OK: passed

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

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

charm_lint_check #3410 keystone-next for corey.bryant mp242864
    LINT OK: passed

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

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

charm_unit_test #3198 keystone-next for corey.bryant mp242864
    UNIT OK: passed

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

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

charm_amulet_test #3203 keystone-next for corey.bryant mp242864
    AMULET OK: passed

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

155. By Corey Bryant

Sync charm-helpers

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

charm_lint_check #3449 keystone-next for corey.bryant mp242864
    LINT OK: passed

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

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

charm_unit_test #3237 keystone-next for corey.bryant mp242864
    UNIT OK: passed

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

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file '.bzrignore'
2--- .bzrignore 2014-07-25 08:13:49 +0000
3+++ .bzrignore 2015-04-16 14:39:37 +0000
4@@ -1,3 +1,4 @@
5 revision
6 bin
7 .coverage
8+tags
9
10=== modified file 'Makefile'
11--- Makefile 2015-03-11 12:11:10 +0000
12+++ Makefile 2015-04-16 14:39:37 +0000
13@@ -2,7 +2,7 @@
14 PYTHON := /usr/bin/env python
15
16 lint:
17- @flake8 --exclude hooks/charmhelpers hooks unit_tests tests
18+ @flake8 --exclude hooks/charmhelpers actions hooks unit_tests tests
19 @charm proof
20
21 unit_test:
22@@ -15,7 +15,9 @@
23 # raise_status() messages to stderr:
24 # https://bugs.launchpad.net/amulet/+bug/1320357
25 @juju test -v -p AMULET_HTTP_PROXY --timeout 900 \
26- 00-setup 14-basic-precise-icehouse 15-basic-trusty-icehouse
27+ 00-setup 14-basic-precise-icehouse 15-basic-trusty-icehouse \
28+ 16-basic-trusty-icehouse-git 17-basic-trusty-juno \
29+ 18-basic-trusty-juno-git
30
31 bin/charm_helpers_sync.py:
32 @mkdir -p bin
33
34=== modified file 'README.md'
35--- README.md 2015-01-22 14:35:41 +0000
36+++ README.md 2015-04-16 14:39:37 +0000
37@@ -68,3 +68,63 @@
38 Otherwise it will be assumed that this unit may come back at some point and
39 therefore must be know to be in-sync with the rest before continuing.
40
41+Deploying from source
42+---------------------
43+
44+The minimum openstack-origin-git config required to deploy from source is:
45+
46+ openstack-origin-git:
47+ "repositories:
48+ - {name: requirements,
49+ repository: 'git://git.openstack.org/openstack/requirements',
50+ branch: stable/juno}
51+ - {name: keystone,
52+ repository: 'git://git.openstack.org/openstack/keystone',
53+ branch: stable/juno}"
54+
55+Note that there are only two 'name' values the charm knows about: 'requirements'
56+and 'keystone'. These repositories must correspond to these 'name' values.
57+Additionally, the requirements repository must be specified first and the
58+keystone repository must be specified last. All other repostories are installed
59+in the order in which they are specified.
60+
61+The following is a full list of current tip repos (may not be up-to-date):
62+
63+ openstack-origin-git:
64+ "repositories:
65+ - {name: requirements,
66+ repository: 'git://git.openstack.org/openstack/requirements',
67+ branch: master}
68+ - {name: oslo-concurrency,
69+ repository: 'git://git.openstack.org/openstack/oslo.concurrency',
70+ branch: master}
71+ - {name: oslo-config,
72+ repository: 'git://git.openstack.org/openstack/oslo.config',
73+ branch: master}
74+ - {name: oslo-db,
75+ repository: 'git://git.openstack.org/openstack/oslo.db',
76+ branch: master}
77+ - {name: oslo-i18n,
78+ repository: 'git://git.openstack.org/openstack/oslo.i18n',
79+ branch: master}
80+ - {name: oslo-serialization,
81+ repository: 'git://git.openstack.org/openstack/oslo.serialization',
82+ branch: master}
83+ - {name: oslo-utils,
84+ repository: 'git://git.openstack.org/openstack/oslo.utils',
85+ branch: master}
86+ - {name: pbr,
87+ repository: 'git://git.openstack.org/openstack-dev/pbr',
88+ branch: master}
89+ - {name: python-keystoneclient,
90+ repository: 'git://git.openstack.org/openstack/python-keystoneclient',
91+ branch: master}
92+ - {name: sqlalchemy-migrate,
93+ repository: 'git://git.openstack.org/stackforge/sqlalchemy-migrate',
94+ branch: master}
95+ - {name: keystonemiddleware,
96+ repository: 'git://git.openstack.org/openstack/keystonemiddleware',
97+ branch: master}
98+ - {name: keystone,
99+ repository: 'git://git.openstack.org/openstack/keystone',
100+ branch: master}"
101
102=== added directory 'actions'
103=== added file 'actions.yaml'
104--- actions.yaml 1970-01-01 00:00:00 +0000
105+++ actions.yaml 2015-04-16 14:39:37 +0000
106@@ -0,0 +1,2 @@
107+git-reinstall:
108+ description: Reinstall keystone from the openstack-origin-git repositories.
109
110=== added symlink 'actions/git-reinstall'
111=== target is u'git_reinstall.py'
112=== added file 'actions/git_reinstall.py'
113--- actions/git_reinstall.py 1970-01-01 00:00:00 +0000
114+++ actions/git_reinstall.py 2015-04-16 14:39:37 +0000
115@@ -0,0 +1,45 @@
116+#!/usr/bin/python
117+import sys
118+import traceback
119+
120+sys.path.append('hooks/')
121+
122+from charmhelpers.contrib.openstack.utils import (
123+ git_install_requested,
124+)
125+
126+from charmhelpers.core.hookenv import (
127+ action_set,
128+ action_fail,
129+ config,
130+)
131+
132+from keystone_utils import (
133+ git_install,
134+)
135+
136+from keystone_hooks import (
137+ config_changed,
138+)
139+
140+
141+def git_reinstall():
142+ """Reinstall from source and restart services.
143+
144+ If the openstack-origin-git config option was used to install openstack
145+ from source git repositories, then this action can be used to reinstall
146+ from updated git repositories, followed by a restart of services."""
147+ if not git_install_requested():
148+ action_fail('openstack-origin-git is not configured')
149+ return
150+
151+ try:
152+ git_install(config('openstack-origin-git'))
153+ config_changed()
154+ except:
155+ action_set({'traceback': traceback.format_exc()})
156+ action_fail('git-reinstall resulted in an unexpected error')
157+
158+
159+if __name__ == '__main__':
160+ git_reinstall()
161
162=== modified file 'charm-helpers-hooks.yaml'
163--- charm-helpers-hooks.yaml 2015-03-18 18:38:09 +0000
164+++ charm-helpers-hooks.yaml 2015-04-16 14:39:37 +0000
165@@ -8,6 +8,7 @@
166 - contrib.hahelpers:
167 - apache
168 - cluster
169+ - contrib.python
170 - contrib.unison
171 - payload.execd
172 - contrib.peerstorage
173
174=== modified file 'config.yaml'
175--- config.yaml 2015-04-01 06:55:04 +0000
176+++ config.yaml 2015-04-16 14:39:37 +0000
177@@ -22,6 +22,22 @@
178 Note that updating this setting to a source that is known to
179 provide a later version of OpenStack will trigger a software
180 upgrade.
181+
182+ Note that when openstack-origin-git is specified, openstack
183+ specific packages will be installed from source rather than
184+ from the openstack-origin repository.
185+ openstack-origin-git:
186+ default:
187+ type: string
188+ description: |
189+ Specifies a YAML-formatted dictionary listing the git
190+ repositories and branches from which to install OpenStack and
191+ its dependencies.
192+
193+ Note that the installed config files will be determined based on
194+ the OpenStack release of the openstack-origin option.
195+
196+ For more details see README.md.
197 config-file:
198 default: "/etc/keystone/keystone.conf"
199 type: string
200
201=== modified file 'hooks/charmhelpers/contrib/openstack/utils.py'
202--- hooks/charmhelpers/contrib/openstack/utils.py 2015-04-09 02:17:36 +0000
203+++ hooks/charmhelpers/contrib/openstack/utils.py 2015-04-16 14:39:37 +0000
204@@ -524,9 +524,10 @@
205 projects = yaml.load(projects_yaml)
206 _git_validate_projects_yaml(projects, core_project)
207
208+ old_environ = dict(os.environ)
209+
210 if 'http_proxy' in projects.keys():
211 os.environ['http_proxy'] = projects['http_proxy']
212-
213 if 'https_proxy' in projects.keys():
214 os.environ['https_proxy'] = projects['https_proxy']
215
216@@ -544,6 +545,8 @@
217 repo_dir = _git_clone_and_install_single(repo, branch, parent_dir,
218 update_requirements=True)
219
220+ os.environ = old_environ
221+
222
223 def _git_validate_projects_yaml(projects, core_project):
224 """
225
226=== added file 'hooks/charmhelpers/contrib/python/debug.py'
227--- hooks/charmhelpers/contrib/python/debug.py 1970-01-01 00:00:00 +0000
228+++ hooks/charmhelpers/contrib/python/debug.py 2015-04-16 14:39:37 +0000
229@@ -0,0 +1,56 @@
230+#!/usr/bin/env python
231+# coding: utf-8
232+
233+# Copyright 2014-2015 Canonical Limited.
234+#
235+# This file is part of charm-helpers.
236+#
237+# charm-helpers is free software: you can redistribute it and/or modify
238+# it under the terms of the GNU Lesser General Public License version 3 as
239+# published by the Free Software Foundation.
240+#
241+# charm-helpers is distributed in the hope that it will be useful,
242+# but WITHOUT ANY WARRANTY; without even the implied warranty of
243+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
244+# GNU Lesser General Public License for more details.
245+#
246+# You should have received a copy of the GNU Lesser General Public License
247+# along with charm-helpers. If not, see <http://www.gnu.org/licenses/>.
248+
249+from __future__ import print_function
250+
251+import atexit
252+import sys
253+
254+from charmhelpers.contrib.python.rpdb import Rpdb
255+from charmhelpers.core.hookenv import (
256+ open_port,
257+ close_port,
258+ ERROR,
259+ log
260+)
261+
262+__author__ = "Jorge Niedbalski <jorge.niedbalski@canonical.com>"
263+
264+DEFAULT_ADDR = "0.0.0.0"
265+DEFAULT_PORT = 4444
266+
267+
268+def _error(message):
269+ log(message, level=ERROR)
270+
271+
272+def set_trace(addr=DEFAULT_ADDR, port=DEFAULT_PORT):
273+ """
274+ Set a trace point using the remote debugger
275+ """
276+ atexit.register(close_port, port)
277+ try:
278+ log("Starting a remote python debugger session on %s:%s" % (addr,
279+ port))
280+ open_port(port)
281+ debugger = Rpdb(addr=addr, port=port)
282+ debugger.set_trace(sys._getframe().f_back)
283+ except:
284+ _error("Cannot start a remote debug session on %s:%s" % (addr,
285+ port))
286
287=== added file 'hooks/charmhelpers/contrib/python/rpdb.py'
288--- hooks/charmhelpers/contrib/python/rpdb.py 1970-01-01 00:00:00 +0000
289+++ hooks/charmhelpers/contrib/python/rpdb.py 2015-04-16 14:39:37 +0000
290@@ -0,0 +1,58 @@
291+# Copyright 2014-2015 Canonical Limited.
292+#
293+# This file is part of charm-helpers.
294+#
295+# charm-helpers is free software: you can redistribute it and/or modify
296+# it under the terms of the GNU Lesser General Public License version 3 as
297+# published by the Free Software Foundation.
298+#
299+# charm-helpers is distributed in the hope that it will be useful,
300+# but WITHOUT ANY WARRANTY; without even the implied warranty of
301+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
302+# GNU Lesser General Public License for more details.
303+#
304+# You should have received a copy of the GNU Lesser General Public License
305+# along with charm-helpers. If not, see <http://www.gnu.org/licenses/>.
306+
307+"""Remote Python Debugger (pdb wrapper)."""
308+
309+import pdb
310+import socket
311+import sys
312+
313+__author__ = "Bertrand Janin <b@janin.com>"
314+__version__ = "0.1.3"
315+
316+
317+class Rpdb(pdb.Pdb):
318+
319+ def __init__(self, addr="127.0.0.1", port=4444):
320+ """Initialize the socket and initialize pdb."""
321+
322+ # Backup stdin and stdout before replacing them by the socket handle
323+ self.old_stdout = sys.stdout
324+ self.old_stdin = sys.stdin
325+
326+ # Open a 'reusable' socket to let the webapp reload on the same port
327+ self.skt = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
328+ self.skt.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, True)
329+ self.skt.bind((addr, port))
330+ self.skt.listen(1)
331+ (clientsocket, address) = self.skt.accept()
332+ handle = clientsocket.makefile('rw')
333+ pdb.Pdb.__init__(self, completekey='tab', stdin=handle, stdout=handle)
334+ sys.stdout = sys.stdin = handle
335+
336+ def shutdown(self):
337+ """Revert stdin and stdout, close the socket."""
338+ sys.stdout = self.old_stdout
339+ sys.stdin = self.old_stdin
340+ self.skt.close()
341+ self.set_continue()
342+
343+ def do_continue(self, arg):
344+ """Stop all operation on ``continue``."""
345+ self.shutdown()
346+ return 1
347+
348+ do_EOF = do_quit = do_exit = do_c = do_cont = do_continue
349
350=== added file 'hooks/charmhelpers/contrib/python/version.py'
351--- hooks/charmhelpers/contrib/python/version.py 1970-01-01 00:00:00 +0000
352+++ hooks/charmhelpers/contrib/python/version.py 2015-04-16 14:39:37 +0000
353@@ -0,0 +1,34 @@
354+#!/usr/bin/env python
355+# coding: utf-8
356+
357+# Copyright 2014-2015 Canonical Limited.
358+#
359+# This file is part of charm-helpers.
360+#
361+# charm-helpers is free software: you can redistribute it and/or modify
362+# it under the terms of the GNU Lesser General Public License version 3 as
363+# published by the Free Software Foundation.
364+#
365+# charm-helpers is distributed in the hope that it will be useful,
366+# but WITHOUT ANY WARRANTY; without even the implied warranty of
367+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
368+# GNU Lesser General Public License for more details.
369+#
370+# You should have received a copy of the GNU Lesser General Public License
371+# along with charm-helpers. If not, see <http://www.gnu.org/licenses/>.
372+
373+import sys
374+
375+__author__ = "Jorge Niedbalski <jorge.niedbalski@canonical.com>"
376+
377+
378+def current_version():
379+ """Current system python version"""
380+ return sys.version_info
381+
382+
383+def current_version_string():
384+ """Current system python version as string major.minor.micro"""
385+ return "{0}.{1}.{2}".format(sys.version_info.major,
386+ sys.version_info.minor,
387+ sys.version_info.micro)
388
389=== modified file 'hooks/keystone_hooks.py'
390--- hooks/keystone_hooks.py 2015-03-11 14:46:42 +0000
391+++ hooks/keystone_hooks.py 2015-04-16 14:39:37 +0000
392@@ -42,7 +42,9 @@
393 )
394
395 from charmhelpers.contrib.openstack.utils import (
396+ config_value_changed,
397 configure_installation_source,
398+ git_install_requested,
399 openstack_upgrade_available,
400 sync_db_with_multi_ipv6_addresses
401 )
402@@ -53,6 +55,7 @@
403 do_openstack_upgrade,
404 ensure_initial_admin,
405 get_admin_passwd,
406+ git_install,
407 migrate_database,
408 save_script_rc,
409 synchronize_ca_if_changed,
410@@ -116,6 +119,8 @@
411 apt_update()
412 apt_install(determine_packages(), fatal=True)
413
414+ git_install(config('openstack-origin-git'))
415+
416
417 @hooks.hook('config-changed')
418 @restart_on_change(restart_map())
419@@ -132,8 +137,12 @@
420 if not os.path.isdir(homedir):
421 mkdir(homedir, SSH_USER, 'juju_keystone', 0o775)
422
423- if openstack_upgrade_available('keystone'):
424- do_openstack_upgrade(configs=CONFIGS)
425+ if git_install_requested():
426+ if config_value_changed('openstack-origin-git'):
427+ git_install(config('openstack-origin-git'))
428+ else:
429+ if openstack_upgrade_available('keystone'):
430+ do_openstack_upgrade(configs=CONFIGS)
431
432 # Ensure ssl dir exists and is unison-accessible
433 ensure_ssl_dir()
434
435=== modified file 'hooks/keystone_utils.py'
436--- hooks/keystone_utils.py 2015-04-09 10:30:15 +0000
437+++ hooks/keystone_utils.py 2015-04-16 14:39:37 +0000
438@@ -6,6 +6,7 @@
439 import os
440 import pwd
441 import re
442+import shutil
443 import subprocess
444 import threading
445 import time
446@@ -40,14 +41,12 @@
447 configure_installation_source,
448 error_out,
449 get_os_codename_install_source,
450+ git_install_requested,
451+ git_clone_and_install,
452+ git_src_dir,
453 os_release,
454 save_script_rc as _save_script_rc)
455
456-from charmhelpers.core.host import (
457- mkdir,
458- write_file,
459-)
460-
461 from charmhelpers.core.strutils import (
462 bool_from_string,
463 )
464@@ -59,6 +58,7 @@
465 )
466
467 from charmhelpers.core.hookenv import (
468+ charm_dir,
469 config,
470 is_relation_made,
471 log,
472@@ -78,15 +78,20 @@
473 apt_install,
474 apt_update,
475 apt_upgrade,
476- add_source
477+ add_source,
478 )
479
480 from charmhelpers.core.host import (
481+ adduser,
482+ add_group,
483+ add_user_to_group,
484+ mkdir,
485 service_stop,
486 service_start,
487 service_restart,
488 pwgen,
489- lsb_release
490+ lsb_release,
491+ write_file,
492 )
493
494 from charmhelpers.contrib.peerstorage import (
495@@ -95,6 +100,8 @@
496 peer_retrieve,
497 )
498
499+from charmhelpers.core.templating import render
500+
501 import keystone_context
502 import keystone_ssl as ssl
503
504@@ -114,10 +121,25 @@
505 'uuid',
506 ]
507
508+BASE_GIT_PACKAGES = [
509+ 'libxml2-dev',
510+ 'libxslt1-dev',
511+ 'python-dev',
512+ 'python-pip',
513+ 'python-setuptools',
514+ 'zlib1g-dev',
515+]
516+
517 BASE_SERVICES = [
518 'keystone',
519 ]
520
521+# ubuntu packages that should not be installed when deploying from git
522+GIT_PACKAGE_BLACKLIST = [
523+ 'keystone',
524+ 'python-keystoneclient',
525+]
526+
527 API_PORTS = {
528 'keystone-admin': config('admin-port'),
529 'keystone-public': config('service-port')
530@@ -305,6 +327,14 @@
531 packages = [] + BASE_PACKAGES
532 for k, v in resource_map().iteritems():
533 packages.extend(v['services'])
534+
535+ if git_install_requested():
536+ packages.extend(BASE_GIT_PACKAGES)
537+ # don't include packages that will be installed from git
538+ packages = list(set(packages))
539+ for p in GIT_PACKAGE_BLACKLIST:
540+ packages.remove(p)
541+
542 return list(set(packages))
543
544
545@@ -1629,3 +1659,68 @@
546 # If neither relation has units then we are probably in sqlite mode so
547 # return True.
548 return not rel_has_units
549+
550+
551+def git_install(projects_yaml):
552+ """Perform setup, and install git repos specified in yaml parameter."""
553+ if git_install_requested():
554+ git_pre_install()
555+ git_clone_and_install(projects_yaml, core_project='keystone')
556+ git_post_install(projects_yaml)
557+
558+
559+def git_pre_install():
560+ """Perform keystone pre-install setup."""
561+ dirs = [
562+ '/var/lib/keystone',
563+ '/var/lib/keystone/cache',
564+ '/var/log/keystone',
565+ ]
566+
567+ logs = [
568+ '/var/log/keystone/keystone.log',
569+ ]
570+
571+ adduser('keystone', shell='/bin/bash', system_user=True)
572+ add_group('keystone', system_group=True)
573+ add_user_to_group('keystone', 'keystone')
574+
575+ for d in dirs:
576+ mkdir(d, owner='keystone', group='keystone', perms=0700, force=False)
577+
578+ for l in logs:
579+ write_file(l, '', owner='keystone', group='keystone', perms=0600)
580+
581+
582+def git_post_install(projects_yaml):
583+ """Perform keystone post-install setup."""
584+ src_etc = os.path.join(git_src_dir(projects_yaml, 'keystone'), 'etc')
585+ configs = {
586+ 'src': src_etc,
587+ 'dest': '/etc/keystone',
588+ }
589+
590+ if os.path.exists(configs['dest']):
591+ shutil.rmtree(configs['dest'])
592+ shutil.copytree(configs['src'], configs['dest'])
593+
594+ render('git/logging.conf', '/etc/keystone/logging.conf', {}, perms=0o644)
595+
596+ keystone_context = {
597+ 'service_description': 'Keystone API server',
598+ 'service_name': 'Keystone',
599+ 'user_name': 'keystone',
600+ 'start_dir': '/var/lib/keystone',
601+ 'process_name': 'keystone',
602+ 'executable_name': '/usr/local/bin/keystone-all',
603+ 'config_files': ['/etc/keystone/keystone.conf'],
604+ 'log_file': '/var/log/keystone/keystone.log',
605+ }
606+
607+ # NOTE(coreycb): Needs systemd support
608+ templates_dir = 'hooks/charmhelpers/contrib/openstack/templates'
609+ templates_dir = os.path.join(charm_dir(), templates_dir)
610+ render('git.upstart', '/etc/init/keystone.conf', keystone_context,
611+ perms=0o644, templates_dir=templates_dir)
612+
613+ service_restart('keystone')
614
615=== added directory 'templates/git'
616=== added file 'templates/git/logging.conf'
617--- templates/git/logging.conf 1970-01-01 00:00:00 +0000
618+++ templates/git/logging.conf 2015-04-16 14:39:37 +0000
619@@ -0,0 +1,39 @@
620+[loggers]
621+keys=root
622+
623+[formatters]
624+keys=normal,normal_with_name,debug
625+
626+[handlers]
627+keys=production,file,devel
628+
629+[logger_root]
630+level=WARNING
631+handlers=file
632+
633+[handler_production]
634+class=handlers.SysLogHandler
635+level=ERROR
636+formatter=normal_with_name
637+args=(('localhost', handlers.SYSLOG_UDP_PORT), handlers.SysLogHandler.LOG_USER)
638+
639+[handler_file]
640+class=FileHandler
641+level=DEBUG
642+formatter=normal_with_name
643+args=('/var/log/keystone/keystone.log', 'a')
644+
645+[handler_devel]
646+class=StreamHandler
647+level=NOTSET
648+formatter=debug
649+args=(sys.stdout,)
650+
651+[formatter_normal]
652+format=%(asctime)s %(levelname)s %(message)s
653+
654+[formatter_normal_with_name]
655+format=(%(name)s): %(asctime)s %(levelname)s %(message)s
656+
657+[formatter_debug]
658+format=(%(name)s): %(asctime)s %(levelname)s %(module)s %(funcName)s %(message)s
659
660=== removed file 'tests/10-basic-precise-essex'
661--- tests/10-basic-precise-essex 2014-06-24 17:11:36 +0000
662+++ tests/10-basic-precise-essex 1970-01-01 00:00:00 +0000
663@@ -1,9 +0,0 @@
664-#!/usr/bin/python
665-
666-"""Amulet tests on a basic keystone deployment on precise-essex."""
667-
668-from basic_deployment import KeystoneBasicDeployment
669-
670-if __name__ == '__main__':
671- deployment = KeystoneBasicDeployment(series='precise')
672- deployment.run_tests()
673
674=== removed file 'tests/11-basic-precise-folsom'
675--- tests/11-basic-precise-folsom 2014-07-01 14:06:01 +0000
676+++ tests/11-basic-precise-folsom 1970-01-01 00:00:00 +0000
677@@ -1,11 +0,0 @@
678-#!/usr/bin/python
679-
680-"""Amulet tests on a basic keystone deployment on precise-folsom."""
681-
682-from basic_deployment import KeystoneBasicDeployment
683-
684-if __name__ == '__main__':
685- deployment = KeystoneBasicDeployment(series='precise',
686- openstack='cloud:precise-folsom',
687- source='cloud:precise-updates/folsom')
688- deployment.run_tests()
689
690=== removed file 'tests/12-basic-precise-grizzly'
691--- tests/12-basic-precise-grizzly 2014-07-01 14:06:01 +0000
692+++ tests/12-basic-precise-grizzly 1970-01-01 00:00:00 +0000
693@@ -1,11 +0,0 @@
694-#!/usr/bin/python
695-
696-"""Amulet tests on a basic keystone deployment on precise-grizzly."""
697-
698-from basic_deployment import KeystoneBasicDeployment
699-
700-if __name__ == '__main__':
701- deployment = KeystoneBasicDeployment(series='precise',
702- openstack='cloud:precise-grizzly',
703- source='cloud:precise-updates/grizzly')
704- deployment.run_tests()
705
706=== removed file 'tests/13-basic-precise-havana'
707--- tests/13-basic-precise-havana 2014-07-01 14:06:01 +0000
708+++ tests/13-basic-precise-havana 1970-01-01 00:00:00 +0000
709@@ -1,11 +0,0 @@
710-#!/usr/bin/python
711-
712-"""Amulet tests on a basic keystone deployment on precise-havana."""
713-
714-from basic_deployment import KeystoneBasicDeployment
715-
716-if __name__ == '__main__':
717- deployment = KeystoneBasicDeployment(series='precise',
718- openstack='cloud:precise-havana',
719- source='cloud:precise-updates/havana')
720- deployment.run_tests()
721
722=== added file 'tests/16-basic-trusty-icehouse-git'
723--- tests/16-basic-trusty-icehouse-git 1970-01-01 00:00:00 +0000
724+++ tests/16-basic-trusty-icehouse-git 2015-04-16 14:39:37 +0000
725@@ -0,0 +1,9 @@
726+#!/usr/bin/python
727+
728+"""Amulet tests on a basic keystone git deployment on trusty-icehouse."""
729+
730+from basic_deployment import KeystoneBasicDeployment
731+
732+if __name__ == '__main__':
733+ deployment = KeystoneBasicDeployment(series='trusty', git=True)
734+ deployment.run_tests()
735
736=== added file 'tests/17-basic-trusty-juno'
737--- tests/17-basic-trusty-juno 1970-01-01 00:00:00 +0000
738+++ tests/17-basic-trusty-juno 2015-04-16 14:39:37 +0000
739@@ -0,0 +1,11 @@
740+#!/usr/bin/python
741+
742+"""Amulet tests on a basic keystone deployment on trusty-juno."""
743+
744+from basic_deployment import KeystoneBasicDeployment
745+
746+if __name__ == '__main__':
747+ deployment = KeystoneBasicDeployment(series='trusty',
748+ openstack='cloud:trusty-juno',
749+ source='cloud:trusty-updates/juno')
750+ deployment.run_tests()
751
752=== added file 'tests/18-basic-trusty-juno-git'
753--- tests/18-basic-trusty-juno-git 1970-01-01 00:00:00 +0000
754+++ tests/18-basic-trusty-juno-git 2015-04-16 14:39:37 +0000
755@@ -0,0 +1,12 @@
756+#!/usr/bin/python
757+
758+"""Amulet tests on a basic keystone git deployment on trusty-juno."""
759+
760+from basic_deployment import KeystoneBasicDeployment
761+
762+if __name__ == '__main__':
763+ deployment = KeystoneBasicDeployment(series='trusty',
764+ openstack='cloud:trusty-juno',
765+ source='cloud:trusty-updates/juno',
766+ git=True)
767+ deployment.run_tests()
768
769=== modified file 'tests/basic_deployment.py'
770--- tests/basic_deployment.py 2015-04-09 02:11:06 +0000
771+++ tests/basic_deployment.py 2015-04-16 14:39:37 +0000
772@@ -1,6 +1,8 @@
773 #!/usr/bin/python
774
775 import amulet
776+import os
777+import yaml
778
779 from charmhelpers.contrib.openstack.amulet.deployment import (
780 OpenStackAmuletDeployment
781@@ -13,15 +15,16 @@
782 )
783
784 # Use DEBUG to turn on debug logging
785-u = OpenStackAmuletUtils(ERROR)
786+u = OpenStackAmuletUtils(DEBUG)
787
788
789 class KeystoneBasicDeployment(OpenStackAmuletDeployment):
790 """Amulet tests on a basic keystone deployment."""
791
792- def __init__(self, series=None, openstack=None, source=None, stable=False):
793+ def __init__(self, series=None, openstack=None, source=None, git=False, stable=False):
794 """Deploy the entire test environment."""
795 super(KeystoneBasicDeployment, self).__init__(series, openstack, source, stable)
796+ self.git = git
797 self._add_services()
798 self._add_relations()
799 self._configure_services()
800@@ -50,6 +53,24 @@
801 """Configure all of the services."""
802 keystone_config = {'admin-password': 'openstack',
803 'admin-token': 'ubuntutesting'}
804+ if self.git:
805+ branch = 'stable/' + self._get_openstack_release_string()
806+ amulet_http_proxy = os.environ.get('AMULET_HTTP_PROXY')
807+ openstack_origin_git = {
808+ 'repositories': [
809+ {'name': 'requirements',
810+ 'repository': 'git://git.openstack.org/openstack/requirements',
811+ 'branch': branch},
812+ {'name': 'keystone',
813+ 'repository': 'git://git.openstack.org/openstack/keystone',
814+ 'branch': branch},
815+ ],
816+ 'directory': '/mnt/openstack-git',
817+ 'http_proxy': amulet_http_proxy,
818+ 'https_proxy': amulet_http_proxy,
819+ }
820+ keystone_config['openstack-origin-git'] = yaml.dump(openstack_origin_git)
821+
822 mysql_config = {'dataset-size': '50%'}
823 cinder_config = {'block-device': 'None'}
824 configs = {'keystone': keystone_config,
825
826=== modified file 'unit_tests/__init__.py'
827--- unit_tests/__init__.py 2014-03-31 10:17:39 +0000
828+++ unit_tests/__init__.py 2015-04-16 14:39:37 +0000
829@@ -1,3 +1,4 @@
830 import sys
831
832+sys.path.append('actions/')
833 sys.path.append('hooks/')
834
835=== added file 'unit_tests/test_actions_git_reinstall.py'
836--- unit_tests/test_actions_git_reinstall.py 1970-01-01 00:00:00 +0000
837+++ unit_tests/test_actions_git_reinstall.py 2015-04-16 14:39:37 +0000
838@@ -0,0 +1,95 @@
839+from mock import patch
840+
841+with patch('charmhelpers.core.hookenv.config') as config:
842+ config.return_value = 'keystone'
843+ import keystone_utils as utils # noqa
844+
845+with patch('keystone_utils.register_configs') as register_configs:
846+ import git_reinstall
847+
848+from test_utils import (
849+ CharmTestCase
850+)
851+
852+TO_PATCH = [
853+ 'config',
854+]
855+
856+
857+openstack_origin_git = \
858+ """repositories:
859+ - {name: requirements,
860+ repository: 'git://git.openstack.org/openstack/requirements',
861+ branch: stable/juno}
862+ - {name: keystone,
863+ repository: 'git://git.openstack.org/openstack/keystone',
864+ branch: stable/juno}"""
865+
866+
867+class TestKeystoneActions(CharmTestCase):
868+
869+ def setUp(self):
870+ super(TestKeystoneActions, self).setUp(git_reinstall, TO_PATCH)
871+ self.config.side_effect = self.test_config.get
872+
873+ @patch.object(git_reinstall, 'action_set')
874+ @patch.object(git_reinstall, 'action_fail')
875+ @patch.object(git_reinstall, 'git_install')
876+ @patch.object(git_reinstall, 'config_changed')
877+ def test_git_reinstall(self, config_changed, git_install, action_fail,
878+ action_set):
879+ self.test_config.set('openstack-origin-git', openstack_origin_git)
880+
881+ git_reinstall.git_reinstall()
882+
883+ git_install.assert_called_with(openstack_origin_git)
884+ self.assertTrue(git_install.called)
885+ self.assertTrue(config_changed.called)
886+ self.assertFalse(action_set.called)
887+ self.assertFalse(action_fail.called)
888+
889+ @patch.object(git_reinstall, 'action_set')
890+ @patch.object(git_reinstall, 'action_fail')
891+ @patch.object(git_reinstall, 'git_install')
892+ @patch.object(git_reinstall, 'config_changed')
893+ @patch('charmhelpers.contrib.openstack.utils.config')
894+ def test_git_reinstall_not_configured(self, _config, config_changed,
895+ git_install, action_fail,
896+ action_set):
897+ _config.return_value = None
898+
899+ git_reinstall.git_reinstall()
900+
901+ msg = 'openstack-origin-git is not configured'
902+ action_fail.assert_called_with(msg)
903+ self.assertFalse(git_install.called)
904+ self.assertFalse(action_set.called)
905+
906+ @patch.object(git_reinstall, 'action_set')
907+ @patch.object(git_reinstall, 'action_fail')
908+ @patch.object(git_reinstall, 'git_install')
909+ @patch.object(git_reinstall, 'config_changed')
910+ @patch('traceback.format_exc')
911+ @patch('charmhelpers.contrib.openstack.utils.config')
912+ def test_git_reinstall_exception(self, _config, format_exc,
913+ config_changed, git_install, action_fail,
914+ action_set):
915+ _config.return_value = openstack_origin_git
916+ e = OSError('something bad happened')
917+ git_install.side_effect = e
918+ traceback = (
919+ "Traceback (most recent call last):\n"
920+ " File \"actions/git_reinstall.py\", line 37, in git_reinstall\n"
921+ " git_install(config(\'openstack-origin-git\'))\n"
922+ " File \"/usr/lib/python2.7/dist-packages/mock.py\", line 964, in __call__\n" # noqa
923+ " return _mock_self._mock_call(*args, **kwargs)\n"
924+ " File \"/usr/lib/python2.7/dist-packages/mock.py\", line 1019, in _mock_call\n" # noqa
925+ " raise effect\n"
926+ "OSError: something bad happened\n")
927+ format_exc.return_value = traceback
928+
929+ git_reinstall.git_reinstall()
930+
931+ msg = 'git-reinstall resulted in an unexpected error'
932+ action_fail.assert_called_with(msg)
933+ action_set.assert_called_with({'traceback': traceback})
934
935=== modified file 'unit_tests/test_keystone_hooks.py'
936--- unit_tests/test_keystone_hooks.py 2015-03-10 16:17:27 +0000
937+++ unit_tests/test_keystone_hooks.py 2015-04-16 14:39:37 +0000
938@@ -2,6 +2,7 @@
939 import os
940 import json
941 import uuid
942+import yaml
943
944 from test_utils import CharmTestCase
945
946@@ -67,6 +68,7 @@
947 'get_iface_for_address',
948 'get_netmask_for_address',
949 'get_address_in_network',
950+ 'git_install',
951 ]
952
953
954@@ -77,17 +79,49 @@
955 self.config.side_effect = self.test_config.get
956 self.ssh_user = 'juju_keystone'
957
958- def test_install_hook(self):
959+ @patch.object(utils, 'git_install_requested')
960+ def test_install_hook(self, git_requested):
961+ git_requested.return_value = False
962 repo = 'cloud:precise-grizzly'
963 self.test_config.set('openstack-origin', repo)
964 hooks.install()
965+ self.assertTrue(self.execd_preinstall.called)
966 self.configure_installation_source.assert_called_with(repo)
967 self.assertTrue(self.apt_update.called)
968 self.apt_install.assert_called_with(
969 ['haproxy', 'unison', 'python-keystoneclient',
970 'uuid', 'python-mysqldb', 'openssl', 'apache2',
971 'pwgen', 'python-six', 'keystone', 'python-psycopg2'], fatal=True)
972+ self.git_install.assert_called_with(None)
973+
974+ @patch.object(utils, 'git_install_requested')
975+ def test_install_hook_git(self, git_requested):
976+ git_requested.return_value = True
977+ repo = 'cloud:trusty-juno'
978+ openstack_origin_git = {
979+ 'repositories': [
980+ {'name': 'requirements',
981+ 'repository': 'git://git.openstack.org/openstack/requirements', # noqa
982+ 'branch': 'stable/juno'},
983+ {'name': 'keystone',
984+ 'repository': 'git://git.openstack.org/openstack/keystone',
985+ 'branch': 'stable/juno'}
986+ ],
987+ 'directory': '/mnt/openstack-git',
988+ }
989+ projects_yaml = yaml.dump(openstack_origin_git)
990+ self.test_config.set('openstack-origin', repo)
991+ self.test_config.set('openstack-origin-git', projects_yaml)
992+ hooks.install()
993 self.assertTrue(self.execd_preinstall.called)
994+ self.configure_installation_source.assert_called_with(repo)
995+ self.assertTrue(self.apt_update.called)
996+ self.apt_install.assert_called_with(
997+ ['haproxy', 'unison', 'python-setuptools', 'python-six', 'uuid',
998+ 'python-mysqldb', 'python-pip', 'openssl', 'apache2', 'pwgen',
999+ 'libxslt1-dev', 'python-psycopg2', 'zlib1g-dev', 'python-dev',
1000+ 'libxml2-dev'], fatal=True)
1001+ self.git_install.assert_called_with(projects_yaml)
1002
1003 mod_ch_openstack_utils = 'charmhelpers.contrib.openstack.utils'
1004
1005@@ -271,6 +305,7 @@
1006 relation_id='identity-service:0',
1007 remote_unit='unit/0')
1008
1009+ @patch.object(hooks, 'git_install_requested')
1010 @patch('keystone_utils.log')
1011 @patch('keystone_utils.ensure_ssl_cert_master')
1012 @patch.object(hooks, 'ensure_pki_dir_permissions')
1013@@ -305,7 +340,8 @@
1014 mock_ensure_ssl_dir,
1015 mock_ensure_pki_dir_permissions,
1016 mock_ensure_ssl_cert_master,
1017- mock_log):
1018+ mock_log, git_requested):
1019+ git_requested.return_value = False
1020 mock_is_pki_enabled.return_value = True
1021 mock_is_ssl_cert_master.return_value = True
1022 mock_is_db_initialised.return_value = True
1023@@ -334,6 +370,7 @@
1024 remote_unit='unit/0')
1025 admin_relation_changed.assert_called_with('identity-service:0')
1026
1027+ @patch.object(hooks, 'git_install_requested')
1028 @patch('keystone_utils.log')
1029 @patch('keystone_utils.ensure_ssl_cert_master')
1030 @patch.object(hooks, 'update_all_identity_relation_units')
1031@@ -361,7 +398,8 @@
1032 mock_ensure_pki_permissions,
1033 mock_update_all_id_rel_units,
1034 mock_ensure_ssl_cert_master,
1035- mock_log):
1036+ mock_log, git_requested):
1037+ git_requested.return_value = False
1038 mock_is_pki_enabled.return_value = True
1039 mock_is_ssl_cert_master.return_value = True
1040 mock_peer_units.return_value = []
1041@@ -381,6 +419,7 @@
1042 self.assertFalse(self.ensure_initial_admin.called)
1043 self.assertFalse(identity_changed.called)
1044
1045+ @patch.object(hooks, 'git_install_requested')
1046 @patch('keystone_utils.log')
1047 @patch('keystone_utils.ensure_ssl_cert_master')
1048 @patch.object(hooks, 'ensure_pki_dir_permissions')
1049@@ -414,7 +453,8 @@
1050 mock_ensure_ssl_dir,
1051 mock_ensure_pki_permissions,
1052 mock_ensure_ssl_cert_master,
1053- mock_log):
1054+ mock_log, git_requested):
1055+ git_requested.return_value = False
1056 mock_is_pki_enabled.return_value = True
1057 mock_is_ssl_cert_master.return_value = True
1058 mock_is_db_ready.return_value = True
1059@@ -445,6 +485,66 @@
1060 remote_unit='unit/0')
1061 admin_relation_changed.assert_called_with('identity-service:0')
1062
1063+ @patch.object(hooks, 'git_install_requested')
1064+ @patch.object(hooks, 'config_value_changed')
1065+ @patch('keystone_utils.log')
1066+ @patch('keystone_utils.ensure_ssl_cert_master')
1067+ @patch.object(hooks, 'ensure_ssl_dir')
1068+ @patch.object(hooks, 'is_pki_enabled')
1069+ @patch.object(hooks, 'send_ssl_sync_request')
1070+ @patch.object(hooks, 'is_db_initialised')
1071+ @patch.object(hooks, 'is_db_ready')
1072+ @patch.object(hooks, 'peer_units')
1073+ @patch.object(hooks, 'ensure_permissions')
1074+ @patch.object(hooks, 'admin_relation_changed')
1075+ @patch.object(hooks, 'cluster_joined')
1076+ @patch.object(unison, 'ensure_user')
1077+ @patch.object(unison, 'get_homedir')
1078+ @patch.object(hooks, 'CONFIGS')
1079+ @patch.object(hooks, 'identity_changed')
1080+ @patch.object(hooks, 'configure_https')
1081+ def test_config_changed_git_updated(self, configure_https,
1082+ identity_changed,
1083+ configs, get_homedir, ensure_user,
1084+ cluster_joined, admin_relation_changed,
1085+ ensure_permissions, mock_peer_units,
1086+ mock_is_db_ready,
1087+ mock_is_db_initialised,
1088+ mock_send_ssl_sync_request,
1089+ mock_is_pki_enabled,
1090+ mock_ensure_ssl_dir,
1091+ mock_ensure_ssl_cert_master,
1092+ mock_log, config_val_changed,
1093+ git_requested):
1094+ git_requested.return_value = True
1095+ mock_ensure_ssl_cert_master.return_value = False
1096+ mock_is_pki_enabled.return_value = False
1097+ self.openstack_upgrade_available.return_value = False
1098+ self.is_elected_leader.return_value = True
1099+ mock_peer_units.return_value = []
1100+ self.relation_ids.return_value = ['identity-service:0']
1101+ self.related_units.return_value = ['unit/0']
1102+
1103+ repo = 'cloud:trusty-juno'
1104+ openstack_origin_git = {
1105+ 'repositories': [
1106+ {'name': 'requirements',
1107+ 'repository': 'git://git.openstack.org/openstack/requirements', # noqa
1108+ 'branch': 'stable/juno'},
1109+ {'name': 'keystone',
1110+ 'repository': 'git://git.openstack.org/openstack/keystone',
1111+ 'branch': 'stable/juno'}
1112+ ],
1113+ 'directory': '/mnt/openstack-git',
1114+ }
1115+ projects_yaml = yaml.dump(openstack_origin_git)
1116+ self.test_config.set('openstack-origin', repo)
1117+ self.test_config.set('openstack-origin-git', projects_yaml)
1118+ hooks.config_changed()
1119+ self.git_install.assert_called_with(projects_yaml)
1120+ self.assertFalse(self.openstack_upgrade_available.called)
1121+ self.assertFalse(self.do_openstack_upgrade.called)
1122+
1123 @patch.object(hooks, 'is_db_initialised')
1124 @patch.object(hooks, 'is_db_ready')
1125 @patch('keystone_utils.log')
1126@@ -689,6 +789,7 @@
1127 cmd = ['a2dissite', 'openstack_https_frontend']
1128 self.check_call.assert_called_with(cmd)
1129
1130+ @patch.object(utils, 'git_install_requested')
1131 @patch.object(hooks, 'is_db_ready')
1132 @patch.object(hooks, 'is_db_initialised')
1133 @patch('keystone_utils.log')
1134@@ -706,7 +807,8 @@
1135 mock_relation_ids,
1136 mock_log,
1137 mock_is_db_ready,
1138- mock_is_db_initialised):
1139+ mock_is_db_initialised,
1140+ git_requested):
1141 mock_is_db_initialised.return_value = True
1142 mock_is_db_ready.return_value = True
1143 mock_is_elected_leader.return_value = False
1144@@ -718,6 +820,7 @@
1145
1146 self.is_elected_leader.return_value = True
1147 self.filter_installed_packages.return_value = []
1148+ git_requested.return_value = False
1149 hooks.upgrade_charm()
1150 self.assertTrue(self.apt_install.called)
1151 ssh_authorized_peers.assert_called_with(
1152@@ -728,6 +831,7 @@
1153 'Firing identity_changed hook for all related services.')
1154 self.assertTrue(self.ensure_initial_admin.called)
1155
1156+ @patch.object(utils, 'git_install_requested')
1157 @patch('keystone_utils.log')
1158 @patch('keystone_utils.relation_ids')
1159 @patch('keystone_utils.ensure_ssl_cert_master')
1160@@ -737,7 +841,7 @@
1161 mock_update_hash_from_path,
1162 mock_ensure_ssl_cert_master,
1163 mock_relation_ids,
1164- mock_log):
1165+ mock_log, git_requested):
1166 mock_relation_ids.return_value = []
1167 mock_ensure_ssl_cert_master.return_value = False
1168 # Ensure always returns diff
1169@@ -746,6 +850,7 @@
1170
1171 self.is_elected_leader.return_value = False
1172 self.filter_installed_packages.return_value = []
1173+ git_requested.return_value = False
1174 hooks.upgrade_charm()
1175 self.assertTrue(self.apt_install.called)
1176 ssh_authorized_peers.assert_called_with(
1177
1178=== modified file 'unit_tests/test_keystone_utils.py'
1179--- unit_tests/test_keystone_utils.py 2015-04-09 10:30:15 +0000
1180+++ unit_tests/test_keystone_utils.py 2015-04-16 14:39:37 +0000
1181@@ -53,6 +53,15 @@
1182 'resolve_address',
1183 ]
1184
1185+openstack_origin_git = \
1186+ """repositories:
1187+ - {name: requirements,
1188+ repository: 'git://git.openstack.org/openstack/requirements',
1189+ branch: stable/juno}
1190+ - {name: keystone,
1191+ repository: 'git://git.openstack.org/openstack/keystone',
1192+ branch: stable/juno}"""
1193+
1194
1195 class TestKeystoneUtils(CharmTestCase):
1196
1197@@ -108,9 +117,20 @@
1198 result = utils.determine_ports()
1199 self.assertEquals(result, ['80', '81'])
1200
1201- def test_determine_packages(self):
1202- result = utils.determine_packages()
1203- ex = utils.BASE_PACKAGES + ['keystone', 'haproxy', 'apache2']
1204+ @patch('charmhelpers.contrib.openstack.utils.config')
1205+ def test_determine_packages(self, _config):
1206+ _config.return_value = None
1207+ result = utils.determine_packages()
1208+ ex = utils.BASE_PACKAGES + ['keystone', 'python-keystoneclient']
1209+ self.assertEquals(set(ex), set(result))
1210+
1211+ @patch('charmhelpers.contrib.openstack.utils.config')
1212+ def test_determine_packages_git(self, _config):
1213+ _config.return_value = openstack_origin_git
1214+ result = utils.determine_packages()
1215+ ex = utils.BASE_PACKAGES + ['keystone'] + utils.BASE_GIT_PACKAGES
1216+ for p in utils.GIT_PACKAGE_BLACKLIST:
1217+ ex.remove(p)
1218 self.assertEquals(set(ex), set(result))
1219
1220 @patch.object(hooks, 'CONFIGS')
1221@@ -593,3 +613,77 @@
1222 self.is_elected_leader.return_value = True
1223 self.assertFalse(utils.ensure_ssl_cert_master())
1224 self.assertFalse(self.relation_set.called)
1225+
1226+ @patch.object(utils, 'git_install_requested')
1227+ @patch.object(utils, 'git_clone_and_install')
1228+ @patch.object(utils, 'git_post_install')
1229+ @patch.object(utils, 'git_pre_install')
1230+ def test_git_install(self, git_pre, git_post, git_clone_and_install,
1231+ git_requested):
1232+ projects_yaml = openstack_origin_git
1233+ git_requested.return_value = True
1234+ utils.git_install(projects_yaml)
1235+ self.assertTrue(git_pre.called)
1236+ git_clone_and_install.assert_called_with(openstack_origin_git,
1237+ core_project='keystone')
1238+ self.assertTrue(git_post.called)
1239+
1240+ @patch.object(utils, 'mkdir')
1241+ @patch.object(utils, 'write_file')
1242+ @patch.object(utils, 'add_user_to_group')
1243+ @patch.object(utils, 'add_group')
1244+ @patch.object(utils, 'adduser')
1245+ def test_git_pre_install(self, adduser, add_group, add_user_to_group,
1246+ write_file, mkdir):
1247+ utils.git_pre_install()
1248+ adduser.assert_called_with('keystone', shell='/bin/bash',
1249+ system_user=True)
1250+ add_group.assert_called_with('keystone', system_group=True)
1251+ add_user_to_group.assert_called_with('keystone', 'keystone')
1252+ expected = [
1253+ call('/var/lib/keystone', owner='keystone',
1254+ group='keystone', perms=0700, force=False),
1255+ call('/var/lib/keystone/cache', owner='keystone',
1256+ group='keystone', perms=0700, force=False),
1257+ call('/var/log/keystone', owner='keystone',
1258+ group='keystone', perms=0700, force=False),
1259+ ]
1260+ self.assertEquals(mkdir.call_args_list, expected)
1261+ write_file.assert_called_with('/var/log/keystone/keystone.log',
1262+ '', owner='keystone', group='keystone',
1263+ perms=0600)
1264+
1265+ @patch.object(utils, 'git_src_dir')
1266+ @patch.object(utils, 'service_restart')
1267+ @patch.object(utils, 'render')
1268+ @patch('os.path.join')
1269+ @patch('os.path.exists')
1270+ @patch('shutil.copytree')
1271+ @patch('shutil.rmtree')
1272+ def test_git_post_install(self, rmtree, copytree, exists, join, render,
1273+ service_restart, git_src_dir):
1274+ projects_yaml = openstack_origin_git
1275+ join.return_value = 'joined-string'
1276+ utils.git_post_install(projects_yaml)
1277+ expected = [
1278+ call('joined-string', '/etc/keystone'),
1279+ ]
1280+ copytree.assert_has_calls(expected)
1281+ keystone_context = {
1282+ 'service_description': 'Keystone API server',
1283+ 'service_name': 'Keystone',
1284+ 'user_name': 'keystone',
1285+ 'start_dir': '/var/lib/keystone',
1286+ 'process_name': 'keystone',
1287+ 'executable_name': '/usr/local/bin/keystone-all',
1288+ 'config_files': ['/etc/keystone/keystone.conf'],
1289+ 'log_file': '/var/log/keystone/keystone.log',
1290+ }
1291+ expected = [
1292+ call('git/logging.conf', '/etc/keystone/logging.conf', {},
1293+ perms=0o644),
1294+ call('git.upstart', '/etc/init/keystone.conf',
1295+ keystone_context, perms=0o644, templates_dir='joined-string'),
1296+ ]
1297+ self.assertEquals(render.call_args_list, expected)
1298+ service_restart.assert_called_with('keystone')

Subscribers

People subscribed via source and target branches