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 +4 -4
- data/README.md +16 -9
- data/ec2.md +3 -0
- data/lib/beaker-aws/version.rb +1 -1
- data/lib/beaker/hypervisor/aws_sdk.rb +13 -4
- data/spec/beaker/hypervisor/aws_sdk_spec.rb +35 -8
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4866acd6653e805a28c64c04e3ca86c9906ff7e5
|
4
|
+
data.tar.gz: e6b5052bbe8d40251c1cd9f91bd0c28fec0e905a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
|
-
|
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
|
-
|
11
|
+
## With Beaker 3.x
|
13
12
|
|
14
|
-
|
13
|
+
This library is included as a dependency of Beaker 3.x versions, so there's nothing to do.
|
15
14
|
|
16
|
-
|
17
|
-
|
18
|
-
to use
|
19
|
-
|
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.
|
data/lib/beaker-aws/version.rb
CHANGED
@@ -612,9 +612,9 @@ module Beaker
|
|
612
612
|
# @return [void]
|
613
613
|
# @api private
|
614
614
|
def configure_hosts
|
615
|
-
|
616
|
-
|
617
|
-
host_entries =
|
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
|
-
|
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},
|
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
|
-
|
640
|
-
expect(aws).to receive(:set_etc_hosts).exactly(
|
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
|
-
|
760
|
+
@hosts.each do |host|
|
741
761
|
host.instance_eval("@name = 'prettyponyprincess'")
|
742
|
-
|
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.
|
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-
|
11
|
+
date: 2018-08-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rspec
|