beaker-pe 0.7.0 → 0.8.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
- Mzg4ZWI5NTMwZmY5OGM5MTAxMjIzOGQxMTgxMzM2MmQzZDk5ODBlNQ==
4
+ OTQ3NDUxZjBkYmY5YjU1ZTA3YjkxYzgwYjY5MjgwZWE4ZjkxNTA2ZQ==
5
5
  data.tar.gz: !binary |-
6
- OGM3NjNlM2I2NjJhNmY4NDQ0YjI1ODEzNWQ0ODI4MGZmZmM2ODQzMA==
6
+ Y2E2M2I1YjYzMzY2YzIwM2IxNDg1MjhiNTQ5YmRmMjEwYjRjOGY4Mg==
7
7
  SHA512:
8
8
  metadata.gz: !binary |-
9
- Y2ExZWVmMzZiZmQ5Yzg3NGZlNzI3MmRmZjY1MDY4NDMyOWRmNDIyNWIxMWVi
10
- ODQzZGFiNGMwMTI3M2Y0ZmEyNDg5MTEyNDQwOGZjZDFjYjBmMzg0OWM2ODI3
11
- YjYzZGMyNmNhYjkwNzkyODQzOGU4ZDhkYTg2MDRmYzliOGYyOTc=
9
+ NTVmZjQxYjcyZjIyNDU3ZTFhMGIzNDUxZTRmZTUwMTcwYmFjZDI3MGM3ZjA1
10
+ NzZkOTNmMTEwMGY3OTllZGFjMDAzNTA4NzVmYWVkYjg0MTFiMjZjYzIxNzdi
11
+ ZjU4ZmY5NDVlYTY0MjkxZGM3NzJmYzQ3ZTU5MWFhMTJhZTRkZWU=
12
12
  data.tar.gz: !binary |-
13
- NWM5N2I5ZmNhMWI3MmVmYWRlNWE4ZDkxYzNiYTFjMWI1NTRjMWEzMmM5ZTc4
14
- ZTExYjE0NmNlN2YwMmE2ZjQxNjA4NjAyMjMwMzYzZTgwODE4MTljZWZiNGUz
15
- MmJhNDE5ZmJlNTViZjkzYTgzZDQwYjRiYzZhM2E2NWE3MGZlMGY=
13
+ NTQ5NWE3NjIyOWRhOTJkZDQ1MjU0YzdjOTc3YTY4MTE3ZDE2ODY1ZmJhNGQ5
14
+ M2MxM2NkODgyMGFkMThjMzNmMmIyYjA5NzA4MGVkODBkOGJhYzczNzJiODU0
15
+ NGQyMTU1MTNlMjM1YTRjYjgzYTAzMTFmYWMxN2MxMTkxY2VmMzM=
data/HISTORY.md CHANGED
@@ -1,6 +1,7 @@
1
1
  # default - History
2
2
  ## Tags
3
- * [LATEST - 19 Jul, 2016 (f31dbe09)](#LATEST)
3
+ * [LATEST - 2 Aug, 2016 (f4d290f2)](#LATEST)
4
+ * [0.7.0 - 19 Jul, 2016 (8256c0ac)](#0.7.0)
4
5
  * [0.6.0 - 11 Jul, 2016 (e974e7f8)](#0.6.0)
5
6
  * [0.5.0 - 15 Jun, 2016 (8f2874fe)](#0.5.0)
6
7
  * [0.4.0 - 1 Jun, 2016 (f5ad1884)](#0.4.0)
@@ -11,7 +12,90 @@
11
12
  * [0.1.0 - 29 Feb, 2016 (4fc88d8c)](#0.1.0)
12
13
 
13
14
  ## Details
14
- ### <a name = "LATEST">LATEST - 19 Jul, 2016 (f31dbe09)
15
+ ### <a name = "LATEST">LATEST - 2 Aug, 2016 (f4d290f2)
16
+
17
+ * (GEM) update beaker-pe version to 0.8.0 (f4d290f2)
18
+
19
+ * (QA-2514) PE-client-tools helpers (#15) (32d70efe)
20
+
21
+
22
+ ```
23
+ (QA-2514) PE-client-tools helpers (#15)
24
+
25
+ * (QA-2514) PE-client-tools helpers
26
+
27
+ * (maint) Add install helpers for pe-client-tools
28
+
29
+ This commit adds three helper methods to install pe-client-tools on Windows.
30
+
31
+ The first is a general method that is designed to abstract
32
+ away the installation of pe-client-tools on supported operating systems.
33
+ Currently, it only accommodates development builds of the tools based on the
34
+ provided SHA and SUITE_VERSION environment variables available.
35
+
36
+ The second is a generic method to install an msi package on a target host.
37
+ Beaker's built in method of this name assumes that msi installed involves the
38
+ installation of puppet, so this method overrides that one without such an
39
+ assumption.
40
+
41
+ The this is a generic method to install a dmg package on a target host.
42
+ Beaker's built in `install_package` method for osx does not accommodate for an
43
+ installer `pkg` file that is named differently from the containing `dmg`. This
44
+ method forces the user to supply both names explicitly.
45
+
46
+ * (maint) Remove install helpers for pe-client-tools
47
+
48
+ This commit removes the dmg and msi helper methods instroduced earlier.
49
+
50
+ These two methods have bee moved into beaker.
51
+
52
+ * basic spec tests for ExecutableHelper & ConfigFileHelper
53
+ ```
54
+ * Merge pull request #18 from demophoon/fix/master/pe-16886-pe-console-service-wait (949852c8)
55
+
56
+
57
+ ```
58
+ Merge pull request #18 from demophoon/fix/master/pe-16886-pe-console-service-wait
59
+
60
+ (PE-16886) Add wait for console to be functional before continuing with puppet agent runs
61
+ ```
62
+ * Merge pull request #17 from johnduarte/fix-install-pe_utils_spec (187a413a)
63
+
64
+
65
+ ```
66
+ Merge pull request #17 from johnduarte/fix-install-pe_utils_spec
67
+
68
+ (MAINT) Fix install/pe_utils spec test
69
+ ```
70
+ * (PE-16886) Add wait for console to be functional (eef0f254)
71
+
72
+
73
+ ```
74
+ (PE-16886) Add wait for console to be functional
75
+
76
+ Before this commit the console may or may not be functional by the time
77
+ the next puppet agent run occurs on the following node. This can cause
78
+ puppetserver to return with an error from the classifier when it is
79
+ attempting to evaluate the classes which should be applied to the node.
80
+
81
+ This commit adds in a sleep and service check to the final agent run
82
+ step on the console node which will hopefully work around this issue
83
+ until it is fixed in SERVER-1237.
84
+ ```
85
+ * (MAINT) Fix install/pe_utils spec test (5ca075ca)
86
+
87
+
88
+ ```
89
+ (MAINT) Fix install/pe_utils spec test
90
+
91
+ Changes introduced at commit 33cdfef caused the install/pe_utils
92
+ spec test to fail. This commit updates the spec test to introduce
93
+ the `opts[:HOSTS]` data that the implementation code expects to have
94
+ available.
95
+ ```
96
+ ### <a name = "0.7.0">0.7.0 - 19 Jul, 2016 (8256c0ac)
97
+
98
+ * (HISTORY) update beaker-pe history for gem release 0.7.0 (8256c0ac)
15
99
 
16
100
  * (GEM) update beaker-pe version to 0.7.0 (f31dbe09)
17
101
 
data/lib/beaker-pe.rb CHANGED
@@ -2,12 +2,18 @@ require 'stringify-hash'
2
2
  require 'beaker-pe/version'
3
3
  require 'beaker-pe/install/pe_utils'
4
4
  require 'beaker-pe/options/pe_version_scraper'
5
+ require 'beaker-pe/pe-client-tools/config_file_helper'
6
+ require 'beaker-pe/pe-client-tools/install_helper'
7
+ require 'beaker-pe/pe-client-tools/executable_helper'
5
8
 
6
9
  module Beaker
7
10
  module DSL
8
11
  module PE
9
12
  include Beaker::DSL::InstallUtils::PEUtils
13
+ include Beaker::DSL::InstallUtils::PEClientTools
10
14
  include Beaker::Options::PEVersionScraper
15
+ include Beaker::DSL::PEClientTools::ConfigFileHelper
16
+ include Beaker::DSL::PEClientTools::ExecutableHelper
11
17
  end
12
18
  end
13
19
  end
@@ -3,6 +3,7 @@
3
3
  end
4
4
  require "beaker-answers"
5
5
  require "timeout"
6
+ require "json"
6
7
  module Beaker
7
8
  module DSL
8
9
  module InstallUtils
@@ -494,6 +495,9 @@ module Beaker
494
495
  sleep_until_puppetdb_started(database)
495
496
  check_puppetdb_status_endpoint(database)
496
497
  end
498
+ if host == dashboard
499
+ check_console_status_endpoint(host)
500
+ end
497
501
  end
498
502
  end
499
503
 
@@ -523,6 +527,9 @@ module Beaker
523
527
  sleep_until_puppetdb_started(database)
524
528
  check_puppetdb_status_endpoint(database)
525
529
  end
530
+ if host == dashboard
531
+ check_console_status_endpoint(host)
532
+ end
526
533
  end
527
534
  end
528
535
  end
@@ -695,6 +702,25 @@ module Beaker
695
702
  fail_test "PuppetDB took too long to start"
696
703
  end
697
704
 
705
+ def check_console_status_endpoint(host)
706
+ if version_is_less(host['pe_ver'], '2015.2.0')
707
+ return true
708
+ end
709
+ Timeout.timeout(60) do
710
+ match = nil
711
+ while not match
712
+ output = on(host, "curl -s -k https://localhost:4433/status/v1/services --cert /etc/puppetlabs/puppet/ssl/certs/#{host}.pem --key /etc/puppetlabs/puppet/ssl/private_keys/#{host}.pem --cacert /etc/puppetlabs/puppet/ssl/certs/ca.pem", :accept_all_exit_codes => true)
713
+ output = JSON.parse(output.stdout)
714
+ match = output['classifier-service']['state'] == 'running'
715
+ match = match && output['rbac-service']['state'] == 'running'
716
+ match = match && output['activity-service']['state'] == 'running'
717
+ sleep 1
718
+ end
719
+ end
720
+ rescue Timeout::Error
721
+ fail_test "Console services took too long to start"
722
+ end
723
+
698
724
  #Install PE based upon host configuration and options
699
725
  #
700
726
  # @param [Host, Array<Host>] install_hosts One or more hosts to act upon
@@ -0,0 +1,93 @@
1
+ require "beaker/dsl/patterns"
2
+
3
+ module Beaker
4
+ module DSL
5
+ module PEClientTools
6
+ module ConfigFileHelper
7
+
8
+ # Helper method to write config files for pe-client-tools
9
+ # @param [Beaker::Host] host The beaker host that gets the config file
10
+ # @param [String] config_level 'user' or 'global'
11
+ # @param [String] tool 'access', 'code', 'db', 'query', 'orchestrator', 'job', 'app'
12
+ # @param [String] contents The contents of the config file
13
+ def write_client_tool_config_on(host, config_level, tool, contents)
14
+
15
+ # TODO take a hash and parse file or take literal string
16
+
17
+ file = "#{Private.config_path(host, config_level)}/#{Private.file_name(tool)}"
18
+ create_remote_file(host, file, contents)
19
+ end
20
+
21
+
22
+ class Private
23
+
24
+ require 'beaker/dsl/patterns'
25
+
26
+ extend Beaker::DSL
27
+ extend Beaker::DSL::Patterns
28
+
29
+ def self.file_name(tool)
30
+ if tool =~ /orchestrator|job|app/i
31
+ 'puppet-orchestrator.conf'
32
+ elsif tool =~ /code/i
33
+ 'puppet-code.conf'
34
+ elsif tool =~ /access/i
35
+ 'puppet-access.conf'
36
+ elsif tool =~ /db|query/i
37
+ 'puppetdb.conf'
38
+ else
39
+ raise ArgumentError.new("Unknown pe-client-tool type '#{tool}'")
40
+ end
41
+ end
42
+
43
+ def self.config_path(host, config_level)
44
+
45
+ puppetlabs_dir = 'puppetlabs'
46
+ puppetlabs_dir.prepend('.') if config_level == 'user'
47
+ client_tools_path_array = [puppetlabs_dir, 'client-tools']
48
+
49
+ case config_level
50
+
51
+ when /global/
52
+ @base_path = global_base_path(host)
53
+ when /user/
54
+ @base_path = home_dir(host)
55
+ else
56
+ raise ArgumentError.new("Unknown config level #{config_level}")
57
+ end
58
+
59
+ client_tools_dir = client_tools_path_array.unshift(@base_path).join(path_separator(host))
60
+ opts = {:cmdexe => true}
61
+
62
+ if host.platform =~ /win/
63
+ host.exec(Beaker::Command.new('MD', [client_tools_dir.gsub('\\', '\\\\\\')], opts), :accept_all_exit_codes => true)
64
+ else
65
+ host.exec(Beaker::Command.new("mkdir -p #{client_tools_dir}", [], opts), :accept_all_exit_codes => true)
66
+ end
67
+ client_tools_dir
68
+ end
69
+
70
+ def self.home_dir(host)
71
+
72
+ if (host.platform =~ /win/) then
73
+ @cmd = Beaker::Command.new('echo', ['%userprofile%'], :cmdexe => true)
74
+ else
75
+ @cmd = Beaker::Command.new('echo', ['$HOME'])
76
+ end
77
+ host.exec(@cmd).stdout.chomp
78
+ end
79
+
80
+ def self.global_base_path(host)
81
+
82
+ (host.platform =~ /win/) ?host.exec(Beaker::Command.new('echo', ['%PROGRAMDATA%'], :cmdexe => true)).stdout.chomp : '/etc//'
83
+ end
84
+
85
+ def self.path_separator(host)
86
+
87
+ (host.platform =~ /win/) ? '\\' : '/'
88
+ end
89
+ end
90
+ end
91
+ end
92
+ end
93
+ end
@@ -0,0 +1,157 @@
1
+ require "beaker/dsl/patterns"
2
+ require "beaker/dsl/helpers"
3
+ require "beaker/dsl/wrappers"
4
+
5
+ module Beaker
6
+ module DSL
7
+ module PEClientTools
8
+ module ExecutableHelper
9
+
10
+ # puppet-access helper win/lin/osx
11
+ # @param [BEAKER::Host] host The SUT that should run the puppet-access command
12
+ # @param [String] args The arguments to puppet-access
13
+ # @param [Hash] opts options hash to the Beaker Command
14
+ # @param [Block] &block optional block
15
+ def puppet_access_on(*args, &block)
16
+ Private.new.tool(:access, *args, &block)
17
+ end
18
+
19
+ # puppet-code helper win/lin/osx
20
+ # @param [BEAKER::Host] host The SUT that should run the puppet-code command
21
+ # @param [String] args The arguments to puppet-code
22
+ # @param [Hash] opts options hash to the Beaker Command
23
+ # @param [Block] &block optional block
24
+ def puppet_code_on(*args, &block)
25
+ Private.new.tool(:code, *args, &block)
26
+ end
27
+
28
+ # puppet-job helper win/lin/osx
29
+ # @param [BEAKER::Host] host The SUT that should run the puppet-job command
30
+ # @param [String] args The arguments to puppet-job
31
+ # @param [Hash] opts options hash to the Beaker Command
32
+ # @param [Block] &block optional block
33
+ def puppet_job_on(*args, &block)
34
+ Private.new.tool(:job, *args, &block)
35
+ end
36
+
37
+ # puppet-app helper win/lin/osx
38
+ # @param [BEAKER::Host] host The SUT that should run the puppet-app command
39
+ # @param [String] args The arguments to puppet-app
40
+ # @param [Hash] opts options hash to the Beaker Command
41
+ # @param [Block] &block optional block
42
+ def puppet_app_on(*args, &block)
43
+ Private.new.tool(:app, *args, &block)
44
+ end
45
+
46
+ # puppet-db helper win/lin/osx
47
+ # @param [BEAKER::Host] host The SUT that should run the puppet-db command
48
+ # @param [String] args The arguments to puppet-db
49
+ # @param [Hash] opts options hash to the Beaker Command
50
+ # @param [Block] &block optional block
51
+ def puppet_db_on(*args, &block)
52
+ Private.new.tool(:db, *args, &block)
53
+ end
54
+
55
+ # puppet-query helper win/lin/osx
56
+ # @param [BEAKER::Host] host The SUT that should run the puppet-query command
57
+ # @param [String] args The arguments to puppet-query
58
+ # @param [Hash] opts options hash to the Beaker Command
59
+ # @param [Block] &block optional block
60
+ def puppet_query_on(*args, &block)
61
+ Private.new.tool(:query, *args, &block)
62
+ end
63
+
64
+ # Logs a user in on a SUT with puppet-access/RBAC API (windows)
65
+ # @param [Beaker::Host] host The SUT to perform the login on
66
+ # @param [Scooter::HttpDispatchers::ConsoleDispatcher] credentialed_dispatcher A Scooter dispatcher that has credentials for the user
67
+ # @option attribute_hash [String] :name The environment variable
68
+ # @option attribute_hash [String] :default The default value for the environment variable
69
+ # @option attribute_hash [String] :message A message describing the use of this variable
70
+ # @option attribute_hash [Boolean] :required Used internally by CommandFlag, ignored for a standalone EnvVar
71
+ def login_with_puppet_access_on(host, credentialed_dispatcher, opts={})
72
+
73
+ lifetime = opts[:lifetime] || nil
74
+ unless host.platform =~ /win/
75
+
76
+ user = credentialed_dispatcher.credentials.login
77
+ password = credentialed_dispatcher.credentials.password
78
+ puppet_access_on(host, 'login', {:stdin => "#{user}\n#{password}\n"})
79
+ else
80
+
81
+ # this is a hack
82
+ # puppet-access needs to support alternative to interactive login
83
+ # create .puppetlabs dir
84
+ cmd = Beaker::Command.new('echo', ['%userprofile%'], :cmdexe => true)
85
+ user_home_dir = host.exec(cmd).stdout.chomp
86
+ win_token_path = "#{user_home_dir}\\.puppetlabs\\"
87
+ host.exec(Beaker::Command.new('MD', [win_token_path.gsub('\\', '\\\\\\')], :cmdexe => true), :accept_all_exit_codes => true)
88
+
89
+ token = credentialed_dispatcher.acquire_token_with_credentials(lifetime)
90
+ create_remote_file(host, "#{win_token_path}\\token", token)
91
+ end
92
+ end
93
+
94
+ class Private
95
+
96
+ include Beaker::DSL
97
+ include Beaker::DSL::Wrappers
98
+ include Beaker::DSL::Helpers::HostHelpers
99
+ include Beaker::DSL::Patterns
100
+
101
+ attr_accessor :logger
102
+
103
+ def tool(tool, *args, &block)
104
+
105
+ host = args.shift
106
+ @logger = host.logger
107
+ options = {}
108
+ options.merge!(args.pop) if args.last.is_a?(Hash)
109
+
110
+ if host.platform =~ /win/i
111
+
112
+ program_files = host.exec(Beaker::Command.new('echo', ['%PROGRAMFILES%'], :cmdexe => true)).stdout.chomp
113
+ client_tools_dir = "#{program_files}\\#{['Puppet Labs', 'Client', 'tools', 'bin'].join('\\')}\\"
114
+ tool_executable = "\"#{client_tools_dir}puppet-#{tool.to_s}.exe\""
115
+
116
+ #TODO does this need to be more detailed to pass exit codes????
117
+ # TODO make batch file direct output to separate file
118
+ batch_contents =<<-EOS
119
+ call #{tool_executable} #{args.join(' ')}
120
+ EOS
121
+
122
+ @command = build_win_batch_command( host, batch_contents, {:cmdexe => true})
123
+ else
124
+
125
+ tool_executable = '/opt/puppetlabs/client-tools/bin/' << "puppet-#{tool.to_s}"
126
+ @command = Beaker::Command.new(tool_executable, args, {:cmdexe => true})
127
+ end
128
+
129
+ result = host.exec(@command, options)
130
+
131
+ # Also, let additional checking be performed by the caller.
132
+ if block_given?
133
+ case block.arity
134
+ #block with arity of 0, just hand back yourself
135
+ when 0
136
+ yield self
137
+ #block with arity of 1 or greater, hand back the result object
138
+ else
139
+ yield result
140
+ end
141
+ end
142
+ result
143
+ end
144
+
145
+ def build_win_batch_command( host, batch_contents, command_options)
146
+ timestamp = Time.new.strftime('%Y-%m-%d_%H.%M.%S')
147
+ # Create Temp file
148
+ # make file fully qualified
149
+ batch_file = "#{host.system_temp_path}\\#{timestamp}.bat"
150
+ create_remote_file(host, batch_file, batch_contents)
151
+ Beaker::Command.new("\"#{batch_file}\"", [], command_options)
152
+ end
153
+ end
154
+ end
155
+ end
156
+ end
157
+ end
@@ -0,0 +1,74 @@
1
+ module Beaker
2
+ module DSL
3
+ module InstallUtils
4
+ module PEClientTools
5
+
6
+ def install_pe_client_tools_on(hosts, opts = {})
7
+ # FIXME: accomodate production released location(s)
8
+ #{{{
9
+ product = 'pe-client-tools'
10
+ required_keys = [:puppet_collection, :pe_client_tools_sha, :pe_client_tools_version]
11
+
12
+ unless required_keys.all? { |opt| opts.keys.include?(opt) }
13
+ raise ArgumentError, "The keys #{required_keys.to_s} are required in the opts hash"
14
+ end
15
+ urls = { :dev_builds_url => "http://builds.delivery.puppetlabs.net",
16
+ }
17
+
18
+ opts = urls.merge(opts)
19
+
20
+ block_on hosts do |host|
21
+ package_name = nil
22
+ variant, version, arch, codename = host['platform'].to_array
23
+ case host['platform']
24
+ when /el-|fedora|sles|centos|cisco_/
25
+ release_path = "#{opts[:dev_builds_url]}/#{product}/#{ opts[:pe_client_tools_sha] }/artifacts/#{variant}/#{version}/#{opts[:puppet_collection]}/#{arch}"
26
+ package_name = product.dup
27
+ package_name << "-#{opts[:pe_client_tools_version]}-1.#{variant}#{version}.#{arch}.rpm" if opts[:pe_client_tools_version]
28
+ when /debian|ubuntu|cumulus|huaweios/
29
+ release_path = "#{opts[:dev_builds_url]}/#{product}/#{ opts[:pe_client_tools_sha] }/artifacts/deb/#{codename}/#{opts[:puppet_collection]}"
30
+ package_name = product.dup
31
+ package_name << "_#{opts[:pe_client_tools_version]}-1#{host['platform'].codename}_#{arch}.deb" if opts[:pe_client_tools_version]
32
+ when /windows/
33
+ release_path = "#{opts[:dev_builds_url]}/#{product}/#{ opts[:pe_client_tools_sha] }/artifacts/#{variant}/#{opts[:puppet_collection]}/x#{arch}"
34
+ package_name = product.dup
35
+ package_name << "-#{opts[:pe_client_tools_version]}.1-x#{arch}_VANAGON.msi" if opts[:pe_client_tools_version]
36
+ when /osx/
37
+ release_path = "#{opts[:dev_builds_url]}/#{product}/#{ opts[:pe_client_tools_sha] }/artifacts/apple/#{version}/#{opts[:puppet_collection]}/#{arch}"
38
+ package_base = product.dup
39
+ package_base << "-#{opts[:pe_client_tools_version]}" if opts[:pe_client_tools_version]
40
+ package_name = package_base.dup
41
+ package_name << '-1' if opts[:pe_client_tools_version]
42
+ installer = package_name + '-installer.pkg'
43
+ package_name << ".#{variant}#{version}.dmg" if opts[:pe_client_tools_version]
44
+ else
45
+ raise "install_puppet_agent_on() called for unsupported " +
46
+ "platform '#{host['platform']}' on '#{host.name}'"
47
+ end
48
+
49
+ if package_name
50
+ case host['platform']
51
+ when /windows/
52
+ generic_install_msi_on(host, File.join(release_path, package_name), {}, {:debug => true})
53
+ else
54
+ copy_dir_local = File.join('tmp', 'repo_configs')
55
+ fetch_http_file(release_path, package_name, copy_dir_local)
56
+ scp_to host, File.join(copy_dir_local, package_name), host.external_copy_base
57
+
58
+ if host['platform'] =~ /debian|ubuntu|cumulus|huaweios/
59
+ on host, "dpkg -i #{package_name}"
60
+ elsif host['platform'] =~ /osx/
61
+ host.generic_install_dmg(package_name, package_base, installer)
62
+ else
63
+ host.install_package( package_name )
64
+ end
65
+ end
66
+ end
67
+ end
68
+ #}}}
69
+ end
70
+
71
+ end
72
+ end
73
+ end
74
+ end
@@ -3,7 +3,7 @@ module Beaker
3
3
  module PE
4
4
 
5
5
  module Version
6
- STRING = '0.7.0'
6
+ STRING = '0.8.0'
7
7
  end
8
8
 
9
9
  end
@@ -866,6 +866,10 @@ describe ClassMixedWithDSLInstallUtils do
866
866
  }, 2)
867
867
  hosts[0][:roles] = ['master', 'database', 'dashboard']
868
868
  hosts[1][:platform] = Beaker::Platform.new('el-6-x86_64')
869
+ opts[:HOSTS] = {}
870
+ hosts.each do |host|
871
+ opts[:HOSTS][host.name] = host
872
+ end
869
873
 
870
874
  allow( subject ).to receive( :hosts ).and_return( hosts )
871
875
  allow( subject ).to receive( :options ).and_return(Beaker::Options::Presets.new.presets)
@@ -0,0 +1,13 @@
1
+ require 'spec_helper'
2
+ require 'beaker'
3
+
4
+ class MixedWithConfigFileHelper
5
+ include Beaker::DSL::PEClientTools::ConfigFileHelper
6
+ end
7
+
8
+ describe MixedWithConfigFileHelper do
9
+
10
+ it 'has a method to write a config file' do
11
+ expect(subject.respond_to?('write_client_tool_config_on')).not_to be(false)
12
+ end
13
+ end
@@ -0,0 +1,58 @@
1
+ require 'spec_helper'
2
+ require 'beaker'
3
+
4
+ class MixedWithExecutableHelper
5
+ include Beaker::DSL::PEClientTools::ExecutableHelper
6
+ end
7
+
8
+ describe MixedWithExecutableHelper do
9
+
10
+ let(:method_name) { "puppet_#{tool}_on"}
11
+
12
+ shared_examples 'pe-client-tool'do
13
+
14
+ it 'has a method to execute the tool' do
15
+ expect(subject.respond_to?(method_name)).not_to be(false)
16
+ end
17
+ end
18
+
19
+ context 'puppet-code' do
20
+ let(:tool) {'code'}
21
+
22
+ it_behaves_like 'pe-client-tool'
23
+ end
24
+
25
+ context 'puppet-access' do
26
+ let(:tool) {'access'}
27
+
28
+ it_behaves_like 'pe-client-tool'
29
+ end
30
+
31
+ context 'puppet-job' do
32
+ let(:tool) {'job'}
33
+
34
+ it_behaves_like 'pe-client-tool'
35
+ end
36
+
37
+ context 'puppet-app' do
38
+ let(:tool) {'app'}
39
+
40
+ it_behaves_like 'pe-client-tool'
41
+ end
42
+
43
+ context 'puppet-db' do
44
+ let(:tool) {'db'}
45
+
46
+ it_behaves_like 'pe-client-tool'
47
+ end
48
+
49
+ context 'puppet-query' do
50
+ let(:tool) {'query'}
51
+
52
+ it_behaves_like 'pe-client-tool'
53
+ end
54
+
55
+ it 'has a method to login with puppet access' do
56
+ expect(subject.respond_to?('login_with_puppet_access_on')).not_to be(false)
57
+ end
58
+ end
@@ -0,0 +1,75 @@
1
+ require 'spec_helper'
2
+ require 'beaker/host'
3
+ class ClassPEClientToolsMixedWithPatterns
4
+ include Beaker::DSL::InstallUtils::PEClientTools
5
+ include Beaker::DSL::Patterns
6
+ end
7
+ describe ClassPEClientToolsMixedWithPatterns do
8
+ describe "#install_pe_client_tools_on" do
9
+ let(:hosts) do
10
+ make_hosts({:platform => platform })
11
+ end
12
+ opts = {
13
+ :puppet_collection => 'PC1',
14
+ :pe_client_tools_sha => '12345',
15
+ :pe_client_tools_version => '1.0.0-g12345'
16
+ }
17
+
18
+ before do
19
+ allow(subject). to receive(:scp_to)
20
+ end
21
+
22
+ context 'on el-6' do
23
+ let(:platform) { Beaker::Platform.new('el-6-x86_64') }
24
+ it 'installs' do
25
+ hosts.each do |host|
26
+ allow(subject). to receive(:fetch_http_file).with("http://builds.delivery.puppetlabs.net/pe-client-tools/#{opts[:pe_client_tools_sha]}/artifacts/el/6/PC1/x86_64", "pe-client-tools-#{opts[:pe_client_tools_version]}-1.el6.x86_64.rpm", "tmp/repo_configs")
27
+ allow(host). to receive(:external_copy_base)
28
+ expect(host).to receive(:install_package).with("pe-client-tools-#{opts[:pe_client_tools_version]}-1.el6.x86_64.rpm")
29
+ subject.install_pe_client_tools_on(host, opts)
30
+ end
31
+ end
32
+ end
33
+
34
+ context 'on ubuntu' do
35
+ let(:platform) { Beaker::Platform.new('ubuntu-1604-x86_64') }
36
+ it 'installs' do
37
+ hosts.each do |host|
38
+ allow(subject). to receive(:fetch_http_file).with("http://builds.delivery.puppetlabs.net/pe-client-tools/#{opts[:pe_client_tools_sha]}/artifacts/deb/xenial/PC1", "pe-client-tools_#{opts[:pe_client_tools_version]}-1xenial_x86_64.deb", "tmp/repo_configs")
39
+ allow(host). to receive(:external_copy_base)
40
+ expect(subject).to receive(:on).with(host, "dpkg -i pe-client-tools_#{opts[:pe_client_tools_version]}-1xenial_x86_64.deb")
41
+ subject.install_pe_client_tools_on(host, opts)
42
+ end
43
+ end
44
+ end
45
+
46
+ context 'on windows' do
47
+ let(:platform) { Beaker::Platform.new('windows-2012r2-x86_64') }
48
+ it 'installs' do
49
+ hosts.each do |host|
50
+ allow(subject). to receive(:fetch_http_file).with("http://builds.delivery.puppetlabs.net/pe-client-tools/#{opts[:pe_client_tools_sha]}/artifacts/deb/xenial/PC1", "pe-client-tools_#{opts[:pe_client_tools_version]}-1xenial_x86_64.deb", "tmp/repo_configs")
51
+ allow(host). to receive(:external_copy_base)
52
+ expect(subject).to receive(:generic_install_msi_on).with( host,
53
+ "http://builds.delivery.puppetlabs.net/pe-client-tools/#{opts[:pe_client_tools_sha]}/artifacts/windows/PC1/xx86_64/pe-client-tools-#{opts[:pe_client_tools_version]}.1-xx86_64_VANAGON.msi",
54
+ {},
55
+ { :debug => true }
56
+ )
57
+ subject.install_pe_client_tools_on(host, opts)
58
+ end
59
+ end
60
+ end
61
+
62
+ context 'on OS X' do
63
+ let(:platform) { Beaker::Platform.new('osx-1111-x86_64') }
64
+ it 'installs' do
65
+ hosts.each do |host|
66
+ allow(subject). to receive(:fetch_http_file).with("http://builds.delivery.puppetlabs.net/pe-client-tools/#{opts[:pe_client_tools_sha]}/artifacts/apple/1111/PC1/x86_64", "pe-client-tools-#{opts[:pe_client_tools_version]}-1.osx1111.dmg", "tmp/repo_configs")
67
+ allow(host). to receive(:external_copy_base)
68
+ expect(host).to receive(:generic_install_dmg).with("pe-client-tools-#{opts[:pe_client_tools_version]}-1.osx1111.dmg", "pe-client-tools-#{opts[:pe_client_tools_version]}", "pe-client-tools-#{opts[:pe_client_tools_version]}-1-installer.pkg")
69
+ subject.install_pe_client_tools_on(host, opts)
70
+ end
71
+ end
72
+ end
73
+
74
+ end
75
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: beaker-pe
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.7.0
4
+ version: 0.8.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Puppetlabs
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-07-19 00:00:00.000000000 Z
11
+ date: 2016-08-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rspec
@@ -173,10 +173,16 @@ files:
173
173
  - lib/beaker-pe.rb
174
174
  - lib/beaker-pe/install/pe_utils.rb
175
175
  - lib/beaker-pe/options/pe_version_scraper.rb
176
+ - lib/beaker-pe/pe-client-tools/config_file_helper.rb
177
+ - lib/beaker-pe/pe-client-tools/executable_helper.rb
178
+ - lib/beaker-pe/pe-client-tools/install_helper.rb
176
179
  - lib/beaker-pe/version.rb
177
180
  - spec/beaker-pe/helpers_spec.rb
178
181
  - spec/beaker-pe/install/pe_utils_spec.rb
179
182
  - spec/beaker-pe/options/pe_version_scaper_spec.rb
183
+ - spec/beaker-pe/pe-client-tools/config_file_helper_spec.rb
184
+ - spec/beaker-pe/pe-client-tools/executable_helper_spec.rb
185
+ - spec/beaker-pe/pe-client-tools/installer_helper_spec.rb
180
186
  - spec/helpers.rb
181
187
  - spec/spec_helper.rb
182
188
  homepage: https://github.com/puppetlabs/beaker-pe
@@ -204,4 +210,3 @@ signing_key:
204
210
  specification_version: 4
205
211
  summary: Beaker PE DSL Helpers!
206
212
  test_files: []
207
- has_rdoc: