beaker-aws 0.6.0 → 0.7.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 57529b95c092329fae7b75595e5d037d1a911b7e
4
- data.tar.gz: b0da2eb31f34a2577011d61ebba9c9ce6c1a90d3
3
+ metadata.gz: 4866acd6653e805a28c64c04e3ca86c9906ff7e5
4
+ data.tar.gz: e6b5052bbe8d40251c1cd9f91bd0c28fec0e905a
5
5
  SHA512:
6
- metadata.gz: 74923a90c8fe25d456959961d7ae0f2f5672d6116e631fa9b8e514b14d6fad51320fc98d03ea42995629317a24ef8e3f51d028a220fc9876435427aeed37a5da
7
- data.tar.gz: 9da09c3fc224398a918979348b0e9c1a454b0276dfd923dd1b97d7e526d03aea15d8f820b0fe6add671bda0ae5c9bab5a680332208c9ea2e380ef3dc84973113
6
+ metadata.gz: 5118363801c1e62579baa718d2e8a2e2a53fb4a46e15d8f42d20116480696e320dec38a4095e050073c095f1299d8d39ef33e1b945e9a89e64fad99291caea13
7
+ data.tar.gz: 43651255fa2ea328814945204fc859f2415468024863ba292195c1da7b5dfe171d8a496a7f27e0545cff3b6061f717e18bacb3260553fc699e6b8f2ecb0c538c
data/README.md CHANGED
@@ -4,19 +4,26 @@ Beaker library to use aws hypervisor
4
4
 
5
5
  # How to use this wizardry
6
6
 
7
- This gem that allows you to use hosts with [aws](aws.md) hypervisor with [beaker](https://github.com/puppetlabs/beaker).
8
- Please checkout our [aws](aws.md) and [ec2](ec2.md) docs.
7
+ This gem that allows you to use hosts with [aws](aws.md) hypervisor with [beaker](https://github.com/puppetlabs/beaker). Please check out our [aws](aws.md) and [ec2](ec2.md) docs.
9
8
 
10
- ### Right Now? (beaker 3.x)
9
+ Beaker will automatically load the appropriate hypervisors for any given hosts file, so as long as your project dependencies are satisfied there's nothing else to do. No need to `require` this library in your tests.
11
10
 
12
- This gem is already included as [beaker dependency](https://github.com/puppetlabs/beaker/blob/master/beaker.gemspec) for you, so you don't need to do anything special to use this gem's functionality with beaker.
11
+ ## With Beaker 3.x
13
12
 
14
- ### In beaker's Next Major Version? (beaker 4.x)
13
+ This library is included as a dependency of Beaker 3.x versions, so there's nothing to do.
15
14
 
16
- In beaker's next major version, the requirement for beaker-aws will be pulled
17
- from that repo. When that happens, then the usage pattern will change. In order
18
- to use this then, you'll need to include beaker-aws as a dependency right
19
- next to beaker itself.
15
+ ## With Beaker 4.x
16
+
17
+ As of Beaker 4.0, all hypervisor and DSL extension libraries have been removed and are no longer dependencies. In order to use a specific hypervisor or DSL extension library in your project, you will need to include them alongside Beaker in your Gemfile or project.gemspec. E.g.
18
+
19
+ ~~~ruby
20
+ # Gemfile
21
+ gem 'beaker', '~>4.0'
22
+ gem 'beaker-aws'
23
+ # project.gemspec
24
+ s.add_runtime_dependency 'beaker', '~>4.0'
25
+ s.add_runtime_dependency 'beaker-aws'
26
+ ~~~
20
27
 
21
28
  # Spec tests
22
29
 
data/ec2.md CHANGED
@@ -111,3 +111,6 @@ This is optional and by default is set to '0.0.0.0/0'.
111
111
 
112
112
  #### `user` ####
113
113
  By default root login is not allowed with Amazon Linux. Setting it to ec2-user will trigger `sshd_config` and `authorized_keys` changes by beaker.
114
+
115
+ #### `disable_root_ssh` ####
116
+ By default Beaker enabled root login on the instance. There are situation where we use AMIs which are pre-configured. Setting `disable_root_ssh` to `true` will stop enablign the root login.
@@ -1,3 +1,3 @@
1
1
  module BeakerAws
2
- VERSION = '0.6.0'
2
+ VERSION = '0.7.0'
3
3
  end
@@ -612,9 +612,9 @@ module Beaker
612
612
  # @return [void]
613
613
  # @api private
614
614
  def configure_hosts
615
- non_netdev_hosts = @hosts.select{ |h| !(h['platform'] =~ /f5-|netscaler/) }
616
- non_netdev_hosts.each do |host|
617
- host_entries = non_netdev_hosts.map do |h|
615
+ non_netdev_windows_hosts = @hosts.select{ |h| !(h['platform'] =~ /f5-|netscaler|windows/) }
616
+ non_netdev_windows_hosts.each do |host|
617
+ host_entries = non_netdev_windows_hosts.map do |h|
618
618
  h == host ? etc_hosts_entry(h, :private_ip) : etc_hosts_entry(h)
619
619
  end
620
620
  host_entries.unshift "127.0.0.1\tlocalhost localhost.localdomain\n"
@@ -629,7 +629,12 @@ module Beaker
629
629
  # @api private
630
630
  def enable_root_on_hosts
631
631
  @hosts.each do |host|
632
- enable_root(host)
632
+ if host['disable_root_ssh'] == true
633
+ @logger.notify("aws-sdk: Not enabling root for instance as disable_root_ssh is set to 'true'.")
634
+ else
635
+ @logger.notify("aws-sdk: Enabling root ssh")
636
+ enable_root(host)
637
+ end
633
638
  end
634
639
  end
635
640
 
@@ -709,6 +714,8 @@ module Beaker
709
714
  if host['platform'] =~ /el-7/
710
715
  # on el-7 hosts, the hostname command doesn't "stick" randomly
711
716
  host.exec(Command.new("hostnamectl set-hostname #{host.name}"))
717
+ elsif host['platform'] =~ /windows/
718
+ @logger.notify('aws-sdk: Change hostname on windows is not supported.')
712
719
  else
713
720
  next if host['platform'] =~ /netscaler/
714
721
  host.exec(Command.new("hostname #{host.name}"))
@@ -728,6 +735,8 @@ module Beaker
728
735
  if host['platform'] =~ /el-7/
729
736
  # on el-7 hosts, the hostname command doesn't "stick" randomly
730
737
  host.exec(Command.new("hostnamectl set-hostname #{host.hostname}"))
738
+ elsif host['platform'] =~ /windows/
739
+ @logger.notify('aws-sdk: Change hostname on windows is not supported.')
731
740
  else
732
741
  next if host['platform'] =~ /netscaler/
733
742
  host.exec(Command.new("hostname #{host.hostname}"))
@@ -44,7 +44,7 @@ module Beaker
44
44
  }}
45
45
 
46
46
  before :each do
47
- @hosts = make_hosts({:snapshot => :pe}, 6)
47
+ @hosts = make_hosts({:snapshot => :pe}, 7)
48
48
  @hosts[0][:platform] = "centos-5-x86-64-west"
49
49
  @hosts[1][:platform] = "centos-6-x86-64-west"
50
50
  @hosts[2][:platform] = "centos-7-x86-64-west"
@@ -53,6 +53,7 @@ module Beaker
53
53
  @hosts[4][:platform] = 'f5-host'
54
54
  @hosts[4][:user] = 'notroot'
55
55
  @hosts[5][:platform] = 'netscaler-host'
56
+ @hosts[6][:platform] = 'windows-host'
56
57
 
57
58
  ENV['AWS_ACCESS_KEY'] = nil
58
59
  ENV['AWS_SECRET_ACCESS_KEY'] = nil
@@ -635,9 +636,9 @@ module Beaker
635
636
  it { is_expected.to be_nil }
636
637
 
637
638
  context 'calls #set_etc_hosts' do
638
- it 'for each host (except the f5 ones)' do
639
- non_netdev_hosts = @hosts.select{ |h| !(h['platform'] =~ /f5|netscaler/) }
640
- expect(aws).to receive(:set_etc_hosts).exactly(non_netdev_hosts.size).times
639
+ it 'for each host (except the f5 and windows ones)' do
640
+ non_netdev_windows_hosts = @hosts.select{ |h| !(h['platform'] =~ /f5|netscaler|windows/) }
641
+ expect(aws).to receive(:set_etc_hosts).exactly(non_netdev_windows_hosts.size).times
641
642
  expect(configure_hosts).to be_nil
642
643
  end
643
644
 
@@ -669,6 +670,25 @@ module Beaker
669
670
  expect( aws ).to receive(:enable_root_f5).with( @hosts[4] ).once()
670
671
  aws.enable_root_on_hosts()
671
672
  end
673
+ context 'when :disable_root_ssh is true' do
674
+ it 'should not enable root' do
675
+ @hosts = [@hosts[0]]
676
+
677
+ @hosts[0][:disable_root_ssh] = true
678
+ expect( aws ).to_not receive(:enable_root)
679
+ aws.enable_root_on_hosts();
680
+ end
681
+ end
682
+
683
+ context 'when :disable_root_ssh is defined and false' do
684
+ it 'should enable root' do
685
+ @hosts = [@hosts[0]]
686
+
687
+ @hosts[0][:disable_root_ssh] = false
688
+ expect( aws ).to receive(:enable_root).with(@hosts[0]).once()
689
+ aws.enable_root_on_hosts();
690
+ end
691
+ end
672
692
  end
673
693
 
674
694
  describe '#enable_root_f5' do
@@ -715,14 +735,14 @@ module Beaker
715
735
  context 'for each host' do
716
736
  it 'calls exec' do
717
737
  @hosts.each do |host|
718
- expect(host).to receive(:exec).once unless host['platform'] =~ /netscaler/
738
+ expect(host).to receive(:exec).once unless host['platform'] =~ /netscaler|windows/
719
739
  end
720
740
  expect(set_hostnames).to eq(@hosts)
721
741
  end
722
742
 
723
743
  it 'passes a Command instance to exec' do
724
744
  @hosts.each do |host|
725
- expect(host).to receive(:exec).with( instance_of(Beaker::Command) ).once unless host['platform'] =~ /netscaler/
745
+ expect(host).to receive(:exec).with( instance_of(Beaker::Command) ).once unless host['platform'] =~ /netscaler|windows/
726
746
  end
727
747
  expect(set_hostnames).to eq(@hosts)
728
748
  end
@@ -737,9 +757,9 @@ module Beaker
737
757
 
738
758
  it 'sets the the vmhostname to the beaker config name for each host' do
739
759
  options[:use_beaker_hostnames] = true
740
- @hosts.each do |host|
760
+ @hosts.each do |host|
741
761
  host.instance_eval("@name = 'prettyponyprincess'")
742
- end
762
+ end
743
763
  expect(set_hostnames).to eq(@hosts)
744
764
  @hosts.each do |host|
745
765
  expect(host[:vmhostname]).not_to eq(nil)
@@ -749,6 +769,13 @@ module Beaker
749
769
  end
750
770
 
751
771
  end
772
+
773
+ context 'windows host platform' do
774
+ it 'should not change hostname when use_beaker_hostnames is enabled' do
775
+ options[:use_beaker_hostnames] = true
776
+ expect(@hosts[6]).to_not receive(:exec)
777
+ end
778
+ end
752
779
  end
753
780
 
754
781
  describe '#backoff_sleep' do
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: beaker-aws
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.0
4
+ version: 0.7.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Rishi Javia, Kevin Imber, Tony Vu
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-07-16 00:00:00.000000000 Z
11
+ date: 2018-08-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rspec