diff --git a/README.md b/README.md index 35017df9..2756affa 100644 --- a/README.md +++ b/README.md @@ -110,7 +110,7 @@ Note: Passing credentials via the command line exposes the credentials in your s ## Additional config.rb & knife.rb Configuration Options -The following configuration options may be set in your `knife.rb`: +The following configuration options may be set in your configuration file: - flavor - image - availability_zone @@ -144,7 +144,7 @@ knife-ec2 now includes the ability to retrieve the encrypted data bag secret and - `http` or `https` based: 'http://example.com/chef/my-validator.pem' - `s3` based: 's3://chef/my-validator.pem' -### Use the following configuration options in `knife.rb` to set the source URLs: +### Use the following configuration options in `knife.rb` or `config.rb` to set the source URLs: ```ruby knife[:validation_key_url] = 'http://example.com/chef/my-validator.pem' @@ -250,7 +250,7 @@ knife ec2 ami list ``` :Allowed platform windows, ubuntu, debian, centos, fedora, rhel, nginx, turnkey, jumpbox, coreos, cisco, amazon, nessus - ``` + ``` - **Search:** User can search any string into the description column by using -s or --search: @@ -258,7 +258,7 @@ knife ec2 ami list ``` :search_keyword Any String or number - ``` + ``` ### `knife ec2 server list` diff --git a/lib/chef/knife/ec2_base.rb b/lib/chef/knife/ec2_base.rb index cbdf0b11..03398f2a 100644 --- a/lib/chef/knife/ec2_base.rb +++ b/lib/chef/knife/ec2_base.rb @@ -223,7 +223,7 @@ def find_server_platform(server_name) # Custom Warning def custom_warnings! if !config[:region] && Chef::Config[:knife][:region].nil? - ui.warn "No region was specified in knife.rb or as an argument. The default region, us-east-1, will be used:" + ui.warn "No region was specified in knife.rb/config.rb or as an argument. The default region, us-east-1, will be used:" end end diff --git a/lib/chef/knife/ec2_server_create.rb b/lib/chef/knife/ec2_server_create.rb index 5145a0c0..9e8bfbb5 100644 --- a/lib/chef/knife/ec2_server_create.rb +++ b/lib/chef/knife/ec2_server_create.rb @@ -872,7 +872,7 @@ def validate! if Chef::Config[:knife].keys.include? :aws_ssh_key_id Chef::Config[:knife][:ssh_key_name] = Chef::Config[:knife][:aws_ssh_key_id] if !Chef::Config[:knife][:ssh_key_name] Chef::Config[:knife].delete(:aws_ssh_key_id) - ui.warn("Use of aws_ssh_key_id option in knife.rb config is deprecated, use ssh_key_name option instead.") + ui.warn("Use of aws_ssh_key_id option in knife.rb/config.rb config is deprecated, use ssh_key_name option instead.") end super([:image, :ssh_key_name, :aws_access_key_id, :aws_secret_access_key]) @@ -930,13 +930,13 @@ def validate! end if config[:security_groups] && config[:security_groups].class == String - ui.error("Invalid value type for knife[:security_groups] in knife configuration file (i.e knife.rb). Type should be array. e.g - knife[:security_groups] = ['sgroup1']") + ui.error("Invalid value type for knife[:security_groups] in knife configuration file (i.e knife.rb/config.rb). Type should be array. e.g - knife[:security_groups] = ['sgroup1']") exit 1 end - # Validation for security_group_ids passed through knife.rb. It will raise error if values are not provided in Array. + # Validation for security_group_ids passed through knife.rb/config.rb. It will raise error if values are not provided in Array. if locate_config_value(:security_group_ids) && locate_config_value(:security_group_ids).class == String - ui.error("Invalid value type for knife[:security_group_ids] in knife configuration file (i.e knife.rb). Type should be array. e.g - knife[:security_group_ids] = ['sgroup1']") + ui.error("Invalid value type for knife[:security_group_ids] in knife configuration file (i.e knife.rb/config.rb). Type should be array. e.g - knife[:security_group_ids] = ['sgroup1']") exit 1 end diff --git a/lib/chef/knife/ec2_server_list.rb b/lib/chef/knife/ec2_server_list.rb index f0ff26de..0ef584df 100644 --- a/lib/chef/knife/ec2_server_list.rb +++ b/lib/chef/knife/ec2_server_list.rb @@ -101,7 +101,7 @@ def run output_column_count = server_list.length if !config[:region] && Chef::Config[:knife][:region].nil? - ui.warn "No region was specified in knife.rb or as an argument. The default region, us-east-1, will be used:" + ui.warn "No region was specified in knife.rb/config.rb or as an argument. The default region, us-east-1, will be used:" end servers = connection.servers diff --git a/spec/unit/ec2_ami_list_spec.rb b/spec/unit/ec2_ami_list_spec.rb index 416baced..25b9072b 100644 --- a/spec/unit/ec2_ami_list_spec.rb +++ b/spec/unit/ec2_ami_list_spec.rb @@ -115,7 +115,7 @@ ec2_servers = double() allow(ec2_connection).to receive(:describe_images).and_return(@describe_images_format) allow(knife_ec2_ami_list).to receive(:validate!) - expect(knife_ec2_ami_list.ui).to receive(:warn).with("No region was specified in knife.rb or as an argument. The default region, us-east-1, will be used:") + expect(knife_ec2_ami_list.ui).to receive(:warn).with("No region was specified in knife.rb/config.rb or as an argument. The default region, us-east-1, will be used:") knife_ec2_ami_list.run end end diff --git a/spec/unit/ec2_flavor_list_spec.rb b/spec/unit/ec2_flavor_list_spec.rb index 37df1e0d..89c4fff3 100644 --- a/spec/unit/ec2_flavor_list_spec.rb +++ b/spec/unit/ec2_flavor_list_spec.rb @@ -45,7 +45,7 @@ ec2_flavors = double(sort_by: []) allow(ec2_connection).to receive(:flavors).and_return(ec2_flavors) allow(knife_flavor_list).to receive(:validate!) - expect(knife_flavor_list.ui).to receive(:warn).with("No region was specified in knife.rb or as an argument. The default region, us-east-1, will be used:") + expect(knife_flavor_list.ui).to receive(:warn).with("No region was specified in knife.rb/config.rb or as an argument. The default region, us-east-1, will be used:") knife_flavor_list.run end end diff --git a/spec/unit/ec2_server_create_spec.rb b/spec/unit/ec2_server_create_spec.rb index 9b96d280..456d987d 100644 --- a/spec/unit/ec2_server_create_spec.rb +++ b/spec/unit/ec2_server_create_spec.rb @@ -616,7 +616,7 @@ end it "gives warning message and creates the attribute with the required name" do - expect(knife_ec2_create.ui).to receive(:warn).with("Use of aws_ssh_key_id option in knife.rb config is deprecated, use ssh_key_name option instead.") + expect(knife_ec2_create.ui).to receive(:warn).with("Use of aws_ssh_key_id option in knife.rb/config.rb config is deprecated, use ssh_key_name option instead.") knife_ec2_create.validate! expect(Chef::Config[:knife][:ssh_key_name]).to eq(@aws_key) end @@ -631,7 +631,7 @@ end it "gives warning message and gives preference to CLI value over knife config's value" do - expect(knife_ec2_create.ui).to receive(:warn).with("Use of aws_ssh_key_id option in knife.rb config is deprecated, use ssh_key_name option instead.") + expect(knife_ec2_create.ui).to receive(:warn).with("Use of aws_ssh_key_id option in knife.rb/config.rb config is deprecated, use ssh_key_name option instead.") knife_ec2_create.validate! expect(Chef::Config[:knife][:ssh_key_name]).to_not eq(@aws_key) end diff --git a/spec/unit/ec2_server_list_spec.rb b/spec/unit/ec2_server_list_spec.rb index b18ce283..fb6e80d1 100644 --- a/spec/unit/ec2_server_list_spec.rb +++ b/spec/unit/ec2_server_list_spec.rb @@ -40,7 +40,7 @@ ec2_servers = double() allow(ec2_connection).to receive(:servers).and_return(ec2_servers) allow(knife_ec2_list).to receive(:validate!) - expect(knife_ec2_list.ui).to receive(:warn).with("No region was specified in knife.rb or as an argument. The default region, us-east-1, will be used:") + expect(knife_ec2_list.ui).to receive(:warn).with("No region was specified in knife.rb/config.rb or as an argument. The default region, us-east-1, will be used:") knife_ec2_list.run end end