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

Feature/nil default options #48

Closed
Closed
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
3 changes: 2 additions & 1 deletion lib/chef/knife/server_bootstrap_ec2.rb
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,8 @@ def ec2_bootstrap
ENV['NO_TEST'] = "1" if config[:no_test]
bootstrap = Chef::Knife::Ec2ServerCreate.new
Chef::Knife::Ec2ServerCreate.options.keys.each do |attr|
bootstrap.config[attr] = config_val(attr)
val = config_val(attr)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Indentation doesn't match

bootstrap.config[attr] = val unless ((val.is_a?(Array) and val[1].nil?) or val.nil?)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

works, but is impenetrable. how about:

# as config_vals may be either pairs or simple values, skip if it looks like
#   [:attr, nil]
# or
#   nil
unless ((val.is_a?(Array) and val[1].nil?) or val.nil?)
  bootstrap.config[attr] = val
end

end
bootstrap.config[:tags] = bootstrap_tags
bootstrap.config[:distro] = bootstrap_distro
Expand Down