Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updated descriptions to mention config.rb #555

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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'
Expand Down Expand Up @@ -250,15 +250,15 @@ 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:

**command:** knife ec2 ami list -s (search_keyword)

```
:search_keyword Any String or number
```
```

### `knife ec2 server list`

Expand Down
2 changes: 1 addition & 1 deletion lib/chef/knife/ec2_base.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
8 changes: 4 additions & 4 deletions lib/chef/knife/ec2_server_create.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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])
Expand Down Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion lib/chef/knife/ec2_server_list.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion spec/unit/ec2_ami_list_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion spec/unit/ec2_flavor_list_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions spec/unit/ec2_server_create_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
2 changes: 1 addition & 1 deletion spec/unit/ec2_server_list_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down