beaker 2.0.0 → 2.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- NDI4OGYzMmQyNzY2MjVkMjNjYmI5MThmNTZhNjYxODNkNmQ2YTM4NA==
4
+ NjdlNTE1ZjY2ZmUwOGYwN2RhMjU4ZWU5YTA3OTg5NTE0OWUwNmZlNA==
5
5
  data.tar.gz: !binary |-
6
- NDQxMzRmNWUzMDQ4YWE1YzRhY2M4MDQyOGI0MDM4MGRlYTQwZTU0Yw==
6
+ NjEwMDllZTAyZGVhMTZiOGRkNmE1OTYyODk2YjY5NzllYWMwMDUwZA==
7
7
  SHA512:
8
8
  metadata.gz: !binary |-
9
- ZjMwY2NiNWExOWRhOGRmNzI0OTIzZTRiZjQ1NTUzMWJiOGRkOTYyMmIxZWNl
10
- NWY4OWYxYTE3ZjMyNDY0OWNkNWJjMjk0YjUwYmI4ZWZmOWY1MTFhNzkwODhk
11
- NzBkYjliMDY4ZGI0ZWUzODkxMjAwODhkMzBjMzRiYTBlZjE5MmI=
9
+ MTE0ZDdjMmFmNWFkYmQ0YzJkOTVhMmQ3NjhkOGEyNDllZGU5NDBjMjRkYTNi
10
+ YTc3NjFmMThmM2Y4YjY4MWNiYmYyM2Y3ZTU4NGUxZWE0YjE4NWEwN2QxMmQz
11
+ OGI5Zjc2MzIwMzVkNjJiYThlNWNmMWViNmYxMjc4OTZiMTRkYzE=
12
12
  data.tar.gz: !binary |-
13
- NjAyNDBlZjA0OWZhNzQyZTEwZGQ2MTRhNzBkNTE5MzcyYjFkZTQ5NmFhYmY5
14
- NjExZDA5Zjk0NWYyZDQ5NzBjM2UwNjgyN2VmZWJlMjg2NmQxNjRkZGE2YTM4
15
- ZmVjMmU4YWRlYjhkNDNiNTM3NjNiNTc1ZGY5MDYwZTNkMTIyYzM=
13
+ OGQxYjQ5NmFiYzJhN2U2MGZhYTU2NWZiNDE2ZjFiMzUyY2NkYmNhZTgyZWQy
14
+ YzU4ZmFiOGJhMjljOTQzNDMwYzZiYTQwNTE1MGU2YzhjYjdiNDVkYjNiNWQw
15
+ MzE0Njk5OTM3M2QzZGU5MjdkMjcwMzFhNDFmYTA5MWYzYmRjYTI=
data/HISTORY.md CHANGED
@@ -1,6 +1,7 @@
1
1
  # default - History
2
2
  ## Tags
3
- * [LATEST - 5 Dec, 2014 (6a1295f2)](#LATEST)
3
+ * [LATEST - 17 Dec, 2014 (747aacee)](#LATEST)
4
+ * [beaker2.0.0 - 5 Dec, 2014 (fb4b620b)](#beaker2.0.0)
4
5
  * [beaker1.20.1 - 17 Oct, 2014 (be250ad6)](#beaker1.20.1)
5
6
  * [beaker1.20.0 - 17 Oct, 2014 (24acc2d3)](#beaker1.20.0)
6
7
  * [beaker1.19.1 - 19 Sep, 2014 (3aafc71d)](#beaker1.19.1)
@@ -65,7 +66,123 @@
65
66
  * [pe1.2 - 6 Sep, 2011 (ba3dadd2)](#pe1.2)
66
67
 
67
68
  ## Details
68
- ### <a name = "LATEST">LATEST - 5 Dec, 2014 (6a1295f2)
69
+ ### <a name = "LATEST">LATEST - 17 Dec, 2014 (747aacee)
70
+
71
+ * (GEM) update beaker version to 2.1.0 (747aacee)
72
+
73
+ * Merge pull request #576 from anodelman/utf-8-encoding (0ff3e99e)
74
+
75
+
76
+ ```
77
+ Merge pull request #576 from anodelman/utf-8-encoding
78
+
79
+ (QENG-1599) force_encoding requires string input, pukes on symbols
80
+ ```
81
+ * Merge pull request #582 from kevpl/qeng1596_2.0_solaris (d949312b)
82
+
83
+
84
+ ```
85
+ Merge pull request #582 from kevpl/qeng1596_2.0_solaris
86
+
87
+ (QENG-1596) fixed sed commands on solaris
88
+ ```
89
+ * Merge pull request #580 from anodelman/fix-ssh-login (ff448494)
90
+
91
+
92
+ ```
93
+ Merge pull request #580 from anodelman/fix-ssh-login
94
+
95
+ (QENG-1594) Beaker 2.0.0 breaks Centos 7 sshd
96
+ ```
97
+ * Merge pull request #583 from anodelman/aws (9e68d52e)
98
+
99
+
100
+ ```
101
+ Merge pull request #583 from anodelman/aws
102
+
103
+ (QENG-1529) beaker support to query aws instance information
104
+ ```
105
+ * Merge pull request #579 from puppetlabs/vcloud_hypervisor_improvements (32ff90c9)
106
+
107
+
108
+ ```
109
+ Merge pull request #579 from puppetlabs/vcloud_hypervisor_improvements
110
+
111
+ (QENG-1548) vcloud hypervisor improvements
112
+ ```
113
+ * (QENG-1596) added aix and osx to SedCommand fix (e2c0aecd)
114
+
115
+ * (QENG-1596) fixed sed commands on solaris (c1894743)
116
+
117
+ * (QENG-1594) Beaker 2.0.0 breaks Centos 7 sshd (f2c1b1ef)
118
+
119
+
120
+ ```
121
+ (QENG-1594) Beaker 2.0.0 breaks Centos 7 sshd
122
+
123
+ - append newline to end of sshd_config file
124
+ ```
125
+ * (QENG-1548) Don't generate a hostname if 'name' is specified (11d918bb)
126
+
127
+ * (QENG-1548) Allow 'resourcepool' to be an optional param for 'vcloud' hypervisor (780dfb68)
128
+
129
+ * Merge pull request #574 from anodelman/maint (b89073d3)
130
+
131
+
132
+ ```
133
+ Merge pull request #574 from anodelman/maint
134
+
135
+ (MAINT) missing assert_not_match method
136
+ ```
137
+ * (QENG-1599) force_encoding requires string input, pukes on symbols (77488bc1)
138
+
139
+ * Merge pull request #575 from anodelman/tagging (1984b158)
140
+
141
+
142
+ ```
143
+ Merge pull request #575 from anodelman/tagging
144
+
145
+ (MAINT) update ec2 tags with 'created_by'
146
+ ```
147
+ * (MAINT) update ec2 tags with 'created_by' (d760570c)
148
+
149
+
150
+ ```
151
+ (MAINT) update ec2 tags with 'created_by'
152
+
153
+ - now tag ec2 instances with Name, department, project,
154
+ jenkins_build_url and created_by
155
+ ```
156
+ * (MAINT) missing assert_not_match method (779f61bc)
157
+
158
+
159
+ ```
160
+ (MAINT) missing assert_not_match method
161
+
162
+ - just add alias to assert_no_match
163
+ ```
164
+ * (QENG-1529) beaker support to query aws instance information (c2d2a33c)
165
+
166
+
167
+ ```
168
+ (QENG-1529) beaker support to query aws instance information
169
+
170
+ - access to individual instances by id
171
+ - access to array of all instances
172
+ ```
173
+ * Merge pull request #565 from puppetlabs/add_40_answers (56d896a5)
174
+
175
+
176
+ ```
177
+ Merge pull request #565 from puppetlabs/add_40_answers
178
+
179
+ (maint) Make beaker support 4.0
180
+ ```
181
+ * (maint) Make beaker support 4.0 (e9fcdaf6)
182
+
183
+ ### <a name = "beaker2.0.0">beaker2.0.0 - 5 Dec, 2014 (fb4b620b)
184
+
185
+ * (HISTORY) update beaker history for gem release 2.0.0 (fb4b620b)
69
186
 
70
187
  * (GEM) update beaker version to 2.0.0 (6a1295f2)
71
188
 
@@ -15,6 +15,8 @@ module Beaker
15
15
  # data.
16
16
  def self.create version, hosts, options
17
17
  case version
18
+ when /\A4\.0/
19
+ return Version34.new(version, hosts, options)
18
20
  when /\A3\.7/
19
21
  return Version34.new(version, hosts, options)
20
22
  when /\A3\.4/
@@ -170,4 +170,31 @@ module Beaker
170
170
  eval "\"#{@command}\""
171
171
  end
172
172
  end
173
+
174
+ class SedCommand < Command
175
+
176
+ # sets up a SedCommand for a particular platform
177
+ #
178
+ # the purpose is to abstract away platform-dependent details of the sed command
179
+ #
180
+ # @param [String] platform The host platform string
181
+ # @param [String] expression The sed expression
182
+ # @param [String] filename The file to apply the sed expression to
183
+ # @param [Hash{Symbol=>String}] opts Additional options
184
+ # @option opts [String] :temp_file The temp file to use for in-place substitution
185
+ # (only applies to solaris hosts, they don't provide the -i option)
186
+ #
187
+ # @return a new {SedCommand} object
188
+ def initialize platform, expression, filename, opts = {}
189
+ command = "sed -i -e \"#{expression}\" #{filename}"
190
+ if platform =~ /solaris|aix|osx/
191
+ command.slice! '-i '
192
+ temp_file = opts[:temp_file] ? opts[:temp_file] : "#{filename}.tmp"
193
+ command << " > #{temp_file} && mv #{temp_file} #{filename} && rm -f #{temp_file}"
194
+ end
195
+ args = []
196
+ opts['ENV'] ||= Hash.new
197
+ super( command, args, opts )
198
+ end
199
+ end
173
200
  end
@@ -105,6 +105,8 @@ module Beaker
105
105
  assert(regexp !~ string, msg)
106
106
  end
107
107
 
108
+ alias_method :assert_not_match, :assert_no_match
109
+
108
110
  end
109
111
  end
110
112
  end
data/lib/beaker/host.rb CHANGED
@@ -214,14 +214,15 @@ module Beaker
214
214
  def add_env_var key, val
215
215
  key = key.to_s.upcase
216
216
  escaped_val = Regexp.escape(val).gsub('/', '\/').gsub(';', '\;')
217
+ env_file = self[:ssh_env_file]
217
218
  #see if the key/value pair already exists
218
- if exec(Beaker::Command.new("grep -e #{key}=.*#{escaped_val} #{self[:ssh_env_file]}"), :acceptable_exit_codes => (0..255) ).exit_code == 0
219
+ if exec(Beaker::Command.new("grep -e #{key}=.*#{escaped_val} #{env_file}"), :acceptable_exit_codes => (0..255) ).exit_code == 0
219
220
  return #nothing to do here, key value pair already exists
220
221
  #see if the key already exists
221
- elsif exec(Beaker::Command.new("grep #{key} #{self[:ssh_env_file]}"), :acceptable_exit_codes => (0..255) ).exit_code == 0
222
- exec(Beaker::Command.new("sed -i -e \"s/#{key}=/#{key}=#{escaped_val}:/\" #{self[:ssh_env_file]}"))
222
+ elsif exec(Beaker::Command.new("grep #{key} #{env_file}"), :acceptable_exit_codes => (0..255) ).exit_code == 0
223
+ exec(Beaker::SedCommand.new(self['HOSTS'][name]['platform'], "s/#{key}=/#{key}=#{escaped_val}:/", env_file))
223
224
  else
224
- exec(Beaker::Command.new("echo \"#{key}=#{val}\" >> #{self[:ssh_env_file]}"))
225
+ exec(Beaker::Command.new("echo \"#{key}=#{val}\" >> #{env_file}"))
225
226
  end
226
227
  end
227
228
 
@@ -233,9 +234,9 @@ module Beaker
233
234
  def delete_env_var key, val
234
235
  val = Regexp.escape(val).gsub('/', '\/').gsub(';', '\;')
235
236
  #if the key only has that single value remove the entire line
236
- exec(Beaker::Command.new("sed -i -e \"/#{key}=#{val}$/d\" #{self[:ssh_env_file]}"))
237
+ exec(Beaker::SedCommand.new(self['HOSTS'][name]['platform'], "/#{key}=#{val}$/d", self[:ssh_env_file]))
237
238
  #if the key has multiple values and we only need to remove the provided val
238
- exec(Beaker::Command.new("sed -i -e \"s/#{key}=\\(.*[:;]*\\)#{val}[:;]*/#{key}=\\1/\" #{self[:ssh_env_file]}"))
239
+ exec(Beaker::SedCommand.new(self['HOSTS'][name]['platform'], "s/#{key}=\\(.*[:;]*\\)#{val}[:;]*/#{key}=\\1/", self[:ssh_env_file]))
239
240
  end
240
241
 
241
242
  def connection
@@ -479,28 +479,28 @@ module Beaker
479
479
  logger.debug("setting local environment on #{host.name}")
480
480
  case host['platform']
481
481
  when /windows/
482
- host.exec(Command.new("echo 'PermitUserEnvironment yes' >> /etc/sshd_config"))
482
+ host.exec(Command.new("echo 'PermitUserEnvironment yes\n' >> /etc/sshd_config"))
483
483
  host.exec(Command.new("cygrunsrv -E sshd"))
484
484
  host.exec(Command.new("cygrunsrv -S sshd"))
485
485
  env['CYGWIN'] = 'nodosfilewarning'
486
486
  when /osx/
487
- host.exec(Command.new("echo 'PermitUserEnvironment yes' >> /etc/sshd_config"))
487
+ host.exec(Command.new("echo 'PermitUserEnvironment yes\n' >> /etc/sshd_config"))
488
488
  host.exec(Command.new("launchctl unload /System/Library/LaunchDaemons/ssh.plist"))
489
489
  host.exec(Command.new("launchctl load /System/Library/LaunchDaemons/ssh.plist"))
490
490
  when /debian|ubuntu|cumulus/
491
- host.exec(Command.new("echo 'PermitUserEnvironment yes' >> /etc/ssh/sshd_config"))
491
+ host.exec(Command.new("echo 'PermitUserEnvironment yes\n' >> /etc/ssh/sshd_config"))
492
492
  host.exec(Command.new("service ssh restart"))
493
493
  when /el-|centos|fedora|redhat|oracle|scientific|eos/
494
- host.exec(Command.new("echo 'PermitUserEnvironment yes' >> /etc/ssh/sshd_config"))
494
+ host.exec(Command.new("echo 'PermitUserEnvironment yes\n' >> /etc/ssh/sshd_config"))
495
495
  host.exec(Command.new("service sshd restart"))
496
496
  when /sles/
497
- host.exec(Command.new("echo 'PermitUserEnvironment yes' >> /etc/ssh/sshd_config"))
497
+ host.exec(Command.new("echo 'PermitUserEnvironment yes\n' >> /etc/ssh/sshd_config"))
498
498
  host.exec(Command.new("rcsshd restart"))
499
499
  when /solaris/
500
- host.exec(Command.new("echo 'PermitUserEnvironment yes' >> /etc/ssh/sshd_config"))
500
+ host.exec(Command.new("echo 'PermitUserEnvironment yes\n' >> /etc/ssh/sshd_config"))
501
501
  host.exec(Command.new("svcadm restart svc:/network/ssh:default"))
502
502
  when /aix/
503
- host.exec(Command.new("echo 'PermitUserEnvironment yes' >> /etc/ssh/sshd_config"))
503
+ host.exec(Command.new("echo 'PermitUserEnvironment yes\n' >> /etc/ssh/sshd_config"))
504
504
  host.exec(Command.new("stopsrc -g ssh"))
505
505
  host.exec(Command.new("startsrc -g ssh"))
506
506
  end
@@ -115,6 +115,20 @@ module Beaker
115
115
  @logger.notify("#{output}")
116
116
  end
117
117
 
118
+ # Provided an id return an instance object.
119
+ # Instance object will respond to methods described here: http://docs.aws.amazon.com/AWSRubySDK/latest/AWS/EC2/Instance.html
120
+ # @param [String] id The id of the instance to return
121
+ # @return [AWS::EC2::Instance] An AWS::EC2 instance object
122
+ def instance_by_id(id)
123
+ @ec2.instances[id]
124
+ end
125
+
126
+ # Return all instances currently on ec2.
127
+ # @return [Array<AWS::EC2::Instance>] An array of AWS::EC2 instance objects
128
+ def instances
129
+ @ec2.instances
130
+ end
131
+
118
132
  # Shutdown and destroy ec2 instances idenfitied by key that have been alive
119
133
  # longer than ZOMBIE hours.
120
134
  #
@@ -304,6 +318,7 @@ module Beaker
304
318
  instance.add_tag("Name", :value => host.name)
305
319
  instance.add_tag("department", :value => @options[:department])
306
320
  instance.add_tag("project", :value => @options[:project])
321
+ instance.add_tag("created_by", :value => @options[:created_by])
307
322
  end
308
323
 
309
324
  nil
@@ -9,7 +9,6 @@ module Beaker
9
9
  @hosts = vcloud_hosts
10
10
 
11
11
  raise 'You must specify a datastore for vCloud instances!' unless @options['datastore']
12
- raise 'You must specify a resource pool for vCloud instances!' unless @options['resourcepool']
13
12
  raise 'You must specify a folder for vCloud instances!' unless @options['folder']
14
13
  @vsphere_credentials = VsphereHelper.load_config(@options[:dot_fog])
15
14
  end
@@ -73,7 +72,7 @@ module Beaker
73
72
  # Put the VM in the specified folder and resource pool
74
73
  relocateSpec = RbVmomi::VIM.VirtualMachineRelocateSpec(
75
74
  :datastore => @vsphere_helper.find_datastore(@options['datastore']),
76
- :pool => @vsphere_helper.find_pool(@options['resourcepool']),
75
+ :pool => @options['resourcepool'] ? @vsphere_helper.find_pool(@options['resourcepool']) : nil,
77
76
  :diskMoveType => :moveChildMostDiskBacking
78
77
  )
79
78
 
@@ -99,8 +98,11 @@ module Beaker
99
98
  start = Time.now
100
99
  tasks = []
101
100
  @hosts.each_with_index do |h, i|
102
- # Generate a randomized hostname
103
- h['vmhostname'] = generate_host_name
101
+ if h['name']
102
+ h['vmhostname'] = h['name']
103
+ else
104
+ h['vmhostname'] = generate_host_name
105
+ end
104
106
 
105
107
  if h['template'] =~ /\//
106
108
  templatefolders = h['template'].split('/')
data/lib/beaker/logger.rb CHANGED
@@ -170,7 +170,7 @@ module Beaker
170
170
  end
171
171
  else
172
172
  # Remove invalid and undefined UTF-8 character encodings
173
- string.force_encoding('UTF-8')
173
+ string.to_s.force_encoding('UTF-8')
174
174
  return string.chars.select{|i| i.valid_encoding?}.join
175
175
  end
176
176
  end
@@ -16,6 +16,7 @@ module Beaker
16
16
  :project => ['BEAKER_PROJECT', 'BEAKER_project'],
17
17
  :department => ['BEAKER_DEPARTMENT', 'BEAKER_department'],
18
18
  :jenkins_build_url => ['BEAKER_BUILD_URL', 'BUILD_URL'],
19
+ :created_by => ['BEAKER_CREATED_BY'],
19
20
  :consoleport => ['BEAKER_CONSOLEPORT', 'consoleport'],
20
21
  :is_pe => ['BEAKER_IS_PE', 'IS_PE'],
21
22
  :pe_dir => ['BEAKER_PE_DIR', 'pe_dist_dir'],
@@ -110,9 +111,10 @@ module Beaker
110
111
  h = Beaker::Options::OptionsHash.new
111
112
  h.merge({
112
113
  :project => 'Beaker',
113
- :department => ENV['USER'] || ENV['USERNAME'] || 'unknown',
114
- :validate => true,
114
+ :department => 'unknown',
115
+ :created_by => ENV['USER'] || ENV['USERNAME'] || 'unknown',
115
116
  :jenkins_build_url => nil,
117
+ :validate => true,
116
118
  :log_level => 'info',
117
119
  :trace_limit => 10,
118
120
  :"master-start-curl-retries" => 120,
data/lib/beaker/result.rb CHANGED
@@ -32,7 +32,7 @@ module Beaker
32
32
 
33
33
  def convert string
34
34
  # Remove invalid and undefined UTF-8 character encodings
35
- string.force_encoding('UTF-8')
35
+ string.to_s.force_encoding('UTF-8')
36
36
  string.chars.select{|i| i.valid_encoding?}.join
37
37
  end
38
38
 
@@ -1,5 +1,5 @@
1
1
  module Beaker
2
2
  module Version
3
- STRING = '2.0.0'
3
+ STRING = '2.1.0'
4
4
  end
5
5
  end
@@ -80,4 +80,40 @@ module Beaker
80
80
  expect( cmd.cmd_line host ).to be === ""
81
81
  end
82
82
  end
83
+ describe SedCommand do
84
+ let(:host) { Hash.new }
85
+ let(:platform) { @platform || 'unix' }
86
+ let(:expression) { @expression || 's/b/s/' }
87
+ let(:filename) { @filename || '/fakefile' }
88
+ let(:options) { @options || Hash.new }
89
+ subject(:cmd) { SedCommand.new( platform, expression, filename, options ) }
90
+
91
+ it 'forms a basic sed command correctly' do
92
+ expect( cmd.cmd_line host ).to be === "sed -i -e \"#{expression}\" #{filename}"
93
+ end
94
+
95
+ it 'provides the -i option to rewrite file in-place on non-solaris hosts' do
96
+ expect( cmd.cmd_line host ).to include('-i')
97
+ end
98
+
99
+ describe 'on solaris hosts' do
100
+ it 'removes the -i option correctly' do
101
+ @platform = 'solaris'
102
+ expect( cmd.cmd_line host ).not_to include('-i')
103
+ end
104
+
105
+ it 'deals with in-place file substitution correctly' do
106
+ @platform = 'solaris'
107
+ default_temp_file = "#{filename}.tmp"
108
+ expect( cmd.cmd_line host ).to include(" > #{default_temp_file} && mv #{default_temp_file} #{filename} && rm -f #{default_temp_file}")
109
+ end
110
+
111
+ it 'allows you to provide the name of the temp file for in-place file substitution' do
112
+ @platform = 'solaris'
113
+ temp_file = 'mytemp.tmp'
114
+ @options = { :temp_file => temp_file }
115
+ expect( cmd.cmd_line host ).to include(" > #{temp_file} && mv #{temp_file} #{filename} && rm -f #{temp_file}")
116
+ end
117
+ end
118
+ end
83
119
  end
@@ -449,7 +449,7 @@ describe Beaker do
449
449
 
450
450
  it "can set the environment on a windows host" do
451
451
  commands = [
452
- "echo 'PermitUserEnvironment yes' >> /etc/sshd_config",
452
+ "echo 'PermitUserEnvironment yes\n' >> /etc/sshd_config",
453
453
  "cygrunsrv -E sshd",
454
454
  "cygrunsrv -S sshd"
455
455
  ]
@@ -458,7 +458,7 @@ describe Beaker do
458
458
 
459
459
  it "can set the environment on an OS X host" do
460
460
  commands = [
461
- "echo 'PermitUserEnvironment yes' >> /etc/sshd_config",
461
+ "echo 'PermitUserEnvironment yes\n' >> /etc/sshd_config",
462
462
  "launchctl unload /System/Library/LaunchDaemons/ssh.plist",
463
463
  "launchctl load /System/Library/LaunchDaemons/ssh.plist"
464
464
  ]
@@ -467,7 +467,7 @@ describe Beaker do
467
467
 
468
468
  it "can set the environment on an ssh-based linux host" do
469
469
  commands = [
470
- "echo 'PermitUserEnvironment yes' >> /etc/ssh/sshd_config",
470
+ "echo 'PermitUserEnvironment yes\n' >> /etc/ssh/sshd_config",
471
471
  "service ssh restart"
472
472
  ]
473
473
  set_env_helper('ubuntu', commands)
@@ -475,7 +475,7 @@ describe Beaker do
475
475
 
476
476
  it "can set the environment on an sshd-based linux host" do
477
477
  commands = [
478
- "echo 'PermitUserEnvironment yes' >> /etc/ssh/sshd_config",
478
+ "echo 'PermitUserEnvironment yes\n' >> /etc/ssh/sshd_config",
479
479
  "service sshd restart"
480
480
  ]
481
481
  set_env_helper('eos', commands)
@@ -483,7 +483,7 @@ describe Beaker do
483
483
 
484
484
  it "can set the environment on an sles host" do
485
485
  commands = [
486
- "echo 'PermitUserEnvironment yes' >> /etc/ssh/sshd_config",
486
+ "echo 'PermitUserEnvironment yes\n' >> /etc/ssh/sshd_config",
487
487
  "rcsshd restart"
488
488
  ]
489
489
  set_env_helper('sles', commands)
@@ -491,7 +491,7 @@ describe Beaker do
491
491
 
492
492
  it "can set the environment on a solaris host" do
493
493
  commands = [
494
- "echo 'PermitUserEnvironment yes' >> /etc/ssh/sshd_config",
494
+ "echo 'PermitUserEnvironment yes\n' >> /etc/ssh/sshd_config",
495
495
  "svcadm restart svc:/network/ssh:default"
496
496
  ]
497
497
  set_env_helper('solaris', commands)
@@ -499,7 +499,7 @@ describe Beaker do
499
499
 
500
500
  it "can set the environment on an aix host" do
501
501
  commands = [
502
- "echo 'PermitUserEnvironment yes' >> /etc/ssh/sshd_config",
502
+ "echo 'PermitUserEnvironment yes\n' >> /etc/ssh/sshd_config",
503
503
  "stopsrc -g ssh",
504
504
  "startsrc -g ssh"
505
505
  ]
@@ -200,7 +200,7 @@ module Beaker
200
200
  result.exit_code = 0
201
201
  expect( Beaker::Command ).to receive(:new).with(/grep KEY ~\/\.ssh\/environment/)
202
202
  expect( host ).to receive(:exec).and_return(result)
203
- expect( Beaker::Command ).to receive(:new).with("sed -i -e \"s/KEY=/KEY=\\/my\\/first\\/value:/\" ~/.ssh/environment")
203
+ expect( Beaker::SedCommand ).to receive(:new).with('unix', 's/KEY=/KEY=\\/my\\/first\\/value:/', '~/.ssh/environment')
204
204
  host.add_env_var('key', '/my/first/value')
205
205
  end
206
206
 
@@ -208,8 +208,8 @@ module Beaker
208
208
 
209
209
  describe "#delete_env_var" do
210
210
  it "deletes env var" do
211
- expect( Beaker::Command ).to receive(:new).with("sed -i -e \"/key=\\/my\\/first\\/value$/d\" ~/.ssh/environment")
212
- expect( Beaker::Command ).to receive(:new).with("sed -i -e \"s/key=\\(.*[:;]*\\)\\/my\\/first\\/value[:;]*/key=\\1/\" ~/.ssh/environment")
211
+ expect( Beaker::SedCommand ).to receive(:new).with('unix', '/key=\\/my\\/first\\/value$/d', '~/.ssh/environment')
212
+ expect( Beaker::SedCommand ).to receive(:new).with('unix', 's/key=\\(.*[:;]*\\)\\/my\\/first\\/value[:;]*/key=\\1/', '~/.ssh/environment')
213
213
  host.delete_env_var('key', '/my/first/value')
214
214
  end
215
215
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: beaker
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.0
4
+ version: 2.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Puppetlabs
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-12-05 00:00:00.000000000 Z
11
+ date: 2014-12-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rspec
@@ -520,68 +520,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
520
520
  version: '0'
521
521
  requirements: []
522
522
  rubyforge_project:
523
- rubygems_version: 2.2.2
523
+ rubygems_version: 2.4.5
524
524
  signing_key:
525
525
  specification_version: 4
526
526
  summary: Let's test Puppet!
527
- test_files:
528
- - spec/beaker/answers_spec.rb
529
- - spec/beaker/cli_spec.rb
530
- - spec/beaker/command_spec.rb
531
- - spec/beaker/dsl/assertions_spec.rb
532
- - spec/beaker/dsl/ezbake_utils_spec.rb
533
- - spec/beaker/dsl/helpers_spec.rb
534
- - spec/beaker/dsl/install_utils_spec.rb
535
- - spec/beaker/dsl/outcomes_spec.rb
536
- - spec/beaker/dsl/roles_spec.rb
537
- - spec/beaker/dsl/structure_spec.rb
538
- - spec/beaker/dsl/wrappers_spec.rb
539
- - spec/beaker/host/mac/group_spec.rb
540
- - spec/beaker/host/mac/user_spec.rb
541
- - spec/beaker/host/unix/pkg_spec.rb
542
- - spec/beaker/host/windows/group_spec.rb
543
- - spec/beaker/host_prebuilt_steps_spec.rb
544
- - spec/beaker/host_spec.rb
545
- - spec/beaker/hypervisor/aixer_spec.rb
546
- - spec/beaker/hypervisor/aws_sdk_spec.rb
547
- - spec/beaker/hypervisor/docker_spec.rb
548
- - spec/beaker/hypervisor/ec2_helper_spec.rb
549
- - spec/beaker/hypervisor/fusion_spec.rb
550
- - spec/beaker/hypervisor/hypervisor_spec.rb
551
- - spec/beaker/hypervisor/hypervisor_spec.rb.orig
552
- - spec/beaker/hypervisor/solaris_spec.rb
553
- - spec/beaker/hypervisor/vagrant_fusion_spec.rb
554
- - spec/beaker/hypervisor/vagrant_libvirt_spec.rb
555
- - spec/beaker/hypervisor/vagrant_spec.rb
556
- - spec/beaker/hypervisor/vagrant_virtualbox_spec.rb
557
- - spec/beaker/hypervisor/vagrant_workstation_spec.rb
558
- - spec/beaker/hypervisor/vcloud_pooled_spec.rb
559
- - spec/beaker/hypervisor/vcloud_spec.rb
560
- - spec/beaker/hypervisor/vsphere_helper_spec.rb
561
- - spec/beaker/hypervisor/vsphere_spec.rb
562
- - spec/beaker/logger_spec.rb
563
- - spec/beaker/options/command_line_parser_spec.rb
564
- - spec/beaker/options/data/badyaml.cfg
565
- - spec/beaker/options/data/hosts.cfg
566
- - spec/beaker/options/data/opts.txt
567
- - spec/beaker/options/hosts_file_parser_spec.rb
568
- - spec/beaker/options/options_file_parser_spec.rb
569
- - spec/beaker/options/options_hash_spec.rb
570
- - spec/beaker/options/parser_spec.rb
571
- - spec/beaker/options/pe_version_scaper_spec.rb
572
- - spec/beaker/options/presets_spec.rb
573
- - spec/beaker/perf_spec.rb
574
- - spec/beaker/platform_spec.rb
575
- - spec/beaker/shared/error_handler_spec.rb
576
- - spec/beaker/shared/host_manager_spec.rb
577
- - spec/beaker/shared/repetition_spec.rb
578
- - spec/beaker/ssh_connection_spec.rb
579
- - spec/beaker/test_case_spec.rb
580
- - spec/beaker/test_suite_spec.rb
581
- - spec/helpers.rb
582
- - spec/matchers.rb
583
- - spec/mock_fission.rb
584
- - spec/mock_vsphere.rb
585
- - spec/mock_vsphere_helper.rb
586
- - spec/mocks.rb
587
- - spec/spec_helper.rb
527
+ test_files: []
528
+ has_rdoc: