diff options
author | Tom Duffield <tom@chef.io> | 2016-10-25 15:34:10 -0500 |
---|---|---|
committer | Tom Duffield <tom@chef.io> | 2016-10-28 14:20:49 -0500 |
commit | 1c7392cb2f002f700cbae31936512e7d73ae4a5d (patch) | |
tree | abbf6814a22dc1049b19a6c0ab32de3b6d42f08f /spec/integration/knife | |
parent | daa20d6b7e6afb066760b7e7c59f1d9f2b4a409b (diff) | |
download | chef-1c7392cb2f002f700cbae31936512e7d73ae4a5d.tar.gz |
Add the `--field-separator` flag to knife show commands
For the commands that allow you to filter which attributes it shows you
using the `--attribute` flag, add the `--field-separator` flag to allow
the user to customize which character(s) they want to use to deliniate the
attribute hierarchy.
```shell
knife node show NODE -S: -a "packages:Chef Client v12.12.15"
```
Signed-off-by: Tom Duffield <tom@chef.io>
Diffstat (limited to 'spec/integration/knife')
-rw-r--r-- | spec/integration/knife/environment_show_spec.rb | 28 |
1 files changed, 24 insertions, 4 deletions
diff --git a/spec/integration/knife/environment_show_spec.rb b/spec/integration/knife/environment_show_spec.rb index e74bf6d05d..56422dc1a5 100644 --- a/spec/integration/knife/environment_show_spec.rb +++ b/spec/integration/knife/environment_show_spec.rb @@ -26,7 +26,7 @@ describe "knife environment show", :workstation do when_the_chef_server "has some environments" do before do environment "b", { - "default_attributes" => { "foo" => "bar" }, + "default_attributes" => { "foo" => "bar", "baz" => { "raz.my" => "mataz" } }, } end @@ -36,6 +36,8 @@ describe "knife environment show", :workstation do chef_type: environment cookbook_versions: default_attributes: + baz: + raz.my: mataz foo: bar description: json_class: Chef::Environment @@ -46,11 +48,29 @@ EOM # rubocop:enable Style/TrailingWhitespace it "shows the requested attribute of an environment" do - pending "KnifeSupport doesn't appear to pass this through correctly" - knife("environment show b -a foo").should_succeed <<EOM + knife("environment show b -a default_attributes").should_succeed <<EOM b: - foo: bar + default_attributes: + baz: + raz.my: mataz + foo: bar EOM end + + it "shows the requested nested attribute of an environment" do + knife("environment show b -a default_attributes.baz").should_succeed <<EON +b: + default_attributes.baz: + raz.my: mataz +EON + end + + it "shows the requested attribute of an environment with custom field separator" do + knife("environment show b -S: -a default_attributes:baz").should_succeed <<EOT +b: + default_attributes:baz: + raz.my: mataz +EOT + end end end |