Skip to content

Addedd disable_api_termination option along with RSpecs.#427

Merged
NimishaS merged 4 commits into
chef:masterfrom
MsysTechnologiesllc:ali/add_disable_api_termination_option
Jul 26, 2016
Merged

Addedd disable_api_termination option along with RSpecs.#427
NimishaS merged 4 commits into
chef:masterfrom
MsysTechnologiesllc:ali/add_disable_api_termination_option

Conversation

@Aliasgar16

Copy link
Copy Markdown

In-progress.

@Aliasgar16

Copy link
Copy Markdown
Author

Done.

Comment thread Gemfile Outdated
source 'https://rubygems.org'
gemspec

gem 'rack', '1.6.4'

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Generally we want to use the most optimistic constraint that we can and not pin to a specific version in the Gemfile. Here is how we're handling the rack/ruby version problem in chef:

gem "rack", "< 2.0" # 2.0 requires Ruby 2.2+

By the way, we are starting soon on getting Chef on Ruby 2.2+

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

right...will make the change

@btm

btm commented Jul 20, 2016

Copy link
Copy Markdown
Contributor

Is it possible to make disable_api_termination=true the default for an AWS account? If so, would using knife ec2 without knowing about this new feature start overriding that and setting disable_api_termination=false for those people unexpectedly?

If not, 👍 on this PR as is.

@Aliasgar16

Copy link
Copy Markdown
Author

@btm The disable-api-termination attribute is set on per instance level and not on AWS account level. knife ec2 server create command will set disable-api-termination attribute for the ec2 instance it is going to create and won't override any attribute on the account level or for any other instance. For users unaware of this new feature, it would be safer to keep default value of disable-api-termination attribute to false.

@Aliasgar16

Aliasgar16 commented Jul 21, 2016

Copy link
Copy Markdown
Author

@btm I have fixed the review comments also added more checks and RSpecs for spot instance request with disable-api-termination option as Termination Protection cannot be enabled for spot instances. You can refer this ec2 doc link for more details.

end

## Termination Protection cannot be enabled for spot instances ##
server_def[:disable_api_termination] = locate_config_value(:disable_api_termination) if locate_config_value(:spot_price).nil?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I'd drop if locate_config_value(:spot_price).nil? here. The check above should prevent this from being needed. If it didn't, this would cause odd behavior; the disable api termination feature would not be enabled even if set but we wouldn't tell the user that.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

@btm this check is just to prevent disable-api-termination option (irrespective of its value) from being getting passed in the server_definition of spot instance request as spot instance does not support this feature. The disable-api-termination option will only get passed in the server_definition of non-spot instance request. Also, even if user set this option disable-api-termination in a spot instance request then he/she will get error as spot-price and disable-api-termination options cannot be passed together as 'Termination Protection' cannot be enabled for spot instances.. You can check this validation code here.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Okay. Might add clarity to set the comment to something like "Cannot pass disable_api_termination to API when using spot instances".

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

sure...will change the comment.

@btm

btm commented Jul 25, 2016

Copy link
Copy Markdown
Contributor

👍

aliasgar16 added 4 commits July 26, 2016 12:17
…stall failure on ruby version less than 2.2.
…uest with disable_api_termination option as termination protection cannot be enabled for spot instances.
…on option against the spot instance request for better clarity.
@NimishaS NimishaS force-pushed the ali/add_disable_api_termination_option branch from ca0dad4 to b56f6d6 Compare July 26, 2016 06:50
@NimishaS NimishaS merged commit ad375b1 into chef:master Jul 26, 2016
@NimishaS NimishaS deleted the ali/add_disable_api_termination_option branch July 26, 2016 06:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants