-
Notifications
You must be signed in to change notification settings - Fork 202
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
Add support for looking up AMIs with the EC2 API #177
Conversation
Is there an update on this? Would love to see it merged! |
Hi, 👍 for this PR, it'll be very useful. Maybe add an environment variable for image_id too. Thanks |
Hey @puckel, if you want to set the image_id with an environment variable then you can add something like the following to your platforms:
- name: blah
driver:
image_id: "<%= ENV['IMAGE_ID'] %>" where the environment variable |
@tyler-ball any estimate when this might get merged and/or released? It looks like it'll address several open issues. #174 #117 #147 |
Sorry this got dropped. The code and tests look good, but I see a few missing features to add before this can be merged. First, while it is nice to use an existing key I think that will be confusing in the long run. Instead of overloading if config[:image_id].nil? && config[:image_search].nil?
config[:image_id] = instance.driver.default_ami
end Second, this PR needs to also update the README to outline how to leverage this new logic. We should leave the existing |
@zl4bv do you think your going to get round to fixing this with tylers comments? |
@willejs sorry, yes, I will try to get it done some time this week. |
Addresses requirement that image_id be set: ``` Kitchen::Driver::Ec2#finalize_config! when image_id is not provided when image_search is provided searches for an image ID Failure/Error: driver.finalize_config!(instance) Kitchen::UserError: Kitchen::Driver::Ec2str#config[:image_id] cannot be blank # /home/travis/.rvm/gems/ruby-1.9.3-p551/gems/test-kitchen-1.4.2/lib/kitchen/configurable.rb:434:in `block in required_config' # /home/travis/.rvm/gems/ruby-1.9.3-p551/gems/test-kitchen-1.4.2/lib/kitchen/configurable.rb:288:in `call' # /home/travis/.rvm/gems/ruby-1.9.3-p551/gems/test-kitchen-1.4.2/lib/kitchen/configurable.rb:288:in `block in validate_config!' # /home/travis/.rvm/gems/ruby-1.9.3-p551/gems/test-kitchen-1.4.2/lib/kitchen/configurable.rb:287:in `each' # /home/travis/.rvm/gems/ruby-1.9.3-p551/gems/test-kitchen-1.4.2/lib/kitchen/configurable.rb:287:in `validate_config!' # /home/travis/.rvm/gems/ruby-1.9.3-p551/gems/test-kitchen-1.4.2/lib/kitchen/configurable.rb:55:in `finalize_config!' # ./lib/kitchen/driver/ec2.rb:163:in `finalize_config!' # ./spec/kitchen/driver/ec2_spec.rb:125:in `block (5 levels) in <top (required)>' ```
Hey @tyler-ball (and other collaborators), I've made the suggested changes. Do you think it is ready to be merged now? |
Add support for looking up AMIs with the EC2 API
YES! Can you cut a release please @tyler-ball |
Hi, |
new release FTW! |
Addresses #147. When a hash of filters are provided for the image_id it will try to find the AMI with the most recent creation date that matches the supplied filters.
Example usage (.kitchen.yml):
Example usage (amis.json):