knife-ec2 0.10.0 → 0.11.0.rc.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,15 +1,7 @@
1
1
  ---
2
- !binary "U0hBMQ==":
3
- metadata.gz: !binary |-
4
- ZjUzN2RiNmIwZTVkODIxMTU0ODUzZmYwYWY0YmEyNGUyNGRlYWZlMQ==
5
- data.tar.gz: !binary |-
6
- ZjY0YTZjNjY4MWU4OWMzNjkyZjAxZDg4MmM3ZjBkYTA4YzMyNjZmZg==
2
+ SHA1:
3
+ metadata.gz: b9614eea778e1b96eac6b905998953099a1e117e
4
+ data.tar.gz: 05fbdb2db4d97a775228b2b16cab1dd283408413
7
5
  SHA512:
8
- metadata.gz: !binary |-
9
- OGMxOGVkMzU0ZTNmNDczZDQ1NzNhMDRmMDkwYTY0NWRiYTI3N2YxYzdhNTg2
10
- MmU0YzhhYTc4MDkxMTgxMWJlNjliOTc3Y2YzOGZlYzE3NmMwOWE4NDRlNTI1
11
- NDFiMGU3YjM0ZTViNjlhNmIyOGE5MTk0ZWNmODVlMWRiMmNlMzY=
12
- data.tar.gz: !binary |-
13
- MWIyMDRjZDUxODBmMmFmYTQzMzZiNjU3YTJhZjcyM2U3MTAyZmIyYzNmMjM5
14
- N2FlOGU1MmI5ODk1ODI3ZGMzMjk2YTNmYzdjNTdmZmFlMDZmYzU3NGRjMmZh
15
- MTczZjQwYzdiNTY4NWY2YWY5OGMxMGEwYTNiZjIzNWVkNDI1YmI=
6
+ metadata.gz: d51710f175d77d528c12720bc1b3251f95f28c8b4f47292bfa66dc735b1b6f5c051532d4b50577dbe1566e91f5e7002fdfc005c9bc57f9b45e98f71be589d85b
7
+ data.tar.gz: fb3c50cb5f6832cc8bb9cbbd22b163ee89d5664c236a860ce05a0e446f13df8c569a9ae57f649af855ed8d26e5d5cd997ed421fc3c19c9f7214ccbb02e26fb54
data/CHANGELOG.md CHANGED
@@ -4,17 +4,22 @@ Note: this log contains only changes from knife-ec2 release 0.8.0 and later
4
4
  -- it does not contain the changes from prior releases. To view change history
5
5
  prior to release 0.8.0, please visit the [source repository](https://github.com/opscode/knife-ec2/commits).
6
6
 
7
- ## Unreleased changes
8
- None.
9
-
10
- ## Latest release: 0.10.0
11
- * [Issue:#221](https://github.com/opscode/knife-ec2/issues/221) Use IAM role for credentials
7
+ ## Latest release: 0.11.0 (2015-05-21)
8
+ * [knife-ec2:#293](https://github.com/chef/knife-ec2/pull/293) s3_source: Lazy load fog library
9
+ * [knife-ec2:#284](https://github.com/chef/knife-ec2/pull/284) Enable Spot Pricing
10
+ * [knife-ec2:#280](https://github.com/chef/knife-ec2/pull/280) Support for EBS volume encryption in knife-ec2 server create options
11
+ * [knife-ec2:#273](https://github.com/chef/knife-ec2/pull/273) Remove -s option for data bag secret and subnets
12
+ * [knife-ec2:#268](https://github.com/chef/knife-ec2/pull/268) Updated gemspec to use fog v1.25
13
+ * [knife-ec2:#265](https://github.com/chef/knife-ec2/pull/265) showing error message for incorrect option input
14
+ * [knife-ec2:#261](https://github.com/chef/knife-ec2/pull/261) Remove 'em-winrm' gem dependency
15
+
16
+ ## Release: 0.10.0.rc.1 (2014-10-08)
12
17
  * [Issue:#237](https://github.com/opscode/knife-ec2/issues/237) Provide a way to the validation key and data bag secret from S3
13
18
  * [Issue:#243](https://github.com/opscode/knife-ec2/issues/243) Support new AWS CLI configuration file format
14
19
  * Update `knife-windows` gem dependency to `knife-windows 0.8.rc.0` for improved Windows authentication integration
15
20
  * Update `fog` gem dependency to `fog 1.23.0`
16
21
  * Provisioned IOPS support via the `--provisioned-iops` and `--ebs-volume-type` options
17
- * [KNIFE-464](https://tickets.opscode.com/browse/KNIFE-466) Knife ec2 should use gateway from net::ssh config if available
22
+ * [KNIFE-466](https://tickets.opscode.com/browse/KNIFE-466) Knife ec2 should use gateway from net::ssh config if available
18
23
  * [KNIFE-422](https://tickets.opscode.com/browse/KNIFE-422) Knife ec2 server create doesn't respect identity file of gateway server from ssh\_config
19
24
 
20
25
  ## Release: 0.8.0 (2014-03-10)
data/CONTRIBUTIONS.md CHANGED
@@ -10,3 +10,4 @@ Example Contribution:
10
10
  * **johnbarney**: Added ability to use IAM role credentials
11
11
  * **mdellanoce**: Added ability to use SSH config (KNIFE-466)
12
12
  * **victorlin**: Added ability to pass identify file for SSH Gateway on the command line (KNIFE-422)
13
+ * **erikfrey**: Support Spot Instances
data/DOC_CHANGES.md CHANGED
@@ -22,13 +22,8 @@ provisioned IOPS rate given as an argument to this option. It is only valid if
22
22
  the EBS volume type is `io1` as specified by the `--ebs-volume-type` option
23
23
  for this plugin.
24
24
 
25
- ## Option `--use-iam-profile` for server create command
26
- This option allows the `knife-ec2 server create` command executing on an EC2 instance to use
27
- IAM role credentials available to the instance as the AWS credentials for
28
- creating new instances. Specify the IAM profile that the instance should use
29
- as an argument to this option.
30
-
31
25
  ## Use of secret parameters from S3 for `server create` command
26
+
32
27
  The options below allow some secrets used with the `knife ec2 server create`
33
28
  command to be specified as URL's. Examples are also given in the README.md.
34
29
 
@@ -52,5 +47,9 @@ for complex command line invocations.
52
47
  You can pass an SSH key to be used for authenticating to the SSH Gateway with
53
48
  the --ssh-gateway-identity option.
54
49
 
50
+ ## Support Spot Instances
51
+ You can now request a spot instance at a specific price.
55
52
 
56
-
53
+ ### Option `--spot-price`
54
+ This option allows the maximum desired spot price to be specified. It takes a
55
+ price in US dollars.
data/README.md CHANGED
@@ -12,6 +12,8 @@ This is the official Chef Knife plugin for EC2. This plugin gives knife the abil
12
12
  * IRC: `#chef` and `#chef-hacking` on Freenode
13
13
  * Mailing list: <http://lists.opscode.com>
14
14
 
15
+ Note: Documentation needs to be updated in chef docs
16
+
15
17
  Installation
16
18
  ------------
17
19
  If you're using bundler, simply add Chef and Knife EC2 to your `Gemfile`:
@@ -60,7 +62,7 @@ you already have a file with these keys somewhere in this format:
60
62
 
61
63
  AWSAccessKeyId=Your AWS Access Key ID
62
64
  AWSSecretKey=Your AWS Secret Access Key
63
-
65
+
64
66
 
65
67
  The new config file format used by Amazon's command line tools is also supported:
66
68
 
@@ -71,7 +73,7 @@ The new config file format used by Amazon's command line tools is also supported
71
73
  In this case, you can point the <tt>aws_credential_file</tt> option to
72
74
  this file in your <tt>knife.rb</tt> file, like so:
73
75
 
74
- ```ruby
76
+ ```ruby
75
77
  knife[:aws_credential_file] = "/path/to/credentials/file/in/above/format"
76
78
  ```
77
79
 
@@ -131,7 +133,8 @@ Provisions a new server in the Amazon EC2 and then perform a Chef bootstrap
131
133
  knife ec2 server create -I ami-d0f89fb9 --ssh-key your-public-key-id -f m1.medium --ssh-user ubuntu --identity-file ~/.ssh/your-private-key
132
134
 
133
135
  # A Windows instance via the WinRM protocol -- --ssh-key is still required due to EC2 API operations that need it to grant access to the Windows instance
134
- knife ec2 server create -I ami-173d747e -G windows -f m1.medium --user-data ~/your-user-data-file -x '.\a_local_user' -P 'yourpassword' --ssh-key your-public-key-id
136
+ # `--spot-price` option lets you specify the spot pricing
137
+ knife ec2 server create -I ami-173d747e -G windows -f m1.medium --user-data ~/your-user-data-file -x '.\a_local_user' -P 'yourpassword' --ssh-key your-public-key-id --spot-price price-in-USD
135
138
 
136
139
  View additional information on configuring Windows images for bootstrap in the documentation for [knife-windows](http://docs.opscode.com/plugin_knife_windows.html).
137
140
 
@@ -141,13 +144,6 @@ Deletes an existing server in the currently configured AWS account. **By default
141
144
  #### `knife ec2 server list`
142
145
  Outputs a list of all servers in the currently configured AWS account. **Note, this shows all instances associated with the account, some of which may not be currently managed by the Chef server.**
143
146
 
144
- #### `knife ec2 instance data`
145
- Generates instance metadata in meant to be used with Opscode's custom AMIs. This will read your knife configuration `~/.chef/knife.rb` for the validation certificate and Chef server URL to use and output in JSON format. The subcommand also accepts a list of roles/recipes that will be in the node's initial run list.
146
-
147
- **Note**: Using Opscode's custom AMIs reflect an older way of launching instances in EC2 for Chef and should be considered DEPRECATED. Leveraging this plugins's `knife ec2 server create` subcommands with a base AMIs directly from your Linux distribution (ie Ubuntu AMIs from Canonical) is much preferred and more flexible. Although this subcommand will remain, the Opscode custom AMIs are currently out of date.
148
-
149
- In-depth usage instructions can be found on the [Chef Wiki](http://wiki.opscode.com/display/chef/EC2+Bootstrap+Fast+Start+Guide).
150
-
151
147
  License and Authors
152
148
  -------------------
153
149
  - Author:: Adam Jacob (<adam@getchef.com>)
data/RELEASE_NOTES.md CHANGED
@@ -6,16 +6,11 @@ Example Note:
6
6
  ## Example Heading
7
7
  Details about the thing that changed that needs to get included in the Release Notes in markdown.
8
8
  -->
9
- # knife-ec2 0.10.rc.1 release notes:
10
- This release of `knife-ec2` adds improvements around ssh configuration and EC2
11
- IOPS provisioning. There is also a dependency update for the `fog` and `knife-windows` gems
12
- to improve support for additional EC2 capabilities and Windows authentication
13
- enhancements respectively.
9
+ # knife-ec2 0.11.0 release notes:
10
+ This release of `knife-ec2` adds features like spot pricing, EBS volume encryption support and some bug fixes. There is also a dependency update for the `fog` gem and 'em-winrm' dependency is removed.
14
11
 
15
- Our MVP for this release is **Michael Dellanoce**, who contributed improvements
16
- that allow re-use of your existing SSH configuration with knife-ec2,
17
- particularly useful when dealing with SSH gateways. Michael, thank you for
18
- taking the time to develop this feature.
12
+ Special thanks go to contributors **Erik Frey** for addressing
13
+ [knife-ec2:#94](https://github.com/chef/knife-ec2/pull/94) and **Igor Shpakov** for lazy loading fog library.
19
14
 
20
15
  See the [CHANGELOG](https://github.com/opscode/knife-ec2/blob/master/CHANGELOG.md) for a list of all changes in this release, and review
21
16
  [DOC_CHANGES.md](https://github.com/opscode/knife-ec2/blob/master/DOC_CHANGES.md) for relevant documentation updates.
@@ -24,21 +19,20 @@ Issues with `knife-ec2` should be reported in the issue system at
24
19
  https://github.com/opscode/knife-ec2/issues. Learn more about how you can
25
20
  contribute features and bug fixes to `knife-ec2` at https://github.com/opscode/knife-ec2/blob/master/CONTRIBUTING.md.
26
21
 
27
- ## Features added in knife-ec2 0.10.0
22
+ ## Features added in knife-ec2 0.11.0
28
23
 
29
- * Ability to specify validation key and data bag secrets via an S3 bucket
30
- * Support for new AWS client configuration
24
+ * Support for Spot Instances (from Erik Frey)
25
+ * Lazy loading of fog library (from Igor Shpakov)
26
+ * Support for EBS volume encryption in `knife-ec2 server create` options
31
27
  * Added ability to use IAM role credentials
32
- * Provisioned IOPS support
33
- * SSH workstation configuration integration (from Michael Dellanoce and Victor Lin)
34
28
 
35
29
  ## knife-ec2 on RubyGems and Github
36
30
  https://rubygems.org/gems/knife-ec2
37
31
  https://github.com/opscode/knife-ec2
38
32
 
39
- ## Issues fixed in knife-ec2 0.10.0
33
+ ## Issues fixed in knife-ec2 0.11.0
40
34
 
41
- * Update `knife-windows` gem dependency to `knife-windows 0.8.0` for improved Windows authentication integration
42
- * Update `fog` gem dependency to `fog 1.23.0`
43
- * [KNIFE-464](https://tickets.opscode.com/browse/KNIFE-466) Knife ec2 should use gateway from net::ssh config if available
44
- * [KNIFE-422](https://tickets.opscode.com/browse/KNIFE-422) Knife ec2 server create doesn't respect identity file of gateway server from ssh\_config
35
+ * Update `fog` gem dependency to `fog v1.25`
36
+ * Remove 'em-winrm' gem dependency
37
+ * [knife-ec2:#273](https://github.com/chef/knife-ec2/pull/273) Remove -s option for data bag secret and subnets
38
+ * [knife-ec2:#265](https://github.com/chef/knife-ec2/pull/265) showing error message for incorrect option input
data/knife-ec2.gemspec CHANGED
@@ -16,11 +16,11 @@ Gem::Specification.new do |s|
16
16
  s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
17
17
  s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
18
18
 
19
- s.add_dependency 'fog', '~> 1.23.0'
19
+ s.add_dependency 'fog', '~> 1.25.0'
20
20
  s.add_dependency 'knife-windows', '>= 0.8.2'
21
21
 
22
22
  s.add_development_dependency 'mixlib-config', '~> 2.0'
23
- s.add_development_dependency 'chef', '>= 11.16.2'
23
+ s.add_development_dependency 'chef', '>= 11.16.2', '< 12'
24
24
  s.add_development_dependency 'rspec', '~> 2.14'
25
25
  s.add_development_dependency 'rake', '~> 10.1'
26
26
  s.add_development_dependency 'sdoc', '~> 0.3'
@@ -187,7 +187,6 @@ class Chef
187
187
  :proc => lambda { |o| o.split(/[\s,]+/) }
188
188
 
189
189
  option :secret,
190
- :short => "-s SECRET",
191
190
  :long => "--secret ",
192
191
  :description => "The secret key to use to encrypt data bag item values",
193
192
  :proc => lambda { |s| Chef::Config[:knife][:secret] = s }
@@ -209,7 +208,6 @@ class Chef
209
208
  :proc => lambda { |o| JSON.parse(o) }
210
209
 
211
210
  option :subnet_id,
212
- :short => "-s SUBNET-ID",
213
211
  :long => "--subnet SUBNET-ID",
214
212
  :description => "create node in this Virtual Private Cloud Subnet ID (implies VPC mode)",
215
213
  :proc => Proc.new { |key| Chef::Config[:knife][:subnet_id] = key }
@@ -293,6 +291,17 @@ class Chef
293
291
  :description => "Path to the validation key",
294
292
  :proc => proc { |m| Chef::Config[:validation_key_url] = m }
295
293
 
294
+ option :ebs_encrypted,
295
+ :long => "--ebs-encrypted",
296
+ :description => "Enables EBS volume encryption",
297
+ :boolean => true,
298
+ :default => false
299
+
300
+ option :spot_price,
301
+ :long => "--spot-price PRICE",
302
+ :description => "The maximum hourly USD price for the instance",
303
+ :default => nil
304
+
296
305
  def run
297
306
  $stdout.sync = true
298
307
 
@@ -303,7 +312,22 @@ class Chef
303
312
  # For VPC EIP assignment we need the allocation ID so fetch full EIP details
304
313
  elastic_ip = connection.addresses.detect{|addr| addr if addr.public_ip == requested_elastic_ip}
305
314
 
306
- @server = connection.servers.create(create_server_def)
315
+ if locate_config_value(:spot_price)
316
+ spot_request = connection.spot_requests.create(create_server_def)
317
+ msg_pair("Spot Request ID", spot_request.id)
318
+ msg_pair("Spot Request Type", spot_request.request_type)
319
+ msg_pair("Spot Price", spot_request.price)
320
+ print ui.color("Waiting for Spot Request fulfillment: ", :cyan)
321
+ spot_request.wait_for do
322
+ @spinner ||= %w{| / - \\}
323
+ print "\b" + @spinner.rotate!.first
324
+ ready?
325
+ end
326
+ puts("\n")
327
+ @server = connection.servers.get(spot_request.instance_id)
328
+ else
329
+ @server = connection.servers.create(create_server_def)
330
+ end
307
331
 
308
332
  hashed_tags={}
309
333
  tags.map{ |t| key,val=t.split('='); hashed_tags[key]=val} unless tags.nil?
@@ -429,6 +453,18 @@ class Chef
429
453
  msg_pair("Standard or Provisioned IOPS", device_map['volumeType'])
430
454
  msg_pair("IOPS rate", device_map['iops'])
431
455
 
456
+ print "\n#{ui.color("Block devices", :magenta)}\n"
457
+ print "#{ui.color("===========================", :magenta)}\n"
458
+ @server.block_device_mapping.each do |device_map|
459
+ msg_pair("Device Name", device_map['deviceName'])
460
+ msg_pair("Volume ID", device_map['volumeId'])
461
+ msg_pair("Delete on Terminate", device_map['deleteOnTermination'].to_s)
462
+ msg_pair("Standard or Provisioned IOPS", device_map['volumeType'])
463
+ msg_pair("IOPS rate", device_map['iops'])
464
+ print "\n"
465
+ end
466
+ print "#{ui.color("===========================", :magenta)}\n"
467
+
432
468
  if config[:ebs_size]
433
469
  if ami.block_device_mapping.first['volumeSize'].to_i < config[:ebs_size].to_i
434
470
  volume_too_large_warning = "#{config[:ebs_size]}GB " +
@@ -629,6 +665,27 @@ class Chef
629
665
  msg opt_parser
630
666
  exit 1
631
667
  end
668
+
669
+ if(config[:security_groups] && config[:security_groups].class == String)
670
+ 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']")
671
+ exit 1
672
+ end
673
+
674
+ if(config[:security_group_ids] && config[:security_group_ids].class == String)
675
+ 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']")
676
+ exit 1
677
+ end
678
+
679
+ if (locate_config_value(:ebs_encrypted) and !locate_config_value(:flavor))
680
+ ui.error("--ebs_encrypted option requires valid flavor to be specified.")
681
+ exit 1
682
+ elsif (locate_config_value(:ebs_encrypted) and ! %w(m3.medium m3.large m3.xlarge m3.2xlarge c4.large c4.xlarge
683
+ c4.2xlarge c4.4xlarge c4.8xlarge c3.large c3.xlarge c3.2xlarge
684
+ c3.4xlarge c3.8xlarge cr1.8xlarge r3.large r3.xlarge r3.2xlarge
685
+ r3.4xlarge r3.8xlarge i2.xlarge i2.2xlarge i2.4xlarge i2.8xlarge g2.2xlarge).include?(locate_config_value(:flavor)))
686
+ ui.error("--ebs_encrypted option is not supported for #{locate_config_value(:flavor)} flavor.")
687
+ exit 1
688
+ end
632
689
  end
633
690
 
634
691
  def tags
@@ -655,7 +712,8 @@ class Chef
655
712
  :security_group_ids => locate_config_value(:security_group_ids),
656
713
  :flavor_id => locate_config_value(:flavor),
657
714
  :key_name => Chef::Config[:knife][:aws_ssh_key_id],
658
- :availability_zone => locate_config_value(:availability_zone)
715
+ :availability_zone => locate_config_value(:availability_zone),
716
+ :price => locate_config_value(:spot_price)
659
717
  }
660
718
  server_def[:subnet_id] = locate_config_value(:subnet_id) if vpc_mode?
661
719
  server_def[:private_ip_address] = locate_config_value(:private_ip_address) if vpc_mode?
@@ -679,7 +737,12 @@ class Chef
679
737
  end
680
738
 
681
739
  if ami.root_device_type == "ebs"
682
- ami_map = ami.block_device_mapping.first
740
+ if locate_config_value(:ebs_encrypted)
741
+ ami_map = ami.block_device_mapping[1]
742
+ else
743
+ ami_map = ami.block_device_mapping.first
744
+ end
745
+
683
746
  ebs_size = begin
684
747
  if config[:ebs_size]
685
748
  Integer(config[:ebs_size]).to_s
@@ -716,6 +779,7 @@ class Chef
716
779
  'Ebs.VolumeType' => config[:ebs_volume_type],
717
780
  }]
718
781
  server_def[:block_device_mapping].first['Ebs.Iops'] = iops_rate unless iops_rate.empty?
782
+ server_def[:block_device_mapping].first['Ebs.Encrypted'] = true if locate_config_value(:ebs_encrypted)
719
783
  end
720
784
 
721
785
  (config[:ephemeral] || []).each_with_index do |device_name, i|
@@ -801,7 +865,7 @@ class Chef
801
865
  gw_user ||= ssh_gateway_config[:user]
802
866
 
803
867
  # Always use the gateway keys from the SSH Config
804
- gateway_keys = ssh_gateway_config[:keys]
868
+ gateway_keys = ssh_gateway_config[:keys]
805
869
 
806
870
  # Use the keys specificed on the command line if available (overrides SSH Config)
807
871
  if config[:ssh_gateway_identity]
@@ -835,7 +899,7 @@ class Chef
835
899
  if vpc_mode? && !config[:associate_public_ip]
836
900
  server.private_ip_address
837
901
  else
838
- server.dns_name
902
+ server.dns_name || server.public_ip_address
839
903
  end
840
904
  end
841
905
  end
@@ -1,5 +1,3 @@
1
- require 'fog'
2
-
3
1
  class Chef
4
2
  class Knife
5
3
  class S3Source
@@ -30,6 +28,7 @@ class Chef
30
28
  end
31
29
 
32
30
  def fog
31
+ require 'fog' # lazy load the fog library to speed up the knife run
33
32
  @fog ||= Fog::Storage::AWS.new(
34
33
  aws_access_key_id: Chef::Config[:knife][:aws_access_key_id],
35
34
  aws_secret_access_key: Chef::Config[:knife][:aws_secret_access_key]
@@ -1,6 +1,6 @@
1
1
  module Knife
2
2
  module Ec2
3
- VERSION = "0.10.0"
3
+ VERSION = "0.11.0.rc.0"
4
4
  MAJOR, MINOR, TINY = VERSION.split('.')
5
5
  end
6
6
  end
data/spec/spec_helper.rb CHANGED
@@ -2,13 +2,13 @@ $:.unshift File.expand_path('../../lib', __FILE__)
2
2
  require 'chef'
3
3
  require 'chef/knife/winrm_base'
4
4
  require 'chef/knife/ec2_server_create'
5
- require 'chef/knife/ec2_instance_data'
6
5
  require 'chef/knife/ec2_server_delete'
7
6
  require 'chef/knife/ec2_server_list'
8
7
 
9
8
  # Clear config between each example
10
9
  # to avoid dependencies between examples
11
10
  RSpec.configure do |c|
11
+ c.filter_run_excluding :exclude => true
12
12
  c.before(:each) do
13
13
  Chef::Config.reset
14
14
  Chef::Config[:knife] ={}
@@ -787,6 +787,13 @@ describe Chef::Knife::Ec2ServerCreate do
787
787
  server_def[:associate_public_ip].should == true
788
788
  end
789
789
 
790
+ it "sets the spot price" do
791
+ @knife_ec2_create.config[:spot_price] = '1.99'
792
+ server_def = @knife_ec2_create.create_server_def
793
+
794
+ server_def[:price].should == '1.99'
795
+ end
796
+
790
797
  context "when using ebs volume type and ebs provisioned iops rate options" do
791
798
  before do
792
799
  @knife_ec2_create.stub_chain(:ami, :root_device_type).and_return("ebs")
@@ -888,6 +895,7 @@ describe Chef::Knife::Ec2ServerCreate do
888
895
  Net::SSH::Config.stub(:for).and_return(:user => "darius")
889
896
  @knife_ec2_create.get_ssh_gateway_for(hostname).should be_nil
890
897
  end
898
+
891
899
  end
892
900
 
893
901
  describe "ssh_connect_host" do
@@ -895,7 +903,8 @@ describe Chef::Knife::Ec2ServerCreate do
895
903
  @new_ec2_server.stub(
896
904
  :dns_name => 'public_name',
897
905
  :private_ip_address => 'private_ip',
898
- :custom => 'custom'
906
+ :custom => 'custom',
907
+ :public_ip_address => '111.111.111.111'
899
908
  )
900
909
  @knife_ec2_create.stub(:server => @new_ec2_server)
901
910
  end
@@ -906,6 +915,13 @@ describe Chef::Knife::Ec2ServerCreate do
906
915
  end
907
916
  end
908
917
 
918
+ describe "when dns name not exist" do
919
+ it 'should use public_ip_address ' do
920
+ @new_ec2_server.stub(:dns_name).and_return(nil)
921
+ @knife_ec2_create.ssh_connect_host.should == '111.111.111.111'
922
+ end
923
+ end
924
+
909
925
  describe "with vpc_mode?" do
910
926
  it 'should use private ip' do
911
927
  @knife_ec2_create.stub(:vpc_mode? => true)
@@ -0,0 +1,24 @@
1
+ require File.expand_path('../../spec_helper', __FILE__)
2
+
3
+ #This spec can only be run separately from the rest due to inclusion of fog library in other specs.
4
+ #rspec spec/unit/s3_source_deps_spec.rb
5
+
6
+ describe 'Check Dependencies', :exclude => Object.constants.include?(:Fog) do
7
+ before(:each) do
8
+ end
9
+ it 'should not load fog by default' do
10
+ begin
11
+ Fog::Storage::AWS.new()
12
+ rescue Exception => e
13
+ expect(e).to be_a_kind_of(NameError)
14
+ end
15
+ end
16
+
17
+ it 'lazy loads fog' do
18
+ begin
19
+ Chef::Knife::S3Source.fetch('test')
20
+ rescue Exception => e
21
+ expect(e).to be_a_kind_of(ArgumentError)
22
+ end
23
+ end
24
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: knife-ec2
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.10.0
4
+ version: 0.11.0.rc.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Adam Jacob
@@ -9,104 +9,110 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2014-11-13 00:00:00.000000000 Z
12
+ date: 2015-06-09 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: fog
16
16
  requirement: !ruby/object:Gem::Requirement
17
17
  requirements:
18
- - - ~>
18
+ - - "~>"
19
19
  - !ruby/object:Gem::Version
20
- version: 1.23.0
20
+ version: 1.25.0
21
21
  type: :runtime
22
22
  prerelease: false
23
23
  version_requirements: !ruby/object:Gem::Requirement
24
24
  requirements:
25
- - - ~>
25
+ - - "~>"
26
26
  - !ruby/object:Gem::Version
27
- version: 1.23.0
27
+ version: 1.25.0
28
28
  - !ruby/object:Gem::Dependency
29
29
  name: knife-windows
30
30
  requirement: !ruby/object:Gem::Requirement
31
31
  requirements:
32
- - - ! '>='
32
+ - - ">="
33
33
  - !ruby/object:Gem::Version
34
34
  version: 0.8.2
35
35
  type: :runtime
36
36
  prerelease: false
37
37
  version_requirements: !ruby/object:Gem::Requirement
38
38
  requirements:
39
- - - ! '>='
39
+ - - ">="
40
40
  - !ruby/object:Gem::Version
41
41
  version: 0.8.2
42
42
  - !ruby/object:Gem::Dependency
43
43
  name: mixlib-config
44
44
  requirement: !ruby/object:Gem::Requirement
45
45
  requirements:
46
- - - ~>
46
+ - - "~>"
47
47
  - !ruby/object:Gem::Version
48
48
  version: '2.0'
49
49
  type: :development
50
50
  prerelease: false
51
51
  version_requirements: !ruby/object:Gem::Requirement
52
52
  requirements:
53
- - - ~>
53
+ - - "~>"
54
54
  - !ruby/object:Gem::Version
55
55
  version: '2.0'
56
56
  - !ruby/object:Gem::Dependency
57
57
  name: chef
58
58
  requirement: !ruby/object:Gem::Requirement
59
59
  requirements:
60
- - - ! '>='
60
+ - - ">="
61
61
  - !ruby/object:Gem::Version
62
62
  version: 11.16.2
63
+ - - "<"
64
+ - !ruby/object:Gem::Version
65
+ version: '12'
63
66
  type: :development
64
67
  prerelease: false
65
68
  version_requirements: !ruby/object:Gem::Requirement
66
69
  requirements:
67
- - - ! '>='
70
+ - - ">="
68
71
  - !ruby/object:Gem::Version
69
72
  version: 11.16.2
73
+ - - "<"
74
+ - !ruby/object:Gem::Version
75
+ version: '12'
70
76
  - !ruby/object:Gem::Dependency
71
77
  name: rspec
72
78
  requirement: !ruby/object:Gem::Requirement
73
79
  requirements:
74
- - - ~>
80
+ - - "~>"
75
81
  - !ruby/object:Gem::Version
76
82
  version: '2.14'
77
83
  type: :development
78
84
  prerelease: false
79
85
  version_requirements: !ruby/object:Gem::Requirement
80
86
  requirements:
81
- - - ~>
87
+ - - "~>"
82
88
  - !ruby/object:Gem::Version
83
89
  version: '2.14'
84
90
  - !ruby/object:Gem::Dependency
85
91
  name: rake
86
92
  requirement: !ruby/object:Gem::Requirement
87
93
  requirements:
88
- - - ~>
94
+ - - "~>"
89
95
  - !ruby/object:Gem::Version
90
96
  version: '10.1'
91
97
  type: :development
92
98
  prerelease: false
93
99
  version_requirements: !ruby/object:Gem::Requirement
94
100
  requirements:
95
- - - ~>
101
+ - - "~>"
96
102
  - !ruby/object:Gem::Version
97
103
  version: '10.1'
98
104
  - !ruby/object:Gem::Dependency
99
105
  name: sdoc
100
106
  requirement: !ruby/object:Gem::Requirement
101
107
  requirements:
102
- - - ~>
108
+ - - "~>"
103
109
  - !ruby/object:Gem::Version
104
110
  version: '0.3'
105
111
  type: :development
106
112
  prerelease: false
107
113
  version_requirements: !ruby/object:Gem::Requirement
108
114
  requirements:
109
- - - ~>
115
+ - - "~>"
110
116
  - !ruby/object:Gem::Version
111
117
  version: '0.3'
112
118
  description: EC2 Support for Chef's Knife Command
@@ -117,8 +123,8 @@ executables: []
117
123
  extensions: []
118
124
  extra_rdoc_files: []
119
125
  files:
120
- - .gitignore
121
- - .travis.yml
126
+ - ".gitignore"
127
+ - ".travis.yml"
122
128
  - CHANGELOG.md
123
129
  - CONTRIBUTING.md
124
130
  - CONTRIBUTIONS.md
@@ -131,7 +137,6 @@ files:
131
137
  - knife-ec2.gemspec
132
138
  - lib/chef/knife/ec2_base.rb
133
139
  - lib/chef/knife/ec2_flavor_list.rb
134
- - lib/chef/knife/ec2_instance_data.rb
135
140
  - lib/chef/knife/ec2_server_create.rb
136
141
  - lib/chef/knife/ec2_server_delete.rb
137
142
  - lib/chef/knife/ec2_server_list.rb
@@ -140,6 +145,7 @@ files:
140
145
  - spec/spec_helper.rb
141
146
  - spec/unit/ec2_server_create_spec.rb
142
147
  - spec/unit/ec2_server_delete_spec.rb
148
+ - spec/unit/s3_source_deps_spec.rb
143
149
  - spec/unit/s3_source_spec.rb
144
150
  homepage: https://github.com/opscode/knife-ec2
145
151
  licenses:
@@ -151,17 +157,17 @@ require_paths:
151
157
  - lib
152
158
  required_ruby_version: !ruby/object:Gem::Requirement
153
159
  requirements:
154
- - - ! '>='
160
+ - - ">="
155
161
  - !ruby/object:Gem::Version
156
162
  version: '0'
157
163
  required_rubygems_version: !ruby/object:Gem::Requirement
158
164
  requirements:
159
- - - ! '>='
165
+ - - ">"
160
166
  - !ruby/object:Gem::Version
161
- version: '0'
167
+ version: 1.3.1
162
168
  requirements: []
163
169
  rubyforge_project:
164
- rubygems_version: 2.1.11
170
+ rubygems_version: 2.4.4
165
171
  signing_key:
166
172
  specification_version: 4
167
173
  summary: EC2 Support for Chef's Knife Command
@@ -169,5 +175,5 @@ test_files:
169
175
  - spec/spec_helper.rb
170
176
  - spec/unit/ec2_server_create_spec.rb
171
177
  - spec/unit/ec2_server_delete_spec.rb
178
+ - spec/unit/s3_source_deps_spec.rb
172
179
  - spec/unit/s3_source_spec.rb
173
- has_rdoc:
@@ -1,56 +0,0 @@
1
- #
2
- # Author:: Adam Jacob (<adam@opscode.com>)
3
- # Copyright:: Copyright (c) 2009 Opscode, Inc.
4
- # License:: Apache License, Version 2.0
5
- #
6
- # Licensed under the Apache License, Version 2.0 (the "License");
7
- # you may not use this file except in compliance with the License.
8
- # You may obtain a copy of the License at
9
- #
10
- # http://www.apache.org/licenses/LICENSE-2.0
11
- #
12
- # Unless required by applicable law or agreed to in writing, software
13
- # distributed under the License is distributed on an "AS IS" BASIS,
14
- # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
- # See the License for the specific language governing permissions and
16
- # limitations under the License.
17
- #
18
-
19
- require 'chef/knife'
20
-
21
- class Chef
22
- class Knife
23
- class Ec2InstanceData < Knife
24
-
25
- deps do
26
- require 'chef/json_compat'
27
- end
28
-
29
- banner "knife ec2 instance data (options)"
30
-
31
- option :edit,
32
- :short => "-e",
33
- :long => "--edit",
34
- :description => "Edit the instance data"
35
-
36
- option :run_list,
37
- :short => "-r RUN_LIST",
38
- :long => "--run-list RUN_LIST",
39
- :description => "Comma separated list of roles/recipes to apply",
40
- :proc => lambda { |o| o.split(/[\s,]+/) },
41
- :default => []
42
-
43
- def run
44
- data = {
45
- "chef_server" => Chef::Config[:chef_server_url],
46
- "validation_client_name" => Chef::Config[:validation_client_name],
47
- "validation_key" => IO.read(Chef::Config[:validation_key]),
48
- "attributes" => { "run_list" => config[:run_list] }
49
- }
50
- data = edit_data(data) if config[:edit]
51
- ui.output(data)
52
- end
53
- end
54
- end
55
- end
56
-