Merge lp:~chipaca/snappy/config-modules into lp:~snappy-dev/snappy/snappy-moved-to-github
| Status: | Merged |
|---|---|
| Approved by: | John Lenton on 2015-10-20 |
| Approved revision: | 782 |
| Merged at revision: | 791 |
| Proposed branch: | lp:~chipaca/snappy/config-modules |
| Merge into: | lp:~snappy-dev/snappy/snappy-moved-to-github |
| Diff against target: |
444 lines (+296/-10) 2 files modified
coreconfig/config.go (+107/-6) coreconfig/config_test.go (+189/-4) |
| To merge this branch: | bzr merge lp:~chipaca/snappy/config-modules |
| Related bugs: |
| Reviewer | Review Type | Date Requested | Status |
|---|---|---|---|
| Oliver Grawert | Approve on 2015-10-20 | ||
| Michael Vogt | 2015-10-20 | Approve on 2015-10-20 | |
|
Review via email:
|
|||
Commit Message
"modules" ubuntu-core config handling
Description of the Change
This adds the "config" option to ubuntu-core config.
It's the first one of these that isn't just a blob of the file, so please comment on the api as exposed.
You add a module to be loaded at boot via:
echo "config: {ubuntu-core: {modules: {potato: true}}}" | uPOST /1.0/packages/
and you remove it by setting it to "false".
Another api that was considered was simply setting it to a list. Downside is, adding a single module to a system that already has a few gets tedious; upside, simpler.
Please do comment.
| John Lenton (chipaca) wrote : | # |
| John Lenton (chipaca) wrote : | # |
(unless you're actually reviewing and not feedback'ing on the feature; in that case, do not ignore)
| John Lenton (chipaca) wrote : | # |
I'll go have breakfast now.
| Oliver Grawert (ogra) wrote : | # |
i wouldnt make the module a boolean but a list i.e.:
echo "config: {ubuntu-core: {modules: {potato, banana, apple}}}" | uPOST /1.0/packages/
to result in /etc/modules-
# DO NOT EDIT THIS FILE
# it is auto-generated, and will be overwritten.
potato
banana
apple
i imagine that we have the case more often that you need to load more than one module (especially for firewalling there are a ton of options to manually enable by loading the respective module), the list saves you from having to use multiple commands for this.
| John Lenton (chipaca) wrote : | # |
it's a map, so with this api you'd do*
echo "config: {ubuntu-core: {modules: {potato: true, banana: true, apple: true}}}" | uPOST /1.0/packages/
to have that conf.
The advantage of this is that if you later want to change banana for ip6_banana, you do
echo "config: {ubuntu-core: {modules: {banana: false, ip6_banana: true}}}" | uPOST /1.0/packages/
The alternative api would be, to set them up:
echo "config: {ubuntu-core: {modules: [potato, banana, apple]}}" | uPOST /1.0/packages/
and then to change it you've got to specify them all again:
echo "config: {ubuntu-core: {modules: [potato, ip6_banana, apple]}}" | uPOST /1.0/packages/
* i'd need to double-check that yaml, but you get the idea
| John Lenton (chipaca) wrote : | # |
oh, in all the above, "snappy config ubuntu-core -" instead of uPOST works too ;)
| Oliver Grawert (ogra) wrote : | # |
oh, thanks, i didnt get that you can make a list out of the booleans :)
we should make sure thats clear in the docs ;)
| John Lenton (chipaca) wrote : | # |
Please do not top-approve until the relevant ubuntu-core-config branch lands.
| John Lenton (chipaca) wrote : | # |
Gustavo has indicated that it would be better to expose this as an additive list, with optional removal being indicated with a prefixed dash.
| Gustavo Niemeyer (niemeyer) wrote : | # |
Indeed.. it feels like an additive list would be more friendly to write and read, and it would also allow snappy itself to make changes to that list without it being unintendedly overwritten by snaps that were not even aware that they were killing them.
I've also added a few more notes inline:
| John Lenton (chipaca) wrote : | # |
gustavo, snaps don't call this, system integrators and administrators call this
| John Lenton (chipaca) wrote : | # |
Refactored into an additive list thing.
echo "config: {ubuntu-core: {modules: [potato, banana, apple]}}" | sudo snappy config ubuntu-core -
to add those to the list, and
echo "config: {ubuntu-core: {modules: [-banana, ip6_banana]}}" | sudo snappy config ubuntu-core -
to remove them
| Gustavo Niemeyer (niemeyer) wrote : | # |
More inline responses..
| Jamie Strandboge (jdstrand) wrote : | # |
FWIW, I much prefer the additive list over the boolean approach.
- 782. By John Lenton on 2015-10-20
-
couple more tweaks


Oh, I also made some non-related changes to config. Please ignore those: switching ioutil.WriteFile to helpers. AtomicWriteFile , and its->it's.