Merge lp:~mattyw/charms/trusty/mongodb/mongodb-backup into lp:charms/trusty/mongodb
| Status: | Merged |
|---|---|
| Merged at revision: | 78 |
| Proposed branch: | lp:~mattyw/charms/trusty/mongodb/mongodb-backup |
| Merge into: | lp:charms/trusty/mongodb |
| Diff against target: |
502 lines (+323/-28) 12 files modified
Makefile (+3/-1) actions.yaml (+22/-0) actions/backup.py (+56/-0) actions/backup_test.py (+52/-0) actions/dump (+4/-0) actions/restore (+4/-0) charm-helpers-sync.yaml (+1/-1) charmhelpers/core/hookenv.py (+43/-9) charmhelpers/core/host.py (+32/-16) charmhelpers/core/hugepage.py (+8/-1) charmhelpers/core/kernel.py (+68/-0) charmhelpers/core/strutils.py (+30/-0) |
| To merge this branch: | bzr merge lp:~mattyw/charms/trusty/mongodb/mongodb-backup |
| Related bugs: |
| Reviewer | Review Type | Date Requested | Status |
|---|---|---|---|
| Charles Butler (community) | Approve on 2015-11-05 | ||
| Domas Monkus (community) | Approve on 2015-10-08 | ||
| Marco Ceppi | 2015-10-06 | Needs Fixing on 2015-10-06 | |
| Ryan Beisner | Needs Fixing on 2015-10-06 | ||
|
Review via email:
|
|||
Commit Message
Added actions/dump and actions/restore
These are actions that run mongodump and mongorestore.
Both actions take two parameters, the list of arguments and the workingDirectory. The simplest use case is just
juju action do mongodb/0 dump
# SSH into mongodb - drop all the data
juju action do mongodb/0 restore
# SSH into mongo to confirm the data is restored
Description of the Change
Added actions/dump and actions/restore
These are actions that run mongodump and mongorestore.
Both actions take two parameters, the list of arguments and the workingDirectory. The simplest use case is just
juju action do mongodb/0 dump
# SSH into mongodb - drop all the data
juju action do mongodb/0 restore
# SSH into mongo to confirm the data is restored
charm_unit_test #10582 mongodb for mattyw mp273544
UNIT OK: passed
charm_amulet_test #7136 mongodb for mattyw mp273544
AMULET FAIL: amulet-test failed
AMULET Results (max last 2 lines):
make: *** [functional_test] Error 1
ERROR:root:Make target returned non-zero.
Full amulet test output: http://
Build: http://
| Ryan Beisner (1chb1n) wrote : | # |
Looks like a random interwebs failure during the apt process in the install hook on one of the mongo units. Re-triggering amulet test...
| Ryan Beisner (1chb1n) wrote : | # |
FYI, for the curious, this was where it stumbled (seemingly unrelated to the proposed changes):
2015-10-06 15:51:38 INFO install W: Failed to fetch http://
| Ryan Beisner (1chb1n) wrote : | # |
Please adjust the Makefile in your proposal to add lint test coverage of the new actions dir:
- .venv/bin/flake8 --exclude hooks/charmhelpers hooks tests unit_tests
+ .venv/bin/flake8 --exclude hooks/charmhelpers actions hooks tests unit_tests
Also: By default, flake8 will not check files in a directory unless they have a .py extension. Please use the .py extension on the action files.
Thank you
| Ryan Beisner (1chb1n) wrote : | # |
@mattw
RE: irc discussion, yes, if you can adjust the existing action along with your new actions, that would be great.
I would bzr mv the action files to add the .py extensions, then add a symlink of the old action filename to the new .py filename.
Here is an example of this approach in different charm:
openstack_upgrade --> symlinks to --> openstack_
Thanks again!
charm_amulet_test #7139 mongodb for mattyw mp273544
AMULET OK: passed
Build: http://
| Marco Ceppi (marcoceppi) wrote : | # |
I've got a few suggestions.
First, we have action-get, action-set, and action-fail in charmhelpers. I'd consider re-syncing charm-helpers in hooks/charmhelpers to include these updated methods then importing them in the actions files.
Also, symlinking to a .py file is a bit tedious, instead to address the lack of linting coverage, I'd recommend the following patch: http://
| Ryan Beisner (1chb1n) wrote : | # |
@mattw
From the test perspective: as long as the action code gets test coverage, I'm agnostic to how that is achieved in this charm.
Marco's example of adding file inspection logic to the Makefile is quite clever and a totally acceptable approach. Thanks @marcoceppi!
- 80. By Matthew Williams on 2015-10-07
-
Makefile: Added lint support for the actions, fixed linting issues found
- 81. By Matthew Williams on 2015-10-07
-
charmhelpers: Resync
- 82. By Matthew Williams on 2015-10-07
-
charmhelpers: sync
- 83. By Matthew Williams on 2015-10-07
-
actions/backup: Refactored the backup actions to allow unit testing
- 84. By Matthew Williams on 2015-10-07
-
actions/backup: unit tests for actions
- 85. By Matthew Williams on 2015-10-07
-
action/backup: Use the action functions from charmhelpers
| Matthew Williams (mattyw) wrote : | # |
@beisner @marcoceppi PTAL
charm_lint_check #11483 mongodb for mattyw mp273544
LINT FAIL: lint-test failed
LINT Results (max last 2 lines):
make: *** [lint] Error 1
ERROR:root:Make target returned non-zero.
Full lint test output: http://
Build: http://
charm_unit_test #10676 mongodb for mattyw mp273544
UNIT FAIL: unit-test failed
UNIT Results (max last 2 lines):
make: *** [test] Error 1
ERROR:root:Make target returned non-zero.
Full unit test output: http://
Build: http://
- 86. By Matthew Williams on 2015-10-07
-
actions/backup: Don't need this import anymore
charm_lint_check #11485 mongodb for mattyw mp273544
LINT OK: passed
Build: http://
charm_unit_test #10677 mongodb for mattyw mp273544
UNIT FAIL: unit-test failed
UNIT Results (max last 2 lines):
make: *** [test] Error 1
ERROR:root:Make target returned non-zero.
Full unit test output: http://
Build: http://
| Matthew Williams (mattyw) wrote : | # |
Sorry for the large diff. charmhelpers has been moved to location accessible by hooks and actions.
PTAL
charm_lint_check #11487 mongodb for mattyw mp273544
LINT OK: passed
Build: http://
charm_unit_test #10679 mongodb for mattyw mp273544
UNIT OK: passed
charm_amulet_test #7186 mongodb for mattyw mp273544
AMULET OK: passed
Build: http://
| Ryan Beisner (1chb1n) wrote : | # |
Tip:
If you'd like to drastically reduce the diff, while achieving the same effect:
Revert back to 86: bzr uncommit && bzr revert
Then bzr mv hooks/charmhelpers instead of mv, and do your linking after that. This will keep the version control side of things happier.
Then commit and bzr push with --overwrite.
charm_amulet_test #7188 mongodb for mattyw mp273544
AMULET OK: passed
Build: http://
- 87. By Matthew Williams on 2015-10-07
-
charmhelpers: Moved to common location
- 88. By Matthew Williams on 2015-10-07
-
charmhelpers: symlinks
charm_lint_check #11489 mongodb for mattyw mp273544
LINT OK: passed
Build: http://
charm_unit_test #10680 mongodb for mattyw mp273544
UNIT OK: passed
charm_amulet_test #7190 mongodb for mattyw mp273544
AMULET FAIL: amulet-test failed
AMULET Results (max last 2 lines):
make: *** [functional_test] Error 1
ERROR:root:Make target returned non-zero.
Full amulet test output: http://
Build: http://
| Ryan Beisner (1chb1n) wrote : | # |
^ that amulet test failure was unrelated to the proposed changes, rerunning...
2015-10-07 17:05:59 INFO install W: Failed to fetch http://
charm_amulet_test #7206 mongodb for mattyw mp273544
AMULET FAIL: amulet-test failed
AMULET Results (max last 2 lines):
make: *** [functional_test] Error 1
ERROR:root:Make target returned non-zero.
Full amulet test output: http://
Build: http://
- 89. By Matthew Williams on 2015-10-08
-
actions/backups.py: Fixed comments from domas' review
| Matthew Williams (mattyw) wrote : | # |
> charm_amulet_test #7206 mongodb for mattyw mp273544
> AMULET FAIL: amulet-test failed
>
> AMULET Results (max last 2 lines):
> make: *** [functional_test] Error 1
> ERROR:root:Make target returned non-zero.
>
> Full amulet test output: http://
> Build: http://
The output of this amulet tests seems to show that when three mongodb units were started in a replica set we ended up in a situation where there were two primaries. This is a known problem with the existing charm right? Seems like the tests should be altered?
charm_lint_check #11504 mongodb for mattyw mp273544
LINT OK: passed
Build: http://
charm_unit_test #10696 mongodb for mattyw mp273544
UNIT OK: passed
charm_amulet_test #7208 mongodb for mattyw mp273544
AMULET OK: passed
Build: http://
| Charles Butler (lazypower) wrote : | # |
+1 LGTM
Approved and merged. Thanks for the contribution Mattyw

charm_lint_check #11389 mongodb for mattyw mp273544
LINT OK: passed
Build: http:// 10.245. 162.77: 8080/job/ charm_lint_ check/11389/