beaker-puppet 0.4.0 → 0.5.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
- MjgzZGZhY2JiYmM4NjY2Zjc0YjRiMzQ1YzQxNzE4MmIzNDU5MGRmYw==
4
+ MTY2MTE4NTMxZTBmZjRjMmM2ZmJjMGE0N2NmZjUyZTIxMzU2ZmEyZQ==
5
5
  data.tar.gz: !binary |-
6
- ZTgxMWY1OWYyNWI5ODg3MWRjOTQ2MTcwZDUyM2RhYjg1Njg1ZGZkZg==
6
+ MGJhNmFmZmRlMmE2YzM0NTM0MmY5NWY1MTYyYTk4NjM0NmYyY2M4Mw==
7
7
  SHA512:
8
8
  metadata.gz: !binary |-
9
- NDA0YWRiZjE0MTYzODFiNTRjY2EwY2MwY2IyOWQ4ZjRmYTIwZjVkZjcxZWM1
10
- ZjVmZmE5ZDcwYzI1ZjdmYmIwNzJlMzY1N2JmZTk3MmI4ODAyZWQxZDc2M2Mw
11
- N2M0MjFhOWYwMDliYWJkMmYzODg1NTdiMThlOGEyZDNmODEzMWE=
9
+ YzYzMTgxMWU1NTUxNDZkN2FiNjA0MTU0ZTVhYjFiMmQyYmM3MDY1ZTY0OWQw
10
+ ZDAxNjQ4ZTJjN2Y5MjE3MjRkNzU3N2IwOTJjODYwM2Y5MWY5ZmM1NjQ5NzNm
11
+ OTVjMGRjNTQ4NmEwYjIyODc3OTJkOTdhOGY3NGQzMWVhZDhlNmI=
12
12
  data.tar.gz: !binary |-
13
- Zjg1NDA2Y2E5Yzg5ZWViYTllNTYzZjJjNGU0YTM1ZGQ3MTIwNjZmMjcyZmZh
14
- NDM4ZDJjNjc0OGU2ZTE3N2Q4ZWZmYjU2ZWIxNDZlNjZhMTU2ZWU2OTIwMzYx
15
- MmM3NzA2OWMyMzkxMGVhZDFmYjc3NDk4ZGM0ZTc0MTQwOTMwNzI=
13
+ MmYyYTZjZTk1MTZkNTU4MjMxNDI2MmFmNzg0NGFhMzlkYmY0ZDY4MmI4ZTU3
14
+ ZWRhNzBjMGQ4ODc3MWFkMzY2YzgyNWFmODUyODRkYWNhODEyMjZhZGVlNzg2
15
+ MmVjM2VjNDgzZmMzYjI0MTU3YmI5ODRhMzNhZWE5MjViMTZlMmM=
@@ -33,6 +33,7 @@ Gem::Specification.new do |s|
33
33
  # Run time dependencies
34
34
  s.add_runtime_dependency 'stringify-hash', '~> 0.0.0'
35
35
  s.add_runtime_dependency 'in-parallel', '~> 0.1'
36
+ s.add_runtime_dependency 'oga'
36
37
 
37
38
  end
38
39
 
@@ -744,17 +744,26 @@ module Beaker
744
744
  # Empty string if none found.
745
745
  # @api private
746
746
  def get_latest_puppet_agent_build_from_url(url)
747
- require 'nokogiri'
748
- require 'open-uri'
749
- page = Nokogiri::HTML(open("#{url}/?C=M;O=A"))
750
- agents = page.css('a').children.select{ |link| link.to_s.include? 'puppet-agent' }
751
- re = /puppet-agent-(.*)-1/
752
- latest_match = agents[-1].to_s.match re
747
+ require 'oga'
748
+ require 'net/http'
749
+ body = Net::HTTP.get(URI.parse("#{url}/index_by_lastModified_reverse.html"))
750
+ document = Oga.parse_html(body)
751
+ agents = document.xpath('//a[contains(@href, "puppet-agent")]')
752
+
753
+ latest_match = agents.shift.attributes[0].value
754
+ while (latest_match =~ /puppet-agent-\d(.*)/).nil?
755
+ latest_match = agents.shift.attributes[0].value
756
+ end
757
+
758
+ re = /puppet-agent-(.*)-/
759
+ latest_match = latest_match.match re
760
+
753
761
  if latest_match
754
762
  latest = latest_match[1]
755
763
  else
756
764
  latest = ''
757
765
  end
766
+ return latest
758
767
  end
759
768
 
760
769
  # Installs Puppet and dependencies from OpenBSD packages
@@ -997,11 +1006,6 @@ module Beaker
997
1006
  # pushing them to the given host.
998
1007
  # @param [Hash{Symbol=>String}] opts Options to alter execution.
999
1008
  # @option opts [String] :dev_builds_url The URL to look for dev builds.
1000
- # @option opts [String, Array<String>] :dev_builds_repos The repo(s)
1001
- # to check for dev builds in.
1002
- #
1003
- # @note puppet-agent requires :dev_builds_repos to be set to the
1004
- # puppet collection(s) to set the build server URL appropriately.
1005
1009
  #
1006
1010
  # @note This method only works on redhat-like and debian-like hosts.
1007
1011
  #
@@ -1121,7 +1125,6 @@ module Beaker
1121
1125
  if arch== 's390x' || host['hypervisor'] == 'ec2'
1122
1126
  logger.trace("#install_puppet_agent_dev_repo_on: unsupported host #{host} for repo detected. using dev package")
1123
1127
  else
1124
- opts[:dev_builds_repos] ||= [ opts[:puppet_collection] ]
1125
1128
  install_puppetlabs_dev_repo( host, 'puppet-agent', puppet_agent_version, nil, opts )
1126
1129
  host.install_package('puppet-agent')
1127
1130
  logger.trace("#install_puppet_agent_dev_repo_on: install_puppetlabs_dev_repo finished")
@@ -1,3 +1,3 @@
1
1
  module BeakerPuppet
2
- VERSION = '0.4.0'
2
+ VERSION = '0.5.0'
3
3
  end
@@ -2,6 +2,7 @@ require 'spec_helper'
2
2
 
3
3
  class ClassMixedWithDSLInstallUtils
4
4
  include Beaker::DSL::InstallUtils
5
+ include Beaker::DSL::InstallUtils::FOSSUtils
5
6
  include Beaker::DSL::Wrappers
6
7
  include Beaker::DSL::Helpers
7
8
  include Beaker::DSL::Structure
@@ -27,7 +28,7 @@ describe ClassMixedWithDSLInstallUtils do
27
28
  basic_hosts[3][:platform] = 'eos'
28
29
  basic_hosts }
29
30
  let(:hosts_sorted) { [ hosts[1], hosts[0], hosts[2], hosts[3] ] }
30
- let(:winhost) { make_host( 'winhost', { :platform => 'windows',
31
+ let(:winhost) { make_host( 'winhost', { :platform => Beaker::Platform.new('windows-2008r2-64'),
31
32
  :pe_ver => '3.0',
32
33
  :working_dir => '/tmp',
33
34
  :type => 'foss',
@@ -305,9 +306,9 @@ describe ClassMixedWithDSLInstallUtils do
305
306
 
306
307
  it 'installs puppet on cygwin windows' do
307
308
  allow(subject).to receive(:link_exists?).and_return( true )
308
- expect(subject).to receive(:on).with(winhost, "curl -o \"#{win_temp}\\puppet-3.7.1.msi\" -O http://downloads.puppetlabs.com/windows/puppet-3.7.1.msi")
309
+ expect(subject).to receive(:on).with(winhost, "curl -o \"#{win_temp}\\puppet-3.7.1-x64.msi\" -O http://downloads.puppetlabs.com/windows/puppet-3.7.1-x64.msi")
309
310
  expect(subject).to receive(:on).with(winhost, " echo 'export PATH=$PATH:\"/cygdrive/c/Program Files (x86)/Puppet Labs/Puppet/bin\":\"/cygdrive/c/Program Files/Puppet Labs/Puppet/bin\"' > /etc/bash.bashrc ")
310
- expect(subject).to receive(:install_msi_on).with(winhost, "#{win_temp}\\puppet-3.7.1.msi", {}, {:debug => nil})
311
+ expect(subject).to receive(:install_msi_on).with(winhost, "#{win_temp}\\puppet-3.7.1-x64.msi", {}, {:debug => nil})
311
312
 
312
313
  subject.install_puppet_from_msi( winhost, {:version => '3.7.1', :win_download_url => 'http://downloads.puppetlabs.com/windows'} )
313
314
  end
@@ -1043,20 +1044,17 @@ describe ClassMixedWithDSLInstallUtils do
1043
1044
  end
1044
1045
 
1045
1046
  it 'runs the correct install for windows platforms' do
1046
- platform = Object.new()
1047
- allow(platform).to receive(:to_array) { ['windows', '5', 'x64']}
1048
1047
  host = winhost
1049
1048
  external_copy_base = 'tmp_install_windows_copy_base_1325'
1050
1049
  allow( host ).to receive( :external_copy_base ).and_return( external_copy_base )
1051
- host['platform'] = platform
1052
1050
  opts = { :version => '0.1.0' }
1053
1051
  allow( subject ).to receive( :options ).and_return( {} )
1054
- copied_path = "#{win_temp}\\puppet-agent-0.1.0-x86.msi"
1052
+ copied_path = "#{win_temp}\\puppet-agent-0.1.0-x64.msi"
1055
1053
  mock_echo = Object.new()
1056
1054
  allow( mock_echo ).to receive( :raw_output ).and_return( copied_path )
1057
1055
 
1058
- expect(subject).to receive(:fetch_http_file).once.with(/\/windows$/, 'puppet-agent-0.1.0-x86.msi', /\/windows$/)
1059
- expect(subject).to receive(:scp_to).once.with(host, /\/puppet-agent-0.1.0-x86.msi$/, /#{external_copy_base}/)
1056
+ expect(subject).to receive(:fetch_http_file).once.with(/\/windows$/, 'puppet-agent-0.1.0-x64.msi', /\/windows$/)
1057
+ expect(subject).to receive(:scp_to).once.with(host, /\/puppet-agent-0.1.0-x64.msi$/, /#{external_copy_base}/)
1060
1058
  expect(subject).to receive(:install_msi_on).with(host, copied_path, {}, {:debug => nil}).once
1061
1059
  expect(subject).to receive(:on).ordered.with(host, /echo/).and_return(mock_echo)
1062
1060
 
@@ -1159,7 +1157,7 @@ describe ClassMixedWithDSLInstallUtils do
1159
1157
  expect( subject ).to receive( :install_msi_on ).with( any_args )
1160
1158
  copy_base = 'copy_base_cygwin'
1161
1159
  allow( host ).to receive( :external_copy_base ).and_return( copy_base )
1162
- expect( subject ).to receive( :scp_to ).with( host, /puppet-agent-1\.0\.0-x86\.msi/, /#{copy_base}/ )
1160
+ expect( subject ).to receive( :scp_to ).with( host, /puppet-agent-1\.0\.0-x64\.msi/, /#{copy_base}/ )
1163
1161
  expect( subject ).to receive( :configure_type_defaults_on ).with(host)
1164
1162
  expect( subject ).to receive( :fetch_http_file ).with( /[^\/]\z/, anything, anything )
1165
1163
  subject.install_puppet_agent_dev_repo_on( host, opts.merge({ :puppet_agent_version => '1.0.0' }) )
@@ -1330,4 +1328,18 @@ describe ClassMixedWithDSLInstallUtils do
1330
1328
 
1331
1329
  end
1332
1330
 
1331
+ describe '#get_latest_puppet_agent_build_from_url' do
1332
+ let(:urls) {['https://downloads.puppetlabs.com/mac/10.9/PC1/x86_64',
1333
+ 'https://downloads.puppetlabs.com/mac/10.10/PC1/x86_64',
1334
+ 'https://downloads.puppetlabs.com/mac/10.11/PC1/x86_64',
1335
+ 'https://downloads.puppetlabs.com/mac/10.12/PC1/x86_64',
1336
+ 'https://downloads.puppetlabs.com/windows']}
1337
+
1338
+ it "gets the right version" do
1339
+ urls.each do |url|
1340
+ expect(subject.get_latest_puppet_agent_build_from_url(url)).to match(/\d*.\d*.\d*/)
1341
+ end
1342
+ end
1343
+ end
1344
+
1333
1345
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: beaker-puppet
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.0
4
+ version: 0.5.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Puppet
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-07-26 00:00:00.000000000 Z
11
+ date: 2017-08-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rspec
@@ -164,6 +164,20 @@ dependencies:
164
164
  - - ~>
165
165
  - !ruby/object:Gem::Version
166
166
  version: '0.1'
167
+ - !ruby/object:Gem::Dependency
168
+ name: oga
169
+ requirement: !ruby/object:Gem::Requirement
170
+ requirements:
171
+ - - ! '>='
172
+ - !ruby/object:Gem::Version
173
+ version: '0'
174
+ type: :runtime
175
+ prerelease: false
176
+ version_requirements: !ruby/object:Gem::Requirement
177
+ requirements:
178
+ - - ! '>='
179
+ - !ruby/object:Gem::Version
180
+ version: '0'
167
181
  description: For use for the Beaker acceptance testing tool
168
182
  email:
169
183
  - delivery@puppet.com