beaker-pe 1.40.7 → 1.41.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: 13b9a267af89667c3168a4aa6a267cf2ea954ef9
4
- data.tar.gz: 242ee943235059d01652b11d142c89b5d31df6dd
3
+ metadata.gz: 0722a3c91c3e74512eecedbbf30bf2f9e1d281f2
4
+ data.tar.gz: 54c23d3e7de6c26893f63ee02a78f3b2e9373e5c
5
5
  SHA512:
6
- metadata.gz: a1bc4764587f3951b6dfb3b2080ad7b15c95140197fb43fa655485dedd00a04aeef4f305fb81a9978a9ab73cd4a6943eb2dffd7853d1d8bf6c888592e8831ebd
7
- data.tar.gz: 114e4129d42b8b9aba12359507931426ba5f541b0aeb4d9e38cbe5781fb7016cd36c6de5d5d8c2c56c34854fe71b7b7738c2514b830e3404c17b5f5bb309e3e9
6
+ metadata.gz: 4df8660e8ca9ae7ba3db2a821abcb74a684a0ba7c7797bad1840ea9ed1df97f674774a861941b742de842510c96857aa69fd16078308b90c373a5538ac19a515
7
+ data.tar.gz: 04b0e7101905a5cb651d9978a5f6ae701bdfe6caefac2c813931a4fd56a6f28eca6c50df134353240edba7a3217213d30bd35cb5f32394de6a27b50c6ee1fa3c
data/lib/beaker-pe.rb CHANGED
@@ -1,5 +1,6 @@
1
1
  require 'stringify-hash'
2
2
  require 'beaker-pe/version'
3
+ require 'beaker-pe/install/pe_defaults'
3
4
  require 'beaker-pe/install/pe_utils'
4
5
  require 'beaker-pe/options/pe_version_scraper'
5
6
  require 'beaker-pe/pe-client-tools/config_file_helper'
@@ -9,6 +10,7 @@ require 'beaker-pe/pe-client-tools/executable_helper'
9
10
  module Beaker
10
11
  module DSL
11
12
  module PE
13
+ include Beaker::DSL::InstallUtils::PEDefaults
12
14
  include Beaker::DSL::InstallUtils::PEUtils
13
15
  include Beaker::DSL::InstallUtils::PEClientTools
14
16
  include Beaker::Options::PEVersionScraper
@@ -0,0 +1,143 @@
1
+ module Beaker
2
+ module DSL
3
+ module InstallUtils
4
+ #
5
+ # This module contains default values for pe paths and directorys per-platform
6
+ #
7
+ module PEDefaults
8
+
9
+ #Here be the pathing and default values for PE installs
10
+ #
11
+ PE_DEFAULTS = {
12
+ 'mac' => {
13
+ 'puppetserver-confdir' => '/etc/puppetlabs/puppetserver/conf.d',
14
+ 'puppetservice' => 'pe-puppetserver',
15
+ 'puppetpath' => '/etc/puppetlabs/puppet',
16
+ 'puppetconfdir' => '/etc/puppetlabs/puppet',
17
+ 'puppetcodedir' => '/etc/puppetlabs/puppet',
18
+ 'puppetbin' => '/opt/puppet/bin/puppet',
19
+ 'puppetbindir' => '/opt/puppet/bin',
20
+ 'puppetsbindir' => '/opt/puppet/sbin',
21
+ 'puppetvardir' => '/var/opt/lib/pe-puppet',
22
+ 'hieradatadir' => '/var/lib/hiera',
23
+ 'hieraconf' => '/etc/puppetlabs/puppet/hiera.yaml',
24
+ 'distmoduledir' => '/etc/puppetlabs/puppet/modules',
25
+ 'sitemoduledir' => '/opt/puppet/share/puppet/modules',
26
+ },
27
+ 'unix' => {
28
+ 'puppetserver-confdir' => '/etc/puppetlabs/puppetserver/conf.d',
29
+ 'puppetservice' => 'pe-puppetserver',
30
+ 'puppetpath' => '/etc/puppetlabs/puppet',
31
+ 'puppetconfdir' => '/etc/puppetlabs/puppet',
32
+ 'puppetbin' => '/opt/puppet/bin/puppet',
33
+ 'puppetbindir' => '/opt/puppet/bin',
34
+ 'puppetsbindir' => '/opt/puppet/sbin',
35
+ 'privatebindir' => '/opt/puppet/bin',
36
+ 'puppetvardir' => '/var/opt/lib/pe-puppet',
37
+ 'hieradatadir' => '/var/lib/hiera',
38
+ 'hieraconf' => '/etc/puppetlabs/puppet/hiera.yaml',
39
+ 'distmoduledir' => '/etc/puppetlabs/puppet/modules',
40
+ 'sitemoduledir' => '/opt/puppet/share/puppet/modules',
41
+ },
42
+ 'windows' => { #cygwin windows
43
+ 'puppetservice' => 'pe-puppetserver',
44
+ 'puppetpath' => '`cygpath -smF 35`/PuppetLabs/puppet/etc',
45
+ 'puppetconfdir' => '`cygpath -smF 35`/PuppetLabs/puppet/etc',
46
+ 'puppetcodedir' => '`cygpath -smF 35`/PuppetLabs/puppet/etc',
47
+ 'hieraconf' => '`cygpath -smF 35`/Puppetlabs/puppet/etc/hiera.yaml',
48
+ 'puppetvardir' => '`cygpath -smF 35`/PuppetLabs/puppet/var',
49
+ 'distmoduledir' => '`cygpath -smF 35`/PuppetLabs/puppet/etc/modules',
50
+ 'sitemoduledir' => 'C:/usr/share/puppet/modules',
51
+ #let's just add both potential bin dirs to the path
52
+ 'puppetbindir' => '/cygdrive/c/Program Files (x86)/Puppet Labs/Puppet Enterprise/bin:/cygdrive/c/Program Files/Puppet Labs/Puppet Enterprise/bin',
53
+ 'privatebindir' => '/cygdrive/c/Program Files (x86)/Puppet Labs/Puppet Enterprise/sys/ruby/bin:/cygdrive/c/Program Files/Puppet Labs/Puppet Enterprise/sys/ruby/bin',
54
+ },
55
+ 'pswindows' => { #windows windows
56
+ 'puppetservice' => 'pe-puppetserver',
57
+ 'puppetpath' => 'C:\\ProgramData\\PuppetLabs\\puppet\\etc',
58
+ 'puppetconfdir' => 'C:\\ProgramData\\PuppetLabs\\puppet\\etc',
59
+ 'puppetcodedir' => 'C:\\ProgramData\\PuppetLabs\\puppet\\etc',
60
+ 'hieraconf' => 'C:\\ProgramData\\PuppetLabs\\puppet\\etc\\hiera.yaml',
61
+ 'distmoduledir' => 'C:\\ProgramData\\PuppetLabs\\puppet\\etc\\modules',
62
+ 'sitemoduledir' => 'C:\\usr\\share\\puppet\\modules',
63
+ 'puppetvardir' => 'C:\\ProgramData\\PuppetLabs\\puppet\\var',
64
+ 'puppetbindir' => '"C:\\Program Files (x86)\\PuppetLabs\\Puppet Enterprise\\bin";"C:\\Program Files\\PuppetLabs\\Puppet Enterprise\\bin"'
65
+ },
66
+ }
67
+
68
+ # Add the appropriate pe defaults to the host object so that they can be accessed using host[option], set host[:type] = pe
69
+ # @param [Host] host A single host to act upon
70
+ # @param [String] platform The platform type of this host, one of windows, pswindows, mac & unix
71
+ def add_platform_pe_defaults(host, platform)
72
+ PE_DEFAULTS[platform].each_pair do |key, val|
73
+ host[key] = val
74
+ end
75
+ # add the type and group here for backwards compatability
76
+ if host['platform'] =~ /windows/
77
+ host['group'] = 'Administrators'
78
+ else
79
+ host['group'] = 'pe-puppet'
80
+ end
81
+ host['type'] = 'pe'
82
+ # older pe requires a different puppetservice name, set it here on the master
83
+ if host['roles'].include?('master')
84
+ if host['pe_ver'] and (version_is_less(host['pe_ver'], '3.4'))
85
+ host['puppetservice'] = 'pe-httpd'
86
+ end
87
+ end
88
+ end
89
+
90
+ # Add the appropriate pe defaults to an array of hosts
91
+ # @param [Host, Array<Host>, String, Symbol] hosts One or more hosts to act upon,
92
+ # or a role (String or Symbol) that identifies one or more hosts.
93
+ def add_pe_defaults_on(hosts)
94
+ block_on hosts do | host |
95
+ case host.class.to_s.downcase
96
+ when /aix|(free|open)bsd|unix/
97
+ platform = 'unix'
98
+ when /mac/
99
+ platform = 'mac'
100
+ when /pswindows/
101
+ platform = 'pswindows'
102
+ else
103
+ platform = 'windows'
104
+ end
105
+ add_platform_pe_defaults(host, platform)
106
+ end
107
+ end
108
+
109
+ # Remove the appropriate pe defaults from the host object so that they can no longer be accessed using host[option], set host[:type] = nil
110
+ # @param [Host] host A single host to act upon
111
+ # @param [String] platform The platform type of this host, one of windows, freebsd, mac & unix
112
+ def remove_platform_pe_defaults(host, platform)
113
+ PE_DEFAULTS[platform].each_pair do |key, val|
114
+ host.delete(key)
115
+ end
116
+ host['group'] = nil
117
+ host['type'] = nil
118
+ end
119
+
120
+ # Remove the appropriate pe defaults from an array of hosts
121
+ # @param [Host, Array<Host>, String, Symbol] hosts One or more hosts to act upon,
122
+ # or a role (String or Symbol) that identifies one or more hosts.
123
+ def remove_pe_defaults_on(hosts)
124
+ block_on hosts do | host |
125
+ case host.class.to_s.downcase
126
+ when /aix|(free|open)bsd|unix/
127
+ platform = 'unix'
128
+ when /mac/
129
+ platform = 'mac'
130
+ when /pswindows/
131
+ platform = 'pswindows'
132
+ else
133
+ platform = 'windows'
134
+ end
135
+ remove_platform_pe_defaults(host, platform)
136
+ end
137
+ end
138
+
139
+ end
140
+ end
141
+ end
142
+ end
143
+
@@ -3,7 +3,7 @@ module Beaker
3
3
  module PE
4
4
 
5
5
  module Version
6
- STRING = '1.40.7'
6
+ STRING = '1.41.0'
7
7
  end
8
8
 
9
9
  end
@@ -0,0 +1,63 @@
1
+ require 'spec_helper'
2
+
3
+ class ClassMixedWithDSLInstallUtils
4
+ include Beaker::DSL::InstallUtils
5
+ include Beaker::DSL::Wrappers
6
+ include Beaker::DSL::Helpers
7
+ include Beaker::DSL::Structure
8
+ include Beaker::DSL::Roles
9
+ include Beaker::DSL::Patterns
10
+
11
+ include Beaker::DSL::InstallUtils::PEDefaults
12
+
13
+ attr_accessor :hosts
14
+
15
+ def logger
16
+ @logger ||= RSpec::Mocks::Double.new('logger').as_null_object
17
+ end
18
+ end
19
+
20
+ describe ClassMixedWithDSLInstallUtils do
21
+ let(:presets) { Beaker::Options::Presets.new }
22
+ let(:opts) { presets.presets.merge(presets.env_vars) }
23
+ let(:basic_hosts) { make_hosts( { :pe_ver => @pe_ver || '3.0',
24
+ :platform => 'linux',
25
+ :roles => [ 'agent' ] }, 4 ) }
26
+ let(:hosts) { basic_hosts[0][:roles] = ['master', 'database', 'dashboard']
27
+ basic_hosts[1][:platform] = 'windows'
28
+ basic_hosts[2][:platform] = 'osx-10.9-x86_64'
29
+ basic_hosts[3][:platform] = 'eos'
30
+ basic_hosts }
31
+ let(:hosts_sorted) { [ hosts[1], hosts[0], hosts[2], hosts[3] ] }
32
+ let(:winhost) { make_host( 'winhost', { :platform => 'windows',
33
+ :pe_ver => '3.0',
34
+ :working_dir => '/tmp' } ) }
35
+ let(:machost) { make_host( 'machost', { :platform => 'osx-10.9-x86_64',
36
+ :pe_ver => '3.0',
37
+ :working_dir => '/tmp' } ) }
38
+ let(:unixhost) { make_host( 'unixhost', { :platform => 'linux',
39
+ :pe_ver => '3.0',
40
+ :working_dir => '/tmp',
41
+ :dist => 'puppet-enterprise-3.1.0-rc0-230-g36c9e5c-debian-7-i386' } ) }
42
+ let(:eoshost) { make_host( 'eoshost', { :platform => 'eos',
43
+ :pe_ver => '3.0',
44
+ :working_dir => '/tmp',
45
+ :dist => 'puppet-enterprise-3.7.1-rc0-78-gffc958f-eos-4-i386' } ) }
46
+
47
+ describe '#add_platform_pe_defaults' do
48
+ it 'sets puppetservice on master to be pe-httpd on pre-3.4 pe' do
49
+ @pe_ver = '3.3'
50
+ subject.add_platform_pe_defaults(hosts[0], 'unix')
51
+ expect(hosts[0]['puppetservice']).to be == 'pe-httpd'
52
+
53
+ end
54
+
55
+ it 'sets puppetservice on master to be pe-puppetserver on post-3.4 pe' do
56
+ @pe_ver = '3.7'
57
+ subject.add_platform_pe_defaults(hosts[0], 'unix')
58
+ expect(hosts[0]['puppetservice']).to be == 'pe-puppetserver'
59
+ end
60
+
61
+ end
62
+
63
+ 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: 1.40.7
4
+ version: 1.41.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Puppetlabs
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-06-21 00:00:00.000000000 Z
11
+ date: 2018-07-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rspec
@@ -212,6 +212,7 @@ files:
212
212
  - docs/how_to/install_puppet_enterprise.md
213
213
  - lib/beaker-pe.rb
214
214
  - lib/beaker-pe/install/feature_flags.rb
215
+ - lib/beaker-pe/install/pe_defaults.rb
215
216
  - lib/beaker-pe/install/pe_utils.rb
216
217
  - lib/beaker-pe/options/pe_version_scraper.rb
217
218
  - lib/beaker-pe/pe-client-tools/config_file_helper.rb
@@ -220,6 +221,7 @@ files:
220
221
  - lib/beaker-pe/version.rb
221
222
  - spec/beaker-pe/helpers_spec.rb
222
223
  - spec/beaker-pe/install/feature_flags_spec.rb
224
+ - spec/beaker-pe/install/pe_defaults_spec.rb
223
225
  - spec/beaker-pe/install/pe_utils_spec.rb
224
226
  - spec/beaker-pe/options/pe_version_scaper_spec.rb
225
227
  - spec/beaker-pe/pe-client-tools/config_file_helper_spec.rb