Merge lp:~themue/juju-core/029-config-get-all into lp:~go-bot/juju-core/trunk
Proposed by
Frank Mueller
Status: | Merged |
---|---|
Approved by: | Frank Mueller |
Approved revision: | no longer in the source branch. |
Merged at revision: | 1332 |
Proposed branch: | lp:~themue/juju-core/029-config-get-all |
Merge into: | lp:~go-bot/juju-core/trunk |
Diff against target: |
250 lines (+119/-11) 3 files modified
worker/uniter/jujuc/config-get.go (+22/-1) worker/uniter/jujuc/config-get_test.go (+92/-10) worker/uniter/jujuc/util_test.go (+5/-0) |
To merge this branch: | bzr merge lp:~themue/juju-core/029-config-get-all |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
William Reade (community) | Approve | ||
Review via email: mp+170789@code.launchpad.net |
Commit message
uniter/jujuc: added arg --all to config-get
Actually config-get behaves different to pyjuju and writes
all configuration keys, even if their value is nil. Now
the default behavior is like in pyjuju, empty values are
filtered. The additional argument --all (or -a) allows
the output of all keys.
Description of the change
uniter/jujuc: added arg --all to config-get
Actually config-get behaves different to pyjuju and writes
all configuration keys, even if their value is nil. Now
the default behavior is like in pyjuju, empty values are
filtered. The additional argument --all (or -a) allows
the output of all keys.
To post a comment you must log in.
Reviewers: mp+170789_ code.launchpad. net,
Message:
Please take a look.
Description:
uniter/jujuc: added arg --all to config-get
Actually config-get behaves different to pyjuju and writes
all configuration keys, even if their value is nil. Now
the default behavior is like in pyjuju, empty values are
filtered. The additional argument --all (or -a) allows
the output of all keys.
https:/ /code.launchpad .net/~themue/ juju-core/ 029-config- get-all/ +merge/ 170789
(do not edit description out of merge proposal)
Please review this at https:/ /codereview. appspot. com/10441044/
Affected files: uniter/ jujuc/config- get.go uniter/ jujuc/config- get_test. go uniter/ jujuc/util_ test.go
A [revision details]
M worker/
M worker/
M worker/
Index: [revision details] 20130620172218- jwl9sp71dmuqty4 r
=== added file '[revision details]'
--- [revision details] 2012-01-01 00:00:00 +0000
+++ [revision details] 2012-01-01 00:00:00 +0000
@@ -0,0 +1,2 @@
+Old revision: tarmac-
+New revision: <email address hidden>
Index: worker/ uniter/ jujuc/config- get.go uniter/ jujuc/config- get.go' uniter/ jujuc/config- get.go 2013-06-10 21:04:37 +0000 uniter/ jujuc/config- get.go 2013-06-21 11:16:43 +0000
=== modified file 'worker/
--- worker/
+++ worker/
@@ -13,6 +13,7 @@
cmd.CommandBase
ctx Context
Key string // The key to show. If empty, show all.
+ all bool
out cmd.Output
}
@@ -31,6 +32,8 @@
func (c *ConfigGetCommand) SetFlags(f *gnuflag.FlagSet) { AddFlags( f, "smart", cmd.DefaultForm atters)
c.out.
+ f.BoolVar(&c.all, "a", false, "write also keys without values")
+ f.BoolVar(&c.all, "all", false, "")
}
func (c *ConfigGetCommand) Init(args []string) error { args[1: ])
@@ -38,6 +41,7 @@
return nil
}
c.Key = args[0]
+
return cmd.CheckEmpty(
}
@@ -48,6 +52,13 @@
}
var value interface{}
if c.Key == "" {
+ if !c.all {
+ for k, v := range settings {
+ if v == nil {
+ delete(settings, k)
+ }
+ }
+ }
value = settings
} else {
value, _ = settings[c.Key]
Index: worker/ uniter/ jujuc/config- get_test. go uniter/ jujuc/config- get_test. go' uniter/ jujuc/config- get_test. go 2013-05-02 15:55:42 +0000 uniter/ jujuc/config- get_test. go 2013-06-21 11:16:43 +0000
=== modified file 'worker/
--- worker/
+++ worker/
@@ -18,7 +18,12 @@
var _ = Suite(& ConfigGetSuite{ })
-var configGetYamlMap = "monsters: false\nspline- reticulation: 45\ntitle: reticulation: 45\ntitle: reticulation: :false, "spline- reticulation" :45,"title" :"My "username" :"admin001" }` + "\n" :null," monsters" :false, "spline- reticulation" :45,"title" :"My "username" :"admin001" }` + "\n"
My Title\nusername: admin001\n"
+var (
+ configGetYamlMap = "monsters: false\nspline-
My Title\nusername: admin001\n"
+ configGetYamlMapAll = "empty: null\nmonsters: false\nspline-
45\ntitle: My Title\nusername: admin001\n"
+ configGetJsonMap =
`{"monsters"
Title",
+ configGetJsonMapAll =
`{"empty"
Title",
+)
var configGetTests = []struct { "--format" , "json", "missing"}, "null\n"}, "--format" , "yaml"}, configGetYamlMap}, "--format" , "json"},
args []string
@@ -35,7 +40,9 @@
{[]string{
{nil, configGetYamlMap},
{[]string{
- {[]string{
`{"mo...