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
=== modified file '.bzrignore'
--- .bzrignore 2014-07-25 08:13:49 +0000
+++ .bzrignore 2015-04-16 14:39:37 +0000
@@ -1,3 +1,4 @@
1revision1revision
2bin2bin
3.coverage3.coverage
4tags
45
=== modified file 'Makefile'
--- Makefile 2015-03-11 12:11:10 +0000
+++ Makefile 2015-04-16 14:39:37 +0000
@@ -2,7 +2,7 @@
2PYTHON := /usr/bin/env python2PYTHON := /usr/bin/env python
33
4lint:4lint:
5 @flake8 --exclude hooks/charmhelpers hooks unit_tests tests5 @flake8 --exclude hooks/charmhelpers actions hooks unit_tests tests
6 @charm proof6 @charm proof
77
8unit_test:8unit_test:
@@ -15,7 +15,9 @@
15 # raise_status() messages to stderr:15 # raise_status() messages to stderr:
16 # https://bugs.launchpad.net/amulet/+bug/132035716 # https://bugs.launchpad.net/amulet/+bug/1320357
17 @juju test -v -p AMULET_HTTP_PROXY --timeout 900 \17 @juju test -v -p AMULET_HTTP_PROXY --timeout 900 \
18 00-setup 14-basic-precise-icehouse 15-basic-trusty-icehouse18 00-setup 14-basic-precise-icehouse 15-basic-trusty-icehouse \
19 16-basic-trusty-icehouse-git 17-basic-trusty-juno \
20 18-basic-trusty-juno-git
1921
20bin/charm_helpers_sync.py:22bin/charm_helpers_sync.py:
21 @mkdir -p bin23 @mkdir -p bin
2224
=== modified file 'README.md'
--- README.md 2015-01-22 14:35:41 +0000
+++ README.md 2015-04-16 14:39:37 +0000
@@ -68,3 +68,63 @@
68Otherwise it will be assumed that this unit may come back at some point and68Otherwise it will be assumed that this unit may come back at some point and
69therefore must be know to be in-sync with the rest before continuing.69therefore must be know to be in-sync with the rest before continuing.
7070
71Deploying from source
72---------------------
73
74The minimum openstack-origin-git config required to deploy from source is:
75
76 openstack-origin-git:
77 "repositories:
78 - {name: requirements,
79 repository: 'git://git.openstack.org/openstack/requirements',
80 branch: stable/juno}
81 - {name: keystone,
82 repository: 'git://git.openstack.org/openstack/keystone',
83 branch: stable/juno}"
84
85Note that there are only two 'name' values the charm knows about: 'requirements'
86and 'keystone'. These repositories must correspond to these 'name' values.
87Additionally, the requirements repository must be specified first and the
88keystone repository must be specified last. All other repostories are installed
89in the order in which they are specified.
90
91The following is a full list of current tip repos (may not be up-to-date):
92
93 openstack-origin-git:
94 "repositories:
95 - {name: requirements,
96 repository: 'git://git.openstack.org/openstack/requirements',
97 branch: master}
98 - {name: oslo-concurrency,
99 repository: 'git://git.openstack.org/openstack/oslo.concurrency',
100 branch: master}
101 - {name: oslo-config,
102 repository: 'git://git.openstack.org/openstack/oslo.config',
103 branch: master}
104 - {name: oslo-db,
105 repository: 'git://git.openstack.org/openstack/oslo.db',
106 branch: master}
107 - {name: oslo-i18n,
108 repository: 'git://git.openstack.org/openstack/oslo.i18n',
109 branch: master}
110 - {name: oslo-serialization,
111 repository: 'git://git.openstack.org/openstack/oslo.serialization',
112 branch: master}
113 - {name: oslo-utils,
114 repository: 'git://git.openstack.org/openstack/oslo.utils',
115 branch: master}
116 - {name: pbr,
117 repository: 'git://git.openstack.org/openstack-dev/pbr',
118 branch: master}
119 - {name: python-keystoneclient,
120 repository: 'git://git.openstack.org/openstack/python-keystoneclient',
121 branch: master}
122 - {name: sqlalchemy-migrate,
123 repository: 'git://git.openstack.org/stackforge/sqlalchemy-migrate',
124 branch: master}
125 - {name: keystonemiddleware,
126 repository: 'git://git.openstack.org/openstack/keystonemiddleware',
127 branch: master}
128 - {name: keystone,
129 repository: 'git://git.openstack.org/openstack/keystone',
130 branch: master}"
71131
=== added directory 'actions'
=== added file 'actions.yaml'
--- actions.yaml 1970-01-01 00:00:00 +0000
+++ actions.yaml 2015-04-16 14:39:37 +0000
@@ -0,0 +1,2 @@
1git-reinstall:
2 description: Reinstall keystone from the openstack-origin-git repositories.
03
=== added symlink 'actions/git-reinstall'
=== target is u'git_reinstall.py'
=== added file 'actions/git_reinstall.py'
--- actions/git_reinstall.py 1970-01-01 00:00:00 +0000
+++ actions/git_reinstall.py 2015-04-16 14:39:37 +0000
@@ -0,0 +1,45 @@
1#!/usr/bin/python
2import sys
3import traceback
4
5sys.path.append('hooks/')
6
7from charmhelpers.contrib.openstack.utils import (
8 git_install_requested,
9)
10
11from charmhelpers.core.hookenv import (
12 action_set,
13 action_fail,
14 config,
15)
16
17from keystone_utils import (
18 git_install,
19)
20
21from keystone_hooks import (
22 config_changed,
23)
24
25
26def git_reinstall():
27 """Reinstall from source and restart services.
28
29 If the openstack-origin-git config option was used to install openstack
30 from source git repositories, then this action can be used to reinstall
31 from updated git repositories, followed by a restart of services."""
32 if not git_install_requested():
33 action_fail('openstack-origin-git is not configured')
34 return
35
36 try:
37 git_install(config('openstack-origin-git'))
38 config_changed()
39 except:
40 action_set({'traceback': traceback.format_exc()})
41 action_fail('git-reinstall resulted in an unexpected error')
42
43
44if __name__ == '__main__':
45 git_reinstall()
046
=== modified file 'charm-helpers-hooks.yaml'
--- charm-helpers-hooks.yaml 2015-03-18 18:38:09 +0000
+++ charm-helpers-hooks.yaml 2015-04-16 14:39:37 +0000
@@ -8,6 +8,7 @@
8 - contrib.hahelpers:8 - contrib.hahelpers:
9 - apache9 - apache
10 - cluster10 - cluster
11 - contrib.python
11 - contrib.unison12 - contrib.unison
12 - payload.execd13 - payload.execd
13 - contrib.peerstorage14 - contrib.peerstorage
1415
=== modified file 'config.yaml'
--- config.yaml 2015-04-01 06:55:04 +0000
+++ config.yaml 2015-04-16 14:39:37 +0000
@@ -22,6 +22,22 @@
22 Note that updating this setting to a source that is known to22 Note that updating this setting to a source that is known to
23 provide a later version of OpenStack will trigger a software23 provide a later version of OpenStack will trigger a software
24 upgrade.24 upgrade.
25
26 Note that when openstack-origin-git is specified, openstack
27 specific packages will be installed from source rather than
28 from the openstack-origin repository.
29 openstack-origin-git:
30 default:
31 type: string
32 description: |
33 Specifies a YAML-formatted dictionary listing the git
34 repositories and branches from which to install OpenStack and
35 its dependencies.
36
37 Note that the installed config files will be determined based on
38 the OpenStack release of the openstack-origin option.
39
40 For more details see README.md.
25 config-file:41 config-file:
26 default: "/etc/keystone/keystone.conf"42 default: "/etc/keystone/keystone.conf"
27 type: string43 type: string
2844
=== modified file 'hooks/charmhelpers/contrib/openstack/utils.py'
--- hooks/charmhelpers/contrib/openstack/utils.py 2015-04-09 02:17:36 +0000
+++ hooks/charmhelpers/contrib/openstack/utils.py 2015-04-16 14:39:37 +0000
@@ -524,9 +524,10 @@
524 projects = yaml.load(projects_yaml)524 projects = yaml.load(projects_yaml)
525 _git_validate_projects_yaml(projects, core_project)525 _git_validate_projects_yaml(projects, core_project)
526526
527 old_environ = dict(os.environ)
528
527 if 'http_proxy' in projects.keys():529 if 'http_proxy' in projects.keys():
528 os.environ['http_proxy'] = projects['http_proxy']530 os.environ['http_proxy'] = projects['http_proxy']
529
530 if 'https_proxy' in projects.keys():531 if 'https_proxy' in projects.keys():
531 os.environ['https_proxy'] = projects['https_proxy']532 os.environ['https_proxy'] = projects['https_proxy']
532533
@@ -544,6 +545,8 @@
544 repo_dir = _git_clone_and_install_single(repo, branch, parent_dir,545 repo_dir = _git_clone_and_install_single(repo, branch, parent_dir,
545 update_requirements=True)546 update_requirements=True)
546547
548 os.environ = old_environ
549
547550
548def _git_validate_projects_yaml(projects, core_project):551def _git_validate_projects_yaml(projects, core_project):
549 """552 """
550553
=== added file 'hooks/charmhelpers/contrib/python/debug.py'
--- hooks/charmhelpers/contrib/python/debug.py 1970-01-01 00:00:00 +0000
+++ hooks/charmhelpers/contrib/python/debug.py 2015-04-16 14:39:37 +0000
@@ -0,0 +1,56 @@
1#!/usr/bin/env python
2# coding: utf-8
3
4# Copyright 2014-2015 Canonical Limited.
5#
6# This file is part of charm-helpers.
7#
8# charm-helpers is free software: you can redistribute it and/or modify
9# it under the terms of the GNU Lesser General Public License version 3 as
10# published by the Free Software Foundation.
11#
12# charm-helpers is distributed in the hope that it will be useful,
13# but WITHOUT ANY WARRANTY; without even the implied warranty of
14# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15# GNU Lesser General Public License for more details.
16#
17# You should have received a copy of the GNU Lesser General Public License
18# along with charm-helpers. If not, see <http://www.gnu.org/licenses/>.
19
20from __future__ import print_function
21
22import atexit
23import sys
24
25from charmhelpers.contrib.python.rpdb import Rpdb
26from charmhelpers.core.hookenv import (
27 open_port,
28 close_port,
29 ERROR,
30 log
31)
32
33__author__ = "Jorge Niedbalski <jorge.niedbalski@canonical.com>"
34
35DEFAULT_ADDR = "0.0.0.0"
36DEFAULT_PORT = 4444
37
38
39def _error(message):
40 log(message, level=ERROR)
41
42
43def set_trace(addr=DEFAULT_ADDR, port=DEFAULT_PORT):
44 """
45 Set a trace point using the remote debugger
46 """
47 atexit.register(close_port, port)
48 try:
49 log("Starting a remote python debugger session on %s:%s" % (addr,
50 port))
51 open_port(port)
52 debugger = Rpdb(addr=addr, port=port)
53 debugger.set_trace(sys._getframe().f_back)
54 except:
55 _error("Cannot start a remote debug session on %s:%s" % (addr,
56 port))
057
=== added file 'hooks/charmhelpers/contrib/python/rpdb.py'
--- hooks/charmhelpers/contrib/python/rpdb.py 1970-01-01 00:00:00 +0000
+++ hooks/charmhelpers/contrib/python/rpdb.py 2015-04-16 14:39:37 +0000
@@ -0,0 +1,58 @@
1# Copyright 2014-2015 Canonical Limited.
2#
3# This file is part of charm-helpers.
4#
5# charm-helpers is free software: you can redistribute it and/or modify
6# it under the terms of the GNU Lesser General Public License version 3 as
7# published by the Free Software Foundation.
8#
9# charm-helpers is distributed in the hope that it will be useful,
10# but WITHOUT ANY WARRANTY; without even the implied warranty of
11# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12# GNU Lesser General Public License for more details.
13#
14# You should have received a copy of the GNU Lesser General Public License
15# along with charm-helpers. If not, see <http://www.gnu.org/licenses/>.
16
17"""Remote Python Debugger (pdb wrapper)."""
18
19import pdb
20import socket
21import sys
22
23__author__ = "Bertrand Janin <b@janin.com>"
24__version__ = "0.1.3"
25
26
27class Rpdb(pdb.Pdb):
28
29 def __init__(self, addr="127.0.0.1", port=4444):
30 """Initialize the socket and initialize pdb."""
31
32 # Backup stdin and stdout before replacing them by the socket handle
33 self.old_stdout = sys.stdout
34 self.old_stdin = sys.stdin
35
36 # Open a 'reusable' socket to let the webapp reload on the same port
37 self.skt = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
38 self.skt.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, True)
39 self.skt.bind((addr, port))
40 self.skt.listen(1)
41 (clientsocket, address) = self.skt.accept()
42 handle = clientsocket.makefile('rw')
43 pdb.Pdb.__init__(self, completekey='tab', stdin=handle, stdout=handle)
44 sys.stdout = sys.stdin = handle
45
46 def shutdown(self):
47 """Revert stdin and stdout, close the socket."""
48 sys.stdout = self.old_stdout
49 sys.stdin = self.old_stdin
50 self.skt.close()
51 self.set_continue()
52
53 def do_continue(self, arg):
54 """Stop all operation on ``continue``."""
55 self.shutdown()
56 return 1
57
58 do_EOF = do_quit = do_exit = do_c = do_cont = do_continue
059
=== added file 'hooks/charmhelpers/contrib/python/version.py'
--- hooks/charmhelpers/contrib/python/version.py 1970-01-01 00:00:00 +0000
+++ hooks/charmhelpers/contrib/python/version.py 2015-04-16 14:39:37 +0000
@@ -0,0 +1,34 @@
1#!/usr/bin/env python
2# coding: utf-8
3
4# Copyright 2014-2015 Canonical Limited.
5#
6# This file is part of charm-helpers.
7#
8# charm-helpers is free software: you can redistribute it and/or modify
9# it under the terms of the GNU Lesser General Public License version 3 as
10# published by the Free Software Foundation.
11#
12# charm-helpers is distributed in the hope that it will be useful,
13# but WITHOUT ANY WARRANTY; without even the implied warranty of
14# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15# GNU Lesser General Public License for more details.
16#
17# You should have received a copy of the GNU Lesser General Public License
18# along with charm-helpers. If not, see <http://www.gnu.org/licenses/>.
19
20import sys
21
22__author__ = "Jorge Niedbalski <jorge.niedbalski@canonical.com>"
23
24
25def current_version():
26 """Current system python version"""
27 return sys.version_info
28
29
30def current_version_string():
31 """Current system python version as string major.minor.micro"""
32 return "{0}.{1}.{2}".format(sys.version_info.major,
33 sys.version_info.minor,
34 sys.version_info.micro)
035
=== modified file 'hooks/keystone_hooks.py'
--- hooks/keystone_hooks.py 2015-03-11 14:46:42 +0000
+++ hooks/keystone_hooks.py 2015-04-16 14:39:37 +0000
@@ -42,7 +42,9 @@
42)42)
4343
44from charmhelpers.contrib.openstack.utils import (44from charmhelpers.contrib.openstack.utils import (
45 config_value_changed,
45 configure_installation_source,46 configure_installation_source,
47 git_install_requested,
46 openstack_upgrade_available,48 openstack_upgrade_available,
47 sync_db_with_multi_ipv6_addresses49 sync_db_with_multi_ipv6_addresses
48)50)
@@ -53,6 +55,7 @@
53 do_openstack_upgrade,55 do_openstack_upgrade,
54 ensure_initial_admin,56 ensure_initial_admin,
55 get_admin_passwd,57 get_admin_passwd,
58 git_install,
56 migrate_database,59 migrate_database,
57 save_script_rc,60 save_script_rc,
58 synchronize_ca_if_changed,61 synchronize_ca_if_changed,
@@ -116,6 +119,8 @@
116 apt_update()119 apt_update()
117 apt_install(determine_packages(), fatal=True)120 apt_install(determine_packages(), fatal=True)
118121
122 git_install(config('openstack-origin-git'))
123
119124
120@hooks.hook('config-changed')125@hooks.hook('config-changed')
121@restart_on_change(restart_map())126@restart_on_change(restart_map())
@@ -132,8 +137,12 @@
132 if not os.path.isdir(homedir):137 if not os.path.isdir(homedir):
133 mkdir(homedir, SSH_USER, 'juju_keystone', 0o775)138 mkdir(homedir, SSH_USER, 'juju_keystone', 0o775)
134139
135 if openstack_upgrade_available('keystone'):140 if git_install_requested():
136 do_openstack_upgrade(configs=CONFIGS)141 if config_value_changed('openstack-origin-git'):
142 git_install(config('openstack-origin-git'))
143 else:
144 if openstack_upgrade_available('keystone'):
145 do_openstack_upgrade(configs=CONFIGS)
137146
138 # Ensure ssl dir exists and is unison-accessible147 # Ensure ssl dir exists and is unison-accessible
139 ensure_ssl_dir()148 ensure_ssl_dir()
140149
=== modified file 'hooks/keystone_utils.py'
--- hooks/keystone_utils.py 2015-04-09 10:30:15 +0000
+++ hooks/keystone_utils.py 2015-04-16 14:39:37 +0000
@@ -6,6 +6,7 @@
6import os6import os
7import pwd7import pwd
8import re8import re
9import shutil
9import subprocess10import subprocess
10import threading11import threading
11import time12import time
@@ -40,14 +41,12 @@
40 configure_installation_source,41 configure_installation_source,
41 error_out,42 error_out,
42 get_os_codename_install_source,43 get_os_codename_install_source,
44 git_install_requested,
45 git_clone_and_install,
46 git_src_dir,
43 os_release,47 os_release,
44 save_script_rc as _save_script_rc)48 save_script_rc as _save_script_rc)
4549
46from charmhelpers.core.host import (
47 mkdir,
48 write_file,
49)
50
51from charmhelpers.core.strutils import (50from charmhelpers.core.strutils import (
52 bool_from_string,51 bool_from_string,
53)52)
@@ -59,6 +58,7 @@
59)58)
6059
61from charmhelpers.core.hookenv import (60from charmhelpers.core.hookenv import (
61 charm_dir,
62 config,62 config,
63 is_relation_made,63 is_relation_made,
64 log,64 log,
@@ -78,15 +78,20 @@
78 apt_install,78 apt_install,
79 apt_update,79 apt_update,
80 apt_upgrade,80 apt_upgrade,
81 add_source81 add_source,
82)82)
8383
84from charmhelpers.core.host import (84from charmhelpers.core.host import (
85 adduser,
86 add_group,
87 add_user_to_group,
88 mkdir,
85 service_stop,89 service_stop,
86 service_start,90 service_start,
87 service_restart,91 service_restart,
88 pwgen,92 pwgen,
89 lsb_release93 lsb_release,
94 write_file,
90)95)
9196
92from charmhelpers.contrib.peerstorage import (97from charmhelpers.contrib.peerstorage import (
@@ -95,6 +100,8 @@
95 peer_retrieve,100 peer_retrieve,
96)101)
97102
103from charmhelpers.core.templating import render
104
98import keystone_context105import keystone_context
99import keystone_ssl as ssl106import keystone_ssl as ssl
100107
@@ -114,10 +121,25 @@
114 'uuid',121 'uuid',
115]122]
116123
124BASE_GIT_PACKAGES = [
125 'libxml2-dev',
126 'libxslt1-dev',
127 'python-dev',
128 'python-pip',
129 'python-setuptools',
130 'zlib1g-dev',
131]
132
117BASE_SERVICES = [133BASE_SERVICES = [
118 'keystone',134 'keystone',
119]135]
120136
137# ubuntu packages that should not be installed when deploying from git
138GIT_PACKAGE_BLACKLIST = [
139 'keystone',
140 'python-keystoneclient',
141]
142
121API_PORTS = {143API_PORTS = {
122 'keystone-admin': config('admin-port'),144 'keystone-admin': config('admin-port'),
123 'keystone-public': config('service-port')145 'keystone-public': config('service-port')
@@ -305,6 +327,14 @@
305 packages = [] + BASE_PACKAGES327 packages = [] + BASE_PACKAGES
306 for k, v in resource_map().iteritems():328 for k, v in resource_map().iteritems():
307 packages.extend(v['services'])329 packages.extend(v['services'])
330
331 if git_install_requested():
332 packages.extend(BASE_GIT_PACKAGES)
333 # don't include packages that will be installed from git
334 packages = list(set(packages))
335 for p in GIT_PACKAGE_BLACKLIST:
336 packages.remove(p)
337
308 return list(set(packages))338 return list(set(packages))
309339
310340
@@ -1629,3 +1659,68 @@
1629 # If neither relation has units then we are probably in sqlite mode so1659 # If neither relation has units then we are probably in sqlite mode so
1630 # return True.1660 # return True.
1631 return not rel_has_units1661 return not rel_has_units
1662
1663
1664def git_install(projects_yaml):
1665 """Perform setup, and install git repos specified in yaml parameter."""
1666 if git_install_requested():
1667 git_pre_install()
1668 git_clone_and_install(projects_yaml, core_project='keystone')
1669 git_post_install(projects_yaml)
1670
1671
1672def git_pre_install():
1673 """Perform keystone pre-install setup."""
1674 dirs = [
1675 '/var/lib/keystone',
1676 '/var/lib/keystone/cache',
1677 '/var/log/keystone',
1678 ]
1679
1680 logs = [
1681 '/var/log/keystone/keystone.log',
1682 ]
1683
1684 adduser('keystone', shell='/bin/bash', system_user=True)
1685 add_group('keystone', system_group=True)
1686 add_user_to_group('keystone', 'keystone')
1687
1688 for d in dirs:
1689 mkdir(d, owner='keystone', group='keystone', perms=0700, force=False)
1690
1691 for l in logs:
1692 write_file(l, '', owner='keystone', group='keystone', perms=0600)
1693
1694
1695def git_post_install(projects_yaml):
1696 """Perform keystone post-install setup."""
1697 src_etc = os.path.join(git_src_dir(projects_yaml, 'keystone'), 'etc')
1698 configs = {
1699 'src': src_etc,
1700 'dest': '/etc/keystone',
1701 }
1702
1703 if os.path.exists(configs['dest']):
1704 shutil.rmtree(configs['dest'])
1705 shutil.copytree(configs['src'], configs['dest'])
1706
1707 render('git/logging.conf', '/etc/keystone/logging.conf', {}, perms=0o644)
1708
1709 keystone_context = {
1710 'service_description': 'Keystone API server',
1711 'service_name': 'Keystone',
1712 'user_name': 'keystone',
1713 'start_dir': '/var/lib/keystone',
1714 'process_name': 'keystone',
1715 'executable_name': '/usr/local/bin/keystone-all',
1716 'config_files': ['/etc/keystone/keystone.conf'],
1717 'log_file': '/var/log/keystone/keystone.log',
1718 }
1719
1720 # NOTE(coreycb): Needs systemd support
1721 templates_dir = 'hooks/charmhelpers/contrib/openstack/templates'
1722 templates_dir = os.path.join(charm_dir(), templates_dir)
1723 render('git.upstart', '/etc/init/keystone.conf', keystone_context,
1724 perms=0o644, templates_dir=templates_dir)
1725
1726 service_restart('keystone')
16321727
=== added directory 'templates/git'
=== added file 'templates/git/logging.conf'
--- templates/git/logging.conf 1970-01-01 00:00:00 +0000
+++ templates/git/logging.conf 2015-04-16 14:39:37 +0000
@@ -0,0 +1,39 @@
1[loggers]
2keys=root
3
4[formatters]
5keys=normal,normal_with_name,debug
6
7[handlers]
8keys=production,file,devel
9
10[logger_root]
11level=WARNING
12handlers=file
13
14[handler_production]
15class=handlers.SysLogHandler
16level=ERROR
17formatter=normal_with_name
18args=(('localhost', handlers.SYSLOG_UDP_PORT), handlers.SysLogHandler.LOG_USER)
19
20[handler_file]
21class=FileHandler
22level=DEBUG
23formatter=normal_with_name
24args=('/var/log/keystone/keystone.log', 'a')
25
26[handler_devel]
27class=StreamHandler
28level=NOTSET
29formatter=debug
30args=(sys.stdout,)
31
32[formatter_normal]
33format=%(asctime)s %(levelname)s %(message)s
34
35[formatter_normal_with_name]
36format=(%(name)s): %(asctime)s %(levelname)s %(message)s
37
38[formatter_debug]
39format=(%(name)s): %(asctime)s %(levelname)s %(module)s %(funcName)s %(message)s
040
=== removed file 'tests/10-basic-precise-essex'
--- tests/10-basic-precise-essex 2014-06-24 17:11:36 +0000
+++ tests/10-basic-precise-essex 1970-01-01 00:00:00 +0000
@@ -1,9 +0,0 @@
1#!/usr/bin/python
2
3"""Amulet tests on a basic keystone deployment on precise-essex."""
4
5from basic_deployment import KeystoneBasicDeployment
6
7if __name__ == '__main__':
8 deployment = KeystoneBasicDeployment(series='precise')
9 deployment.run_tests()
100
=== removed file 'tests/11-basic-precise-folsom'
--- tests/11-basic-precise-folsom 2014-07-01 14:06:01 +0000
+++ tests/11-basic-precise-folsom 1970-01-01 00:00:00 +0000
@@ -1,11 +0,0 @@
1#!/usr/bin/python
2
3"""Amulet tests on a basic keystone deployment on precise-folsom."""
4
5from basic_deployment import KeystoneBasicDeployment
6
7if __name__ == '__main__':
8 deployment = KeystoneBasicDeployment(series='precise',
9 openstack='cloud:precise-folsom',
10 source='cloud:precise-updates/folsom')
11 deployment.run_tests()
120
=== removed file 'tests/12-basic-precise-grizzly'
--- tests/12-basic-precise-grizzly 2014-07-01 14:06:01 +0000
+++ tests/12-basic-precise-grizzly 1970-01-01 00:00:00 +0000
@@ -1,11 +0,0 @@
1#!/usr/bin/python
2
3"""Amulet tests on a basic keystone deployment on precise-grizzly."""
4
5from basic_deployment import KeystoneBasicDeployment
6
7if __name__ == '__main__':
8 deployment = KeystoneBasicDeployment(series='precise',
9 openstack='cloud:precise-grizzly',
10 source='cloud:precise-updates/grizzly')
11 deployment.run_tests()
120
=== removed file 'tests/13-basic-precise-havana'
--- tests/13-basic-precise-havana 2014-07-01 14:06:01 +0000
+++ tests/13-basic-precise-havana 1970-01-01 00:00:00 +0000
@@ -1,11 +0,0 @@
1#!/usr/bin/python
2
3"""Amulet tests on a basic keystone deployment on precise-havana."""
4
5from basic_deployment import KeystoneBasicDeployment
6
7if __name__ == '__main__':
8 deployment = KeystoneBasicDeployment(series='precise',
9 openstack='cloud:precise-havana',
10 source='cloud:precise-updates/havana')
11 deployment.run_tests()
120
=== added file 'tests/16-basic-trusty-icehouse-git'
--- tests/16-basic-trusty-icehouse-git 1970-01-01 00:00:00 +0000
+++ tests/16-basic-trusty-icehouse-git 2015-04-16 14:39:37 +0000
@@ -0,0 +1,9 @@
1#!/usr/bin/python
2
3"""Amulet tests on a basic keystone git deployment on trusty-icehouse."""
4
5from basic_deployment import KeystoneBasicDeployment
6
7if __name__ == '__main__':
8 deployment = KeystoneBasicDeployment(series='trusty', git=True)
9 deployment.run_tests()
010
=== added file 'tests/17-basic-trusty-juno'
--- tests/17-basic-trusty-juno 1970-01-01 00:00:00 +0000
+++ tests/17-basic-trusty-juno 2015-04-16 14:39:37 +0000
@@ -0,0 +1,11 @@
1#!/usr/bin/python
2
3"""Amulet tests on a basic keystone deployment on trusty-juno."""
4
5from basic_deployment import KeystoneBasicDeployment
6
7if __name__ == '__main__':
8 deployment = KeystoneBasicDeployment(series='trusty',
9 openstack='cloud:trusty-juno',
10 source='cloud:trusty-updates/juno')
11 deployment.run_tests()
012
=== added file 'tests/18-basic-trusty-juno-git'
--- tests/18-basic-trusty-juno-git 1970-01-01 00:00:00 +0000
+++ tests/18-basic-trusty-juno-git 2015-04-16 14:39:37 +0000
@@ -0,0 +1,12 @@
1#!/usr/bin/python
2
3"""Amulet tests on a basic keystone git deployment on trusty-juno."""
4
5from basic_deployment import KeystoneBasicDeployment
6
7if __name__ == '__main__':
8 deployment = KeystoneBasicDeployment(series='trusty',
9 openstack='cloud:trusty-juno',
10 source='cloud:trusty-updates/juno',
11 git=True)
12 deployment.run_tests()
013
=== modified file 'tests/basic_deployment.py'
--- tests/basic_deployment.py 2015-04-09 02:11:06 +0000
+++ tests/basic_deployment.py 2015-04-16 14:39:37 +0000
@@ -1,6 +1,8 @@
1#!/usr/bin/python1#!/usr/bin/python
22
3import amulet3import amulet
4import os
5import yaml
46
5from charmhelpers.contrib.openstack.amulet.deployment import (7from charmhelpers.contrib.openstack.amulet.deployment import (
6 OpenStackAmuletDeployment8 OpenStackAmuletDeployment
@@ -13,15 +15,16 @@
13)15)
1416
15# Use DEBUG to turn on debug logging17# Use DEBUG to turn on debug logging
16u = OpenStackAmuletUtils(ERROR)18u = OpenStackAmuletUtils(DEBUG)
1719
1820
19class KeystoneBasicDeployment(OpenStackAmuletDeployment):21class KeystoneBasicDeployment(OpenStackAmuletDeployment):
20 """Amulet tests on a basic keystone deployment."""22 """Amulet tests on a basic keystone deployment."""
2123
22 def __init__(self, series=None, openstack=None, source=None, stable=False):24 def __init__(self, series=None, openstack=None, source=None, git=False, stable=False):
23 """Deploy the entire test environment."""25 """Deploy the entire test environment."""
24 super(KeystoneBasicDeployment, self).__init__(series, openstack, source, stable)26 super(KeystoneBasicDeployment, self).__init__(series, openstack, source, stable)
27 self.git = git
25 self._add_services()28 self._add_services()
26 self._add_relations()29 self._add_relations()
27 self._configure_services()30 self._configure_services()
@@ -50,6 +53,24 @@
50 """Configure all of the services."""53 """Configure all of the services."""
51 keystone_config = {'admin-password': 'openstack',54 keystone_config = {'admin-password': 'openstack',
52 'admin-token': 'ubuntutesting'}55 'admin-token': 'ubuntutesting'}
56 if self.git:
57 branch = 'stable/' + self._get_openstack_release_string()
58 amulet_http_proxy = os.environ.get('AMULET_HTTP_PROXY')
59 openstack_origin_git = {
60 'repositories': [
61 {'name': 'requirements',
62 'repository': 'git://git.openstack.org/openstack/requirements',
63 'branch': branch},
64 {'name': 'keystone',
65 'repository': 'git://git.openstack.org/openstack/keystone',
66 'branch': branch},
67 ],
68 'directory': '/mnt/openstack-git',
69 'http_proxy': amulet_http_proxy,
70 'https_proxy': amulet_http_proxy,
71 }
72 keystone_config['openstack-origin-git'] = yaml.dump(openstack_origin_git)
73
53 mysql_config = {'dataset-size': '50%'}74 mysql_config = {'dataset-size': '50%'}
54 cinder_config = {'block-device': 'None'}75 cinder_config = {'block-device': 'None'}
55 configs = {'keystone': keystone_config,76 configs = {'keystone': keystone_config,
5677
=== modified file 'unit_tests/__init__.py'
--- unit_tests/__init__.py 2014-03-31 10:17:39 +0000
+++ unit_tests/__init__.py 2015-04-16 14:39:37 +0000
@@ -1,3 +1,4 @@
1import sys1import sys
22
3sys.path.append('actions/')
3sys.path.append('hooks/')4sys.path.append('hooks/')
45
=== added file 'unit_tests/test_actions_git_reinstall.py'
--- unit_tests/test_actions_git_reinstall.py 1970-01-01 00:00:00 +0000
+++ unit_tests/test_actions_git_reinstall.py 2015-04-16 14:39:37 +0000
@@ -0,0 +1,95 @@
1from mock import patch
2
3with patch('charmhelpers.core.hookenv.config') as config:
4 config.return_value = 'keystone'
5 import keystone_utils as utils # noqa
6
7with patch('keystone_utils.register_configs') as register_configs:
8 import git_reinstall
9
10from test_utils import (
11 CharmTestCase
12)
13
14TO_PATCH = [
15 'config',
16]
17
18
19openstack_origin_git = \
20 """repositories:
21 - {name: requirements,
22 repository: 'git://git.openstack.org/openstack/requirements',
23 branch: stable/juno}
24 - {name: keystone,
25 repository: 'git://git.openstack.org/openstack/keystone',
26 branch: stable/juno}"""
27
28
29class TestKeystoneActions(CharmTestCase):
30
31 def setUp(self):
32 super(TestKeystoneActions, self).setUp(git_reinstall, TO_PATCH)
33 self.config.side_effect = self.test_config.get
34
35 @patch.object(git_reinstall, 'action_set')
36 @patch.object(git_reinstall, 'action_fail')
37 @patch.object(git_reinstall, 'git_install')
38 @patch.object(git_reinstall, 'config_changed')
39 def test_git_reinstall(self, config_changed, git_install, action_fail,
40 action_set):
41 self.test_config.set('openstack-origin-git', openstack_origin_git)
42
43 git_reinstall.git_reinstall()
44
45 git_install.assert_called_with(openstack_origin_git)
46 self.assertTrue(git_install.called)
47 self.assertTrue(config_changed.called)
48 self.assertFalse(action_set.called)
49 self.assertFalse(action_fail.called)
50
51 @patch.object(git_reinstall, 'action_set')
52 @patch.object(git_reinstall, 'action_fail')
53 @patch.object(git_reinstall, 'git_install')
54 @patch.object(git_reinstall, 'config_changed')
55 @patch('charmhelpers.contrib.openstack.utils.config')
56 def test_git_reinstall_not_configured(self, _config, config_changed,
57 git_install, action_fail,
58 action_set):
59 _config.return_value = None
60
61 git_reinstall.git_reinstall()
62
63 msg = 'openstack-origin-git is not configured'
64 action_fail.assert_called_with(msg)
65 self.assertFalse(git_install.called)
66 self.assertFalse(action_set.called)
67
68 @patch.object(git_reinstall, 'action_set')
69 @patch.object(git_reinstall, 'action_fail')
70 @patch.object(git_reinstall, 'git_install')
71 @patch.object(git_reinstall, 'config_changed')
72 @patch('traceback.format_exc')
73 @patch('charmhelpers.contrib.openstack.utils.config')
74 def test_git_reinstall_exception(self, _config, format_exc,
75 config_changed, git_install, action_fail,
76 action_set):
77 _config.return_value = openstack_origin_git
78 e = OSError('something bad happened')
79 git_install.side_effect = e
80 traceback = (
81 "Traceback (most recent call last):\n"
82 " File \"actions/git_reinstall.py\", line 37, in git_reinstall\n"
83 " git_install(config(\'openstack-origin-git\'))\n"
84 " File \"/usr/lib/python2.7/dist-packages/mock.py\", line 964, in __call__\n" # noqa
85 " return _mock_self._mock_call(*args, **kwargs)\n"
86 " File \"/usr/lib/python2.7/dist-packages/mock.py\", line 1019, in _mock_call\n" # noqa
87 " raise effect\n"
88 "OSError: something bad happened\n")
89 format_exc.return_value = traceback
90
91 git_reinstall.git_reinstall()
92
93 msg = 'git-reinstall resulted in an unexpected error'
94 action_fail.assert_called_with(msg)
95 action_set.assert_called_with({'traceback': traceback})
096
=== modified file 'unit_tests/test_keystone_hooks.py'
--- unit_tests/test_keystone_hooks.py 2015-03-10 16:17:27 +0000
+++ unit_tests/test_keystone_hooks.py 2015-04-16 14:39:37 +0000
@@ -2,6 +2,7 @@
2import os2import os
3import json3import json
4import uuid4import uuid
5import yaml
56
6from test_utils import CharmTestCase7from test_utils import CharmTestCase
78
@@ -67,6 +68,7 @@
67 'get_iface_for_address',68 'get_iface_for_address',
68 'get_netmask_for_address',69 'get_netmask_for_address',
69 'get_address_in_network',70 'get_address_in_network',
71 'git_install',
70]72]
7173
7274
@@ -77,17 +79,49 @@
77 self.config.side_effect = self.test_config.get79 self.config.side_effect = self.test_config.get
78 self.ssh_user = 'juju_keystone'80 self.ssh_user = 'juju_keystone'
7981
80 def test_install_hook(self):82 @patch.object(utils, 'git_install_requested')
83 def test_install_hook(self, git_requested):
84 git_requested.return_value = False
81 repo = 'cloud:precise-grizzly'85 repo = 'cloud:precise-grizzly'
82 self.test_config.set('openstack-origin', repo)86 self.test_config.set('openstack-origin', repo)
83 hooks.install()87 hooks.install()
88 self.assertTrue(self.execd_preinstall.called)
84 self.configure_installation_source.assert_called_with(repo)89 self.configure_installation_source.assert_called_with(repo)
85 self.assertTrue(self.apt_update.called)90 self.assertTrue(self.apt_update.called)
86 self.apt_install.assert_called_with(91 self.apt_install.assert_called_with(
87 ['haproxy', 'unison', 'python-keystoneclient',92 ['haproxy', 'unison', 'python-keystoneclient',
88 'uuid', 'python-mysqldb', 'openssl', 'apache2',93 'uuid', 'python-mysqldb', 'openssl', 'apache2',
89 'pwgen', 'python-six', 'keystone', 'python-psycopg2'], fatal=True)94 'pwgen', 'python-six', 'keystone', 'python-psycopg2'], fatal=True)
95 self.git_install.assert_called_with(None)
96
97 @patch.object(utils, 'git_install_requested')
98 def test_install_hook_git(self, git_requested):
99 git_requested.return_value = True
100 repo = 'cloud:trusty-juno'
101 openstack_origin_git = {
102 'repositories': [
103 {'name': 'requirements',
104 'repository': 'git://git.openstack.org/openstack/requirements', # noqa
105 'branch': 'stable/juno'},
106 {'name': 'keystone',
107 'repository': 'git://git.openstack.org/openstack/keystone',
108 'branch': 'stable/juno'}
109 ],
110 'directory': '/mnt/openstack-git',
111 }
112 projects_yaml = yaml.dump(openstack_origin_git)
113 self.test_config.set('openstack-origin', repo)
114 self.test_config.set('openstack-origin-git', projects_yaml)
115 hooks.install()
90 self.assertTrue(self.execd_preinstall.called)116 self.assertTrue(self.execd_preinstall.called)
117 self.configure_installation_source.assert_called_with(repo)
118 self.assertTrue(self.apt_update.called)
119 self.apt_install.assert_called_with(
120 ['haproxy', 'unison', 'python-setuptools', 'python-six', 'uuid',
121 'python-mysqldb', 'python-pip', 'openssl', 'apache2', 'pwgen',
122 'libxslt1-dev', 'python-psycopg2', 'zlib1g-dev', 'python-dev',
123 'libxml2-dev'], fatal=True)
124 self.git_install.assert_called_with(projects_yaml)
91125
92 mod_ch_openstack_utils = 'charmhelpers.contrib.openstack.utils'126 mod_ch_openstack_utils = 'charmhelpers.contrib.openstack.utils'
93127
@@ -271,6 +305,7 @@
271 relation_id='identity-service:0',305 relation_id='identity-service:0',
272 remote_unit='unit/0')306 remote_unit='unit/0')
273307
308 @patch.object(hooks, 'git_install_requested')
274 @patch('keystone_utils.log')309 @patch('keystone_utils.log')
275 @patch('keystone_utils.ensure_ssl_cert_master')310 @patch('keystone_utils.ensure_ssl_cert_master')
276 @patch.object(hooks, 'ensure_pki_dir_permissions')311 @patch.object(hooks, 'ensure_pki_dir_permissions')
@@ -305,7 +340,8 @@
305 mock_ensure_ssl_dir,340 mock_ensure_ssl_dir,
306 mock_ensure_pki_dir_permissions,341 mock_ensure_pki_dir_permissions,
307 mock_ensure_ssl_cert_master,342 mock_ensure_ssl_cert_master,
308 mock_log):343 mock_log, git_requested):
344 git_requested.return_value = False
309 mock_is_pki_enabled.return_value = True345 mock_is_pki_enabled.return_value = True
310 mock_is_ssl_cert_master.return_value = True346 mock_is_ssl_cert_master.return_value = True
311 mock_is_db_initialised.return_value = True347 mock_is_db_initialised.return_value = True
@@ -334,6 +370,7 @@
334 remote_unit='unit/0')370 remote_unit='unit/0')
335 admin_relation_changed.assert_called_with('identity-service:0')371 admin_relation_changed.assert_called_with('identity-service:0')
336372
373 @patch.object(hooks, 'git_install_requested')
337 @patch('keystone_utils.log')374 @patch('keystone_utils.log')
338 @patch('keystone_utils.ensure_ssl_cert_master')375 @patch('keystone_utils.ensure_ssl_cert_master')
339 @patch.object(hooks, 'update_all_identity_relation_units')376 @patch.object(hooks, 'update_all_identity_relation_units')
@@ -361,7 +398,8 @@
361 mock_ensure_pki_permissions,398 mock_ensure_pki_permissions,
362 mock_update_all_id_rel_units,399 mock_update_all_id_rel_units,
363 mock_ensure_ssl_cert_master,400 mock_ensure_ssl_cert_master,
364 mock_log):401 mock_log, git_requested):
402 git_requested.return_value = False
365 mock_is_pki_enabled.return_value = True403 mock_is_pki_enabled.return_value = True
366 mock_is_ssl_cert_master.return_value = True404 mock_is_ssl_cert_master.return_value = True
367 mock_peer_units.return_value = []405 mock_peer_units.return_value = []
@@ -381,6 +419,7 @@
381 self.assertFalse(self.ensure_initial_admin.called)419 self.assertFalse(self.ensure_initial_admin.called)
382 self.assertFalse(identity_changed.called)420 self.assertFalse(identity_changed.called)
383421
422 @patch.object(hooks, 'git_install_requested')
384 @patch('keystone_utils.log')423 @patch('keystone_utils.log')
385 @patch('keystone_utils.ensure_ssl_cert_master')424 @patch('keystone_utils.ensure_ssl_cert_master')
386 @patch.object(hooks, 'ensure_pki_dir_permissions')425 @patch.object(hooks, 'ensure_pki_dir_permissions')
@@ -414,7 +453,8 @@
414 mock_ensure_ssl_dir,453 mock_ensure_ssl_dir,
415 mock_ensure_pki_permissions,454 mock_ensure_pki_permissions,
416 mock_ensure_ssl_cert_master,455 mock_ensure_ssl_cert_master,
417 mock_log):456 mock_log, git_requested):
457 git_requested.return_value = False
418 mock_is_pki_enabled.return_value = True458 mock_is_pki_enabled.return_value = True
419 mock_is_ssl_cert_master.return_value = True459 mock_is_ssl_cert_master.return_value = True
420 mock_is_db_ready.return_value = True460 mock_is_db_ready.return_value = True
@@ -445,6 +485,66 @@
445 remote_unit='unit/0')485 remote_unit='unit/0')
446 admin_relation_changed.assert_called_with('identity-service:0')486 admin_relation_changed.assert_called_with('identity-service:0')
447487
488 @patch.object(hooks, 'git_install_requested')
489 @patch.object(hooks, 'config_value_changed')
490 @patch('keystone_utils.log')
491 @patch('keystone_utils.ensure_ssl_cert_master')
492 @patch.object(hooks, 'ensure_ssl_dir')
493 @patch.object(hooks, 'is_pki_enabled')
494 @patch.object(hooks, 'send_ssl_sync_request')
495 @patch.object(hooks, 'is_db_initialised')
496 @patch.object(hooks, 'is_db_ready')
497 @patch.object(hooks, 'peer_units')
498 @patch.object(hooks, 'ensure_permissions')
499 @patch.object(hooks, 'admin_relation_changed')
500 @patch.object(hooks, 'cluster_joined')
501 @patch.object(unison, 'ensure_user')
502 @patch.object(unison, 'get_homedir')
503 @patch.object(hooks, 'CONFIGS')
504 @patch.object(hooks, 'identity_changed')
505 @patch.object(hooks, 'configure_https')
506 def test_config_changed_git_updated(self, configure_https,
507 identity_changed,
508 configs, get_homedir, ensure_user,
509 cluster_joined, admin_relation_changed,
510 ensure_permissions, mock_peer_units,
511 mock_is_db_ready,
512 mock_is_db_initialised,
513 mock_send_ssl_sync_request,
514 mock_is_pki_enabled,
515 mock_ensure_ssl_dir,
516 mock_ensure_ssl_cert_master,
517 mock_log, config_val_changed,
518 git_requested):
519 git_requested.return_value = True
520 mock_ensure_ssl_cert_master.return_value = False
521 mock_is_pki_enabled.return_value = False
522 self.openstack_upgrade_available.return_value = False
523 self.is_elected_leader.return_value = True
524 mock_peer_units.return_value = []
525 self.relation_ids.return_value = ['identity-service:0']
526 self.related_units.return_value = ['unit/0']
527
528 repo = 'cloud:trusty-juno'
529 openstack_origin_git = {
530 'repositories': [
531 {'name': 'requirements',
532 'repository': 'git://git.openstack.org/openstack/requirements', # noqa
533 'branch': 'stable/juno'},
534 {'name': 'keystone',
535 'repository': 'git://git.openstack.org/openstack/keystone',
536 'branch': 'stable/juno'}
537 ],
538 'directory': '/mnt/openstack-git',
539 }
540 projects_yaml = yaml.dump(openstack_origin_git)
541 self.test_config.set('openstack-origin', repo)
542 self.test_config.set('openstack-origin-git', projects_yaml)
543 hooks.config_changed()
544 self.git_install.assert_called_with(projects_yaml)
545 self.assertFalse(self.openstack_upgrade_available.called)
546 self.assertFalse(self.do_openstack_upgrade.called)
547
448 @patch.object(hooks, 'is_db_initialised')548 @patch.object(hooks, 'is_db_initialised')
449 @patch.object(hooks, 'is_db_ready')549 @patch.object(hooks, 'is_db_ready')
450 @patch('keystone_utils.log')550 @patch('keystone_utils.log')
@@ -689,6 +789,7 @@
689 cmd = ['a2dissite', 'openstack_https_frontend']789 cmd = ['a2dissite', 'openstack_https_frontend']
690 self.check_call.assert_called_with(cmd)790 self.check_call.assert_called_with(cmd)
691791
792 @patch.object(utils, 'git_install_requested')
692 @patch.object(hooks, 'is_db_ready')793 @patch.object(hooks, 'is_db_ready')
693 @patch.object(hooks, 'is_db_initialised')794 @patch.object(hooks, 'is_db_initialised')
694 @patch('keystone_utils.log')795 @patch('keystone_utils.log')
@@ -706,7 +807,8 @@
706 mock_relation_ids,807 mock_relation_ids,
707 mock_log,808 mock_log,
708 mock_is_db_ready,809 mock_is_db_ready,
709 mock_is_db_initialised):810 mock_is_db_initialised,
811 git_requested):
710 mock_is_db_initialised.return_value = True812 mock_is_db_initialised.return_value = True
711 mock_is_db_ready.return_value = True813 mock_is_db_ready.return_value = True
712 mock_is_elected_leader.return_value = False814 mock_is_elected_leader.return_value = False
@@ -718,6 +820,7 @@
718820
719 self.is_elected_leader.return_value = True821 self.is_elected_leader.return_value = True
720 self.filter_installed_packages.return_value = []822 self.filter_installed_packages.return_value = []
823 git_requested.return_value = False
721 hooks.upgrade_charm()824 hooks.upgrade_charm()
722 self.assertTrue(self.apt_install.called)825 self.assertTrue(self.apt_install.called)
723 ssh_authorized_peers.assert_called_with(826 ssh_authorized_peers.assert_called_with(
@@ -728,6 +831,7 @@
728 'Firing identity_changed hook for all related services.')831 'Firing identity_changed hook for all related services.')
729 self.assertTrue(self.ensure_initial_admin.called)832 self.assertTrue(self.ensure_initial_admin.called)
730833
834 @patch.object(utils, 'git_install_requested')
731 @patch('keystone_utils.log')835 @patch('keystone_utils.log')
732 @patch('keystone_utils.relation_ids')836 @patch('keystone_utils.relation_ids')
733 @patch('keystone_utils.ensure_ssl_cert_master')837 @patch('keystone_utils.ensure_ssl_cert_master')
@@ -737,7 +841,7 @@
737 mock_update_hash_from_path,841 mock_update_hash_from_path,
738 mock_ensure_ssl_cert_master,842 mock_ensure_ssl_cert_master,
739 mock_relation_ids,843 mock_relation_ids,
740 mock_log):844 mock_log, git_requested):
741 mock_relation_ids.return_value = []845 mock_relation_ids.return_value = []
742 mock_ensure_ssl_cert_master.return_value = False846 mock_ensure_ssl_cert_master.return_value = False
743 # Ensure always returns diff847 # Ensure always returns diff
@@ -746,6 +850,7 @@
746850
747 self.is_elected_leader.return_value = False851 self.is_elected_leader.return_value = False
748 self.filter_installed_packages.return_value = []852 self.filter_installed_packages.return_value = []
853 git_requested.return_value = False
749 hooks.upgrade_charm()854 hooks.upgrade_charm()
750 self.assertTrue(self.apt_install.called)855 self.assertTrue(self.apt_install.called)
751 ssh_authorized_peers.assert_called_with(856 ssh_authorized_peers.assert_called_with(
752857
=== modified file 'unit_tests/test_keystone_utils.py'
--- unit_tests/test_keystone_utils.py 2015-04-09 10:30:15 +0000
+++ unit_tests/test_keystone_utils.py 2015-04-16 14:39:37 +0000
@@ -53,6 +53,15 @@
53 'resolve_address',53 'resolve_address',
54]54]
5555
56openstack_origin_git = \
57 """repositories:
58 - {name: requirements,
59 repository: 'git://git.openstack.org/openstack/requirements',
60 branch: stable/juno}
61 - {name: keystone,
62 repository: 'git://git.openstack.org/openstack/keystone',
63 branch: stable/juno}"""
64
5665
57class TestKeystoneUtils(CharmTestCase):66class TestKeystoneUtils(CharmTestCase):
5867
@@ -108,9 +117,20 @@
108 result = utils.determine_ports()117 result = utils.determine_ports()
109 self.assertEquals(result, ['80', '81'])118 self.assertEquals(result, ['80', '81'])
110119
111 def test_determine_packages(self):120 @patch('charmhelpers.contrib.openstack.utils.config')
112 result = utils.determine_packages()121 def test_determine_packages(self, _config):
113 ex = utils.BASE_PACKAGES + ['keystone', 'haproxy', 'apache2']122 _config.return_value = None
123 result = utils.determine_packages()
124 ex = utils.BASE_PACKAGES + ['keystone', 'python-keystoneclient']
125 self.assertEquals(set(ex), set(result))
126
127 @patch('charmhelpers.contrib.openstack.utils.config')
128 def test_determine_packages_git(self, _config):
129 _config.return_value = openstack_origin_git
130 result = utils.determine_packages()
131 ex = utils.BASE_PACKAGES + ['keystone'] + utils.BASE_GIT_PACKAGES
132 for p in utils.GIT_PACKAGE_BLACKLIST:
133 ex.remove(p)
114 self.assertEquals(set(ex), set(result))134 self.assertEquals(set(ex), set(result))
115135
116 @patch.object(hooks, 'CONFIGS')136 @patch.object(hooks, 'CONFIGS')
@@ -593,3 +613,77 @@
593 self.is_elected_leader.return_value = True613 self.is_elected_leader.return_value = True
594 self.assertFalse(utils.ensure_ssl_cert_master())614 self.assertFalse(utils.ensure_ssl_cert_master())
595 self.assertFalse(self.relation_set.called)615 self.assertFalse(self.relation_set.called)
616
617 @patch.object(utils, 'git_install_requested')
618 @patch.object(utils, 'git_clone_and_install')
619 @patch.object(utils, 'git_post_install')
620 @patch.object(utils, 'git_pre_install')
621 def test_git_install(self, git_pre, git_post, git_clone_and_install,
622 git_requested):
623 projects_yaml = openstack_origin_git
624 git_requested.return_value = True
625 utils.git_install(projects_yaml)
626 self.assertTrue(git_pre.called)
627 git_clone_and_install.assert_called_with(openstack_origin_git,
628 core_project='keystone')
629 self.assertTrue(git_post.called)
630
631 @patch.object(utils, 'mkdir')
632 @patch.object(utils, 'write_file')
633 @patch.object(utils, 'add_user_to_group')
634 @patch.object(utils, 'add_group')
635 @patch.object(utils, 'adduser')
636 def test_git_pre_install(self, adduser, add_group, add_user_to_group,
637 write_file, mkdir):
638 utils.git_pre_install()
639 adduser.assert_called_with('keystone', shell='/bin/bash',
640 system_user=True)
641 add_group.assert_called_with('keystone', system_group=True)
642 add_user_to_group.assert_called_with('keystone', 'keystone')
643 expected = [
644 call('/var/lib/keystone', owner='keystone',
645 group='keystone', perms=0700, force=False),
646 call('/var/lib/keystone/cache', owner='keystone',
647 group='keystone', perms=0700, force=False),
648 call('/var/log/keystone', owner='keystone',
649 group='keystone', perms=0700, force=False),
650 ]
651 self.assertEquals(mkdir.call_args_list, expected)
652 write_file.assert_called_with('/var/log/keystone/keystone.log',
653 '', owner='keystone', group='keystone',
654 perms=0600)
655
656 @patch.object(utils, 'git_src_dir')
657 @patch.object(utils, 'service_restart')
658 @patch.object(utils, 'render')
659 @patch('os.path.join')
660 @patch('os.path.exists')
661 @patch('shutil.copytree')
662 @patch('shutil.rmtree')
663 def test_git_post_install(self, rmtree, copytree, exists, join, render,
664 service_restart, git_src_dir):
665 projects_yaml = openstack_origin_git
666 join.return_value = 'joined-string'
667 utils.git_post_install(projects_yaml)
668 expected = [
669 call('joined-string', '/etc/keystone'),
670 ]
671 copytree.assert_has_calls(expected)
672 keystone_context = {
673 'service_description': 'Keystone API server',
674 'service_name': 'Keystone',
675 'user_name': 'keystone',
676 'start_dir': '/var/lib/keystone',
677 'process_name': 'keystone',
678 'executable_name': '/usr/local/bin/keystone-all',
679 'config_files': ['/etc/keystone/keystone.conf'],
680 'log_file': '/var/log/keystone/keystone.log',
681 }
682 expected = [
683 call('git/logging.conf', '/etc/keystone/logging.conf', {},
684 perms=0o644),
685 call('git.upstart', '/etc/init/keystone.conf',
686 keystone_context, perms=0o644, templates_dir='joined-string'),
687 ]
688 self.assertEquals(render.call_args_list, expected)
689 service_restart.assert_called_with('keystone')

Subscribers

People subscribed via source and target branches