beaker-puppeter 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 858377a6ef9b979590de1ee143314fe934673e54
4
+ data.tar.gz: 078b906e3df52501f63057e6131e8e250f7ac594
5
+ SHA512:
6
+ metadata.gz: ae3613a3cd42ba3b5b852bc6ee42de2f5d717a6efede01d64279cf3ec11b7df858cf21ca229a43067890be47803faf2020b73021689d1d714b285f6e0cbc9168
7
+ data.tar.gz: f35503722b1ab5ae8cf36d85a644dae9a86814e9e325a4fe8ed22507b69251fe6501c1cad71d153382120c28b1526f51922eb238336590775d88f7ab2da46217
@@ -0,0 +1,76 @@
1
+ # Ruby CircleCI 2.0 configuration file
2
+ # Check https://circleci.com/docs/2.0/language-ruby/ for more details
3
+ version: 2
4
+
5
+ references:
6
+ machine-defaults: &environment-defaults
7
+ machine: true
8
+ restore-cache-bundler: &restore-cache-bundler
9
+ restore_cache:
10
+ keys:
11
+ - v1-dependencies-{{ checksum "Gemfile.lock" }}
12
+ - v1-dependencies-
13
+ save-cache-bundler: &save-cache-bundler
14
+ save_cache:
15
+ paths:
16
+ - ./vendor/bundle
17
+ key: v1-dependencies-{{ checksum "Gemfile.lock" }}
18
+ bundle-install: &bundle-install
19
+ run:
20
+ name: Install dependencies with Bundler
21
+ shell: /bin/bash -leo pipefail
22
+ command: bundle install --without development --jobs=4 --retry=3 --no-deployment --path vendor/bundle
23
+ acceptance-tests: &acceptance-tests
24
+ run:
25
+ name: Run acceptance tests using Beaker
26
+ shell: /bin/bash -leo pipefail
27
+ command: bundle exec rake acceptance
28
+
29
+ steps: &steps
30
+ steps:
31
+ - checkout
32
+ - *restore-cache-bundler
33
+ - *bundle-install
34
+ - *save-cache-bundler
35
+ - *acceptance-tests
36
+
37
+ workflows:
38
+ version: 2
39
+ integration-tests:
40
+ jobs:
41
+ - centos-6-default
42
+ - centos-7-system
43
+ - debian-8-puppet4
44
+ - ubuntu-1404-puppet3
45
+ - ubuntu-1604-puppet5
46
+
47
+ jobs:
48
+ centos-6-default:
49
+ <<: *environment-defaults
50
+ <<: *steps
51
+ environment:
52
+ RS_SET: centos-6-docker
53
+ centos-7-system:
54
+ <<: *environment-defaults
55
+ <<: *steps
56
+ environment:
57
+ RS_SET: centos-7-docker
58
+ PUPPETER_ANSWERS: agent-system
59
+ ubuntu-1404-puppet3:
60
+ <<: *environment-defaults
61
+ <<: *steps
62
+ environment:
63
+ RS_SET: ubuntu-14.04-docker
64
+ PUPPETER_ANSWERS: agent-pc3x
65
+ ubuntu-1604-puppet5:
66
+ <<: *environment-defaults
67
+ <<: *steps
68
+ environment:
69
+ RS_SET: ubuntu-16.04-docker
70
+ PUPPETER_ANSWERS: agent-pc5x
71
+ debian-8-puppet4:
72
+ <<: *environment-defaults
73
+ <<: *steps
74
+ environment:
75
+ RS_SET: debian-8-docker
76
+ PUPPETER_ANSWERS: agent-pc4x
data/.gitignore ADDED
@@ -0,0 +1,14 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /_yardoc/
4
+ /coverage/
5
+ /doc/
6
+ /pkg/
7
+ /spec/reports/
8
+ /tmp/
9
+ /log/
10
+ /.vagrant/
11
+ /vendor/
12
+
13
+ # rspec failure tracking
14
+ .rspec_status
data/.rspec ADDED
@@ -0,0 +1,3 @@
1
+ --format documentation
2
+ --color
3
+ --require spec_helper
data/.travis.yml ADDED
@@ -0,0 +1,11 @@
1
+ ---
2
+ language: ruby
3
+ sudo: false
4
+ before_install: gem install bundler
5
+ bundler_args: --without development acceptancetests --jobs=3 --retry=3 --no-deployment
6
+ cache: bundler
7
+ script: bundle exec rake spec
8
+ rvm:
9
+ - '2.1'
10
+ - '2.3'
11
+ - '2.4'
@@ -0,0 +1,74 @@
1
+ # Contributor Covenant Code of Conduct
2
+
3
+ ## Our Pledge
4
+
5
+ In the interest of fostering an open and welcoming environment, we as
6
+ contributors and maintainers pledge to making participation in our project and
7
+ our community a harassment-free experience for everyone, regardless of age, body
8
+ size, disability, ethnicity, gender identity and expression, level of experience,
9
+ nationality, personal appearance, race, religion, or sexual identity and
10
+ orientation.
11
+
12
+ ## Our Standards
13
+
14
+ Examples of behavior that contributes to creating a positive environment
15
+ include:
16
+
17
+ * Using welcoming and inclusive language
18
+ * Being respectful of differing viewpoints and experiences
19
+ * Gracefully accepting constructive criticism
20
+ * Focusing on what is best for the community
21
+ * Showing empathy towards other community members
22
+
23
+ Examples of unacceptable behavior by participants include:
24
+
25
+ * The use of sexualized language or imagery and unwelcome sexual attention or
26
+ advances
27
+ * Trolling, insulting/derogatory comments, and personal or political attacks
28
+ * Public or private harassment
29
+ * Publishing others' private information, such as a physical or electronic
30
+ address, without explicit permission
31
+ * Other conduct which could reasonably be considered inappropriate in a
32
+ professional setting
33
+
34
+ ## Our Responsibilities
35
+
36
+ Project maintainers are responsible for clarifying the standards of acceptable
37
+ behavior and are expected to take appropriate and fair corrective action in
38
+ response to any instances of unacceptable behavior.
39
+
40
+ Project maintainers have the right and responsibility to remove, edit, or
41
+ reject comments, commits, code, wiki edits, issues, and other contributions
42
+ that are not aligned to this Code of Conduct, or to ban temporarily or
43
+ permanently any contributor for other behaviors that they deem inappropriate,
44
+ threatening, offensive, or harmful.
45
+
46
+ ## Scope
47
+
48
+ This Code of Conduct applies both within project spaces and in public spaces
49
+ when an individual is representing the project or its community. Examples of
50
+ representing a project or community include using an official project e-mail
51
+ address, posting via an official social media account, or acting as an appointed
52
+ representative at an online or offline event. Representation of a project may be
53
+ further defined and clarified by project maintainers.
54
+
55
+ ## Enforcement
56
+
57
+ Instances of abusive, harassing, or otherwise unacceptable behavior may be
58
+ reported by contacting the project team at krzysztof.suszynski@coi.gov.pl. All
59
+ complaints will be reviewed and investigated and will result in a response that
60
+ is deemed necessary and appropriate to the circumstances. The project team is
61
+ obligated to maintain confidentiality with regard to the reporter of an incident.
62
+ Further details of specific enforcement policies may be posted separately.
63
+
64
+ Project maintainers who do not follow or enforce the Code of Conduct in good
65
+ faith may face temporary or permanent repercussions as determined by other
66
+ members of the project's leadership.
67
+
68
+ ## Attribution
69
+
70
+ This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
71
+ available at [http://contributor-covenant.org/version/1/4][version]
72
+
73
+ [homepage]: http://contributor-covenant.org
74
+ [version]: http://contributor-covenant.org/version/1/4/
data/Gemfile ADDED
@@ -0,0 +1,23 @@
1
+ source "https://rubygems.org"
2
+
3
+ # Specify your gem's dependencies in beaker-puppeter.gemspec
4
+ gemspec
5
+
6
+ gem 'rake', require: false
7
+ gem 'rspec', require: false
8
+
9
+ group :acceptancetests do
10
+ gem 'beaker-rspec', require: false
11
+ gem 'beaker-vagrant', require: false
12
+ gem 'vagrant-wrapper', require: false
13
+ end
14
+
15
+ group :tests do
16
+ gem 'coveralls', require: false
17
+ gem 'simplecov', require: false
18
+ end
19
+
20
+ group :development do
21
+ gem 'pry', require: false
22
+ gem 'pry-byebug', require: false
23
+ end
data/Gemfile.lock ADDED
@@ -0,0 +1,262 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ beaker-puppeter (0.1.0)
5
+ beaker (< 4)
6
+
7
+ GEM
8
+ remote: https://rubygems.org/
9
+ specs:
10
+ CFPropertyList (2.3.6)
11
+ addressable (2.5.2)
12
+ public_suffix (>= 2.0.2, < 4.0)
13
+ ansi (1.5.0)
14
+ ast (2.4.0)
15
+ aws-sdk-v1 (1.67.0)
16
+ json (~> 1.4)
17
+ nokogiri (~> 1)
18
+ beaker (3.35.0)
19
+ beaker-abs (~> 0.4)
20
+ beaker-aws (~> 0.1)
21
+ beaker-docker (~> 0.1)
22
+ beaker-google (~> 0.1)
23
+ beaker-hiera (~> 0.0)
24
+ beaker-hostgenerator
25
+ beaker-openstack (~> 0.1)
26
+ beaker-puppet (~> 0.0)
27
+ beaker-vagrant (~> 0.1)
28
+ beaker-vcloud (~> 0.1)
29
+ beaker-vmpooler (~> 1.0)
30
+ beaker-vmware (~> 0.1)
31
+ hocon (~> 1.0)
32
+ in-parallel (~> 0.1)
33
+ inifile (~> 3.0)
34
+ minitar (~> 0.6)
35
+ minitest (~> 5.4)
36
+ net-scp (~> 1.2)
37
+ net-ssh (~> 4.0)
38
+ open_uri_redirections (~> 0.2.1)
39
+ pry-byebug (~> 3.4.2)
40
+ rb-readline (~> 0.5.3)
41
+ rsync (~> 1.0.9)
42
+ stringify-hash (~> 0.0)
43
+ thor (~> 0.19)
44
+ beaker-abs (0.5.0)
45
+ beaker-aws (0.4.0)
46
+ aws-sdk-v1 (~> 1.57)
47
+ stringify-hash (~> 0.0.0)
48
+ beaker-docker (0.3.3)
49
+ docker-api
50
+ stringify-hash (~> 0.0.0)
51
+ beaker-google (0.1.0)
52
+ google-api-client (~> 0.9)
53
+ stringify-hash (~> 0.0.0)
54
+ beaker-hiera (0.1.1)
55
+ stringify-hash (~> 0.0.0)
56
+ beaker-hostgenerator (1.1.12)
57
+ deep_merge (~> 1.0)
58
+ stringify-hash (~> 0.0.0)
59
+ beaker-openstack (0.2.0)
60
+ fog-openstack
61
+ stringify-hash (~> 0.0.0)
62
+ beaker-puppet (0.15.2)
63
+ in-parallel (~> 0.1)
64
+ oga
65
+ stringify-hash (~> 0.0.0)
66
+ beaker-rspec (6.2.3)
67
+ beaker (~> 3.0)
68
+ rspec (~> 3.0)
69
+ serverspec (~> 2)
70
+ specinfra (~> 2)
71
+ beaker-vagrant (0.5.0)
72
+ stringify-hash (~> 0.0.0)
73
+ beaker-vcloud (0.2.0)
74
+ beaker-vmpooler
75
+ beaker-vmware
76
+ rbvmomi (~> 1.9)
77
+ stringify-hash (~> 0.0.0)
78
+ beaker-vmpooler (1.2.0)
79
+ stringify-hash (~> 0.0.0)
80
+ beaker-vmware (0.2.0)
81
+ fission (~> 0.4)
82
+ rbvmomi (~> 1.9)
83
+ stringify-hash (~> 0.0.0)
84
+ builder (3.2.3)
85
+ byebug (9.0.6)
86
+ coderay (1.1.2)
87
+ coveralls (0.7.1)
88
+ multi_json (~> 1.3)
89
+ rest-client
90
+ simplecov (>= 0.7)
91
+ term-ansicolor
92
+ thor
93
+ declarative (0.0.10)
94
+ declarative-option (0.1.0)
95
+ deep_merge (1.2.1)
96
+ diff-lcs (1.3)
97
+ docile (1.3.0)
98
+ docker-api (1.34.2)
99
+ excon (>= 0.47.0)
100
+ multi_json
101
+ domain_name (0.5.20180417)
102
+ unf (>= 0.0.5, < 1.0.0)
103
+ excon (0.62.0)
104
+ faraday (0.15.2)
105
+ multipart-post (>= 1.2, < 3)
106
+ fission (0.5.0)
107
+ CFPropertyList (~> 2.2)
108
+ fog-core (1.45.0)
109
+ builder
110
+ excon (~> 0.58)
111
+ formatador (~> 0.2)
112
+ fog-json (1.0.2)
113
+ fog-core (~> 1.0)
114
+ multi_json (~> 1.10)
115
+ fog-openstack (0.1.25)
116
+ fog-core (~> 1.40)
117
+ fog-json (>= 1.0)
118
+ ipaddress (>= 0.8)
119
+ formatador (0.2.5)
120
+ google-api-client (0.21.2)
121
+ addressable (~> 2.5, >= 2.5.1)
122
+ googleauth (>= 0.5, < 0.7.0)
123
+ httpclient (>= 2.8.1, < 3.0)
124
+ mime-types (~> 3.0)
125
+ representable (~> 3.0)
126
+ retriable (>= 2.0, < 4.0)
127
+ googleauth (0.6.2)
128
+ faraday (~> 0.12)
129
+ jwt (>= 1.4, < 3.0)
130
+ logging (~> 2.0)
131
+ memoist (~> 0.12)
132
+ multi_json (~> 1.11)
133
+ os (~> 0.9)
134
+ signet (~> 0.7)
135
+ hocon (1.2.5)
136
+ http-cookie (1.0.3)
137
+ domain_name (~> 0.5)
138
+ httpclient (2.8.3)
139
+ in-parallel (0.1.17)
140
+ inifile (3.0.0)
141
+ ipaddress (0.8.3)
142
+ json (1.8.6)
143
+ jwt (2.1.0)
144
+ little-plugger (1.1.4)
145
+ logging (2.2.2)
146
+ little-plugger (~> 1.1)
147
+ multi_json (~> 1.10)
148
+ memoist (0.16.0)
149
+ method_source (0.9.0)
150
+ mime-types (3.1)
151
+ mime-types-data (~> 3.2015)
152
+ mime-types-data (3.2016.0521)
153
+ mini_portile2 (2.3.0)
154
+ minitar (0.6.1)
155
+ minitest (5.11.3)
156
+ multi_json (1.13.1)
157
+ multipart-post (2.0.0)
158
+ net-scp (1.2.1)
159
+ net-ssh (>= 2.6.5)
160
+ net-ssh (4.2.0)
161
+ net-telnet (0.1.1)
162
+ netrc (0.11.0)
163
+ nokogiri (1.8.2)
164
+ mini_portile2 (~> 2.3.0)
165
+ oga (2.15)
166
+ ast
167
+ ruby-ll (~> 2.1)
168
+ open_uri_redirections (0.2.1)
169
+ os (0.9.6)
170
+ pry (0.11.3)
171
+ coderay (~> 1.1.0)
172
+ method_source (~> 0.9.0)
173
+ pry-byebug (3.4.3)
174
+ byebug (>= 9.0, < 9.1)
175
+ pry (~> 0.10)
176
+ public_suffix (3.0.2)
177
+ rake (10.5.0)
178
+ rb-readline (0.5.5)
179
+ rbvmomi (1.12.0)
180
+ builder (~> 3.0)
181
+ json (>= 1.8)
182
+ nokogiri (~> 1.5)
183
+ trollop (~> 2.1)
184
+ representable (3.0.4)
185
+ declarative (< 0.1.0)
186
+ declarative-option (< 0.2.0)
187
+ uber (< 0.2.0)
188
+ rest-client (2.0.2)
189
+ http-cookie (>= 1.0.2, < 2.0)
190
+ mime-types (>= 1.16, < 4.0)
191
+ netrc (~> 0.8)
192
+ retriable (3.1.1)
193
+ rspec (3.7.0)
194
+ rspec-core (~> 3.7.0)
195
+ rspec-expectations (~> 3.7.0)
196
+ rspec-mocks (~> 3.7.0)
197
+ rspec-core (3.7.1)
198
+ rspec-support (~> 3.7.0)
199
+ rspec-expectations (3.7.0)
200
+ diff-lcs (>= 1.2.0, < 2.0)
201
+ rspec-support (~> 3.7.0)
202
+ rspec-its (1.2.0)
203
+ rspec-core (>= 3.0.0)
204
+ rspec-expectations (>= 3.0.0)
205
+ rspec-mocks (3.7.0)
206
+ diff-lcs (>= 1.2.0, < 2.0)
207
+ rspec-support (~> 3.7.0)
208
+ rspec-support (3.7.1)
209
+ rsync (1.0.9)
210
+ ruby-ll (2.1.2)
211
+ ansi
212
+ ast
213
+ serverspec (2.41.3)
214
+ multi_json
215
+ rspec (~> 3.0)
216
+ rspec-its
217
+ specinfra (~> 2.72)
218
+ sfl (2.3)
219
+ signet (0.8.1)
220
+ addressable (~> 2.3)
221
+ faraday (~> 0.9)
222
+ jwt (>= 1.5, < 3.0)
223
+ multi_json (~> 1.10)
224
+ simplecov (0.16.1)
225
+ docile (~> 1.1)
226
+ json (>= 1.8, < 3)
227
+ simplecov-html (~> 0.10.0)
228
+ simplecov-html (0.10.2)
229
+ specinfra (2.73.3)
230
+ net-scp
231
+ net-ssh (>= 2.7, < 5.0)
232
+ net-telnet
233
+ sfl
234
+ stringify-hash (0.0.2)
235
+ term-ansicolor (1.6.0)
236
+ tins (~> 1.0)
237
+ thor (0.20.0)
238
+ tins (1.16.3)
239
+ trollop (2.1.2)
240
+ uber (0.1.0)
241
+ unf (0.1.4)
242
+ unf_ext
243
+ unf_ext (0.0.7.5)
244
+ vagrant-wrapper (2.0.3)
245
+
246
+ PLATFORMS
247
+ ruby
248
+
249
+ DEPENDENCIES
250
+ beaker-puppeter!
251
+ beaker-rspec
252
+ beaker-vagrant
253
+ coveralls
254
+ pry
255
+ pry-byebug
256
+ rake
257
+ rspec
258
+ simplecov
259
+ vagrant-wrapper
260
+
261
+ BUNDLED WITH
262
+ 1.16.2
data/LICENSE.txt ADDED
@@ -0,0 +1,13 @@
1
+ Copyright (c) 2018 Center for Information Technology
2
+
3
+ Licensed under the Apache License, Version 2.0 (the "License");
4
+ you may not use this file except in compliance with the License.
5
+ You may obtain a copy of the License at
6
+
7
+ http://www.apache.org/licenses/LICENSE-2.0
8
+
9
+ Unless required by applicable law or agreed to in writing, software
10
+ distributed under the License is distributed on an "AS IS" BASIS,
11
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ See the License for the specific language governing permissions and
13
+ limitations under the License.
data/README.md ADDED
@@ -0,0 +1,80 @@
1
+ # Beaker::Puppeter
2
+
3
+ [![Build Status](https://travis-ci.org/coi-gov-pl/gem-beaker-puppeter.svg?branch=develop)](https://travis-ci.org/coi-gov-pl/gem-beaker-puppeter) [![CircleCI](https://circleci.com/gh/coi-gov-pl/gem-beaker-puppeter.svg?style=svg)](https://circleci.com/gh/coi-gov-pl/gem-beaker-puppeter) [![Coverage Status](https://coveralls.io/repos/github/coi-gov-pl/gem-beaker-puppeter/badge.svg?branch=develop)](https://coveralls.io/github/coi-gov-pl/gem-beaker-puppeter?branch=develop)
4
+
5
+ This plugin integrates [Puppeter](https://github.com/coi-gov-pl/puppeter/) into [Beaker](https://github.com/puppetlabs/beaker) testing harness, by installing and running it with user provided answer files.
6
+
7
+ ## Installation
8
+
9
+ Add this line to your module's Gemfile:
10
+
11
+ ```ruby
12
+ gem 'beaker-puppeter', require: false
13
+ ```
14
+
15
+ ## Usage
16
+
17
+ To use beaker-puppeter add those lines to yours `spec/spec_helper_acceptance.rb` file:
18
+
19
+ ```ruby
20
+ require 'beaker/puppeter'
21
+ run_puppeter
22
+ ```
23
+
24
+ This configuration will look automatically for Puppeter answers in `spec/acceptance/answers/default.yml`, so place it there.
25
+
26
+ Answer file must be in format accepted by Puppeter. Consult [Puppeter documentation](https://github.com/coi-gov-pl/puppeter/blob/develop/README.rst) for more details.
27
+
28
+ Sample answer file can be as simple as:
29
+
30
+ ```yaml
31
+ # will install puppet agent 5.x from Puppet Inc. managed deb repositories
32
+ installer:
33
+ mode: Agent
34
+ type: pc5x
35
+ ```
36
+
37
+ ### Changing Puppeter answer file
38
+
39
+ You can change answers file in tree ways:
40
+
41
+ 1. Using environment variable `PUPPETER_ANSWERS`:
42
+ ```bash
43
+ PUPPETER_ANSWERS=puppet4 RS_SET=centos7 bundle exec rake acceptance
44
+ ```
45
+
46
+ 2. Using directly in code:
47
+ ```ruby
48
+ run_puppeter 'puppet4' # will run spec/acceptance/answers/puppet4.yml
49
+ ```
50
+
51
+ 3. Configuring `puppeter_answers` variable in nodeset:
52
+
53
+ ```yaml
54
+ CONFIG:
55
+ puppeter_answers: puppet4
56
+ ```
57
+
58
+ The importance of those set methods are: environment variables, direct code, nodeset settings.
59
+
60
+ ### Fine tuned usage
61
+
62
+ You can also utilize `run_puppeter_on` helper method to run Puppeter on specific hosts. It's useful when you would like to run different answer files on different hosts.
63
+
64
+ ## Development
65
+
66
+ After checking out the repo, run `bundle` to install dependencies. Then, run `bundle exec rake spec` to run the unit tests. You can also run `bundle exec rake acceptance` to run Docker/Vagrant based acceptance tests.
67
+
68
+ To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
69
+
70
+ ## Contributing
71
+
72
+ Bug reports and pull requests are welcome on GitHub at https://github.com/coi-gov-pl/beaker-puppeter. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
73
+
74
+ ## License
75
+
76
+ The gem is available as open source under the terms of the [Apache 2.0 License](https://opensource.org/licenses/Apache-2.0).
77
+
78
+ ## Code of Conduct
79
+
80
+ Everyone interacting in the Beaker::Puppeter project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/coi-gov-pl/beaker-puppeter/blob/master/CODE_OF_CONDUCT.md).
data/Rakefile ADDED
@@ -0,0 +1,13 @@
1
+ require "bundler/gem_tasks"
2
+ require "rspec/core/rake_task"
3
+
4
+ RSpec::Core::RakeTask.new(:spec) do |t|
5
+ t.pattern = 'spec/unit/**/*_spec.rb'
6
+ end
7
+
8
+ desc 'Run Beaker acceptance self-test'
9
+ RSpec::Core::RakeTask.new(:acceptance) do |t|
10
+ t.pattern = 'spec/acceptance/**/*_spec.rb'
11
+ end
12
+
13
+ task :default => [ :spec, :acceptance ]
@@ -0,0 +1,29 @@
1
+
2
+ lib = File.expand_path("../lib", __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require "beaker/puppeter/version"
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "beaker-puppeter"
8
+ spec.version = Beaker::Puppeter::VERSION
9
+ spec.authors = ["Suszyński Krzysztof"]
10
+ spec.email = ["krzysztof.suszynski@coi.gov.pl"]
11
+
12
+ spec.summary = "Integrates Puppeter into Beaker by adding extra helper methods"
13
+ spec.description = <<-eos.gsub /^\s*/, ''
14
+ Puppeter is a automated, unattended, Puppet installer, and beaker-puppeter
15
+ is a Beaker extension that adds helper methods to use in your
16
+ spec_helper_acceptance file.
17
+ eos
18
+ spec.homepage = "https://github.com/coi-gov-pl/gem-beaker-puppeter"
19
+ spec.license = "Apache-2.0"
20
+
21
+ spec.files = `git ls-files -z`.split("\x0").reject do |f|
22
+ f.match(%r{^(test|spec|features)/})
23
+ end
24
+ spec.require_paths = ["lib"]
25
+
26
+ spec.required_ruby_version = [ '>= 2.1.0', '< 2.5.0' ]
27
+
28
+ spec.add_dependency 'beaker', '< 4'
29
+ end
@@ -0,0 +1,47 @@
1
+ require 'beaker/puppeter/version'
2
+ require 'beaker/puppeter/executor'
3
+ require 'beaker'
4
+
5
+ module Beaker
6
+ module Puppeter
7
+ PUPPETER_SCRIPT_KEY = 'PUPPETER_ANSWERS'
8
+
9
+ def run_puppeter(answers = :auto)
10
+ run_puppeter_on(hosts, answers)
11
+ end
12
+
13
+ def run_puppeter_on(hosts, answers = :auto)
14
+ hosts.each do |host|
15
+ install_puppeter_on host
16
+ execute_puppeter_on(host)
17
+ .with(code: answers, env: env_answers)
18
+ end
19
+ end
20
+
21
+ private
22
+
23
+ def env_answers
24
+ answers = ENV.fetch(PUPPETER_SCRIPT_KEY, nil)
25
+ set = !answers.nil?
26
+ { set: set, answers: answers }
27
+ end
28
+
29
+ def install_puppeter_on(host)
30
+ ensure_curl_on host
31
+ on host, 'curl -L https://raw.githubusercontent.com/coi-gov-pl/puppeter/master/setup.sh | bash'
32
+ end
33
+
34
+ def execute_puppeter_on(host)
35
+ Beaker::Puppeter::Executor.new(host)
36
+ end
37
+
38
+ def ensure_curl_on(host)
39
+ pkg = 'curl'
40
+ unless host.check_for_package pkg
41
+ host.install_package pkg
42
+ end
43
+ end
44
+ end
45
+ end
46
+
47
+ include Beaker::Puppeter
@@ -0,0 +1,55 @@
1
+ module Beaker
2
+ module Puppeter
3
+ class Executor
4
+ PUPPETER_SCRIPT_DEFAULT_VALUE = 'default'
5
+
6
+ def initialize(host)
7
+ @host = host
8
+ @puppeter_ver = nil
9
+ end
10
+
11
+ def with(answers)
12
+ root = Pathname.new '.'
13
+ answers_dir = root.join('spec')
14
+ .join('acceptance')
15
+ .join('answers')
16
+ inject_ansers_to_host(answers)
17
+ answers_file = answers_dir.join("#{@host.options[:puppeter_answers]}.yml")
18
+ ver = infra_version
19
+ logger.debug "Installing Puppet via #{ver} on #{@host} with #{answers_file}"
20
+ copied = copy_answers answers_file
21
+ on @host, "puppeter --answers #{copied} > /tmp/puppeter-script.sh"
22
+ on @host, 'bash /tmp/puppeter-script.sh'
23
+ end
24
+
25
+ private
26
+
27
+ def inject_ansers_to_host(answers)
28
+ code_a = answers[:code]
29
+ env_a = answers[:env]
30
+ nodeset_a = @host.options[:puppeter_answers]
31
+ result = nodeset_a
32
+ if env_a[:set]
33
+ result = env_a[:answers]
34
+ elsif code_a != :auto
35
+ result = code_a
36
+ end
37
+ result = PUPPETER_SCRIPT_DEFAULT_VALUE if result.nil?
38
+ @host.options[:puppeter_answers] = result
39
+ result
40
+ end
41
+
42
+ def copy_answers(answers_file)
43
+ target_file = Dir::Tmpname.make_tmpname('/tmp/puppeter-answers', nil)
44
+ scp_to @host, answers_file, target_file
45
+ target_file
46
+ end
47
+
48
+ def infra_version
49
+ @puppeter_ver = on @host, 'puppeter --version' if @puppeter_ver.nil?
50
+ @puppeter_ver.stdout.strip
51
+ end
52
+
53
+ end
54
+ end
55
+ end
@@ -0,0 +1,5 @@
1
+ module Beaker
2
+ module Puppeter
3
+ VERSION = '0.1.0'
4
+ end
5
+ end
metadata ADDED
@@ -0,0 +1,78 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: beaker-puppeter
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Suszyński Krzysztof
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2018-06-06 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: beaker
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "<"
18
+ - !ruby/object:Gem::Version
19
+ version: '4'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "<"
25
+ - !ruby/object:Gem::Version
26
+ version: '4'
27
+ description: |
28
+ Puppeter is a automated, unattended, Puppet installer, and beaker-puppeter
29
+ is a Beaker extension that adds helper methods to use in your
30
+ spec_helper_acceptance file.
31
+ email:
32
+ - krzysztof.suszynski@coi.gov.pl
33
+ executables: []
34
+ extensions: []
35
+ extra_rdoc_files: []
36
+ files:
37
+ - ".circleci/config.yml"
38
+ - ".gitignore"
39
+ - ".rspec"
40
+ - ".travis.yml"
41
+ - CODE_OF_CONDUCT.md
42
+ - Gemfile
43
+ - Gemfile.lock
44
+ - LICENSE.txt
45
+ - README.md
46
+ - Rakefile
47
+ - beaker-puppeter.gemspec
48
+ - lib/beaker/puppeter.rb
49
+ - lib/beaker/puppeter/executor.rb
50
+ - lib/beaker/puppeter/version.rb
51
+ homepage: https://github.com/coi-gov-pl/gem-beaker-puppeter
52
+ licenses:
53
+ - Apache-2.0
54
+ metadata: {}
55
+ post_install_message:
56
+ rdoc_options: []
57
+ require_paths:
58
+ - lib
59
+ required_ruby_version: !ruby/object:Gem::Requirement
60
+ requirements:
61
+ - - ">="
62
+ - !ruby/object:Gem::Version
63
+ version: 2.1.0
64
+ - - "<"
65
+ - !ruby/object:Gem::Version
66
+ version: 2.5.0
67
+ required_rubygems_version: !ruby/object:Gem::Requirement
68
+ requirements:
69
+ - - ">="
70
+ - !ruby/object:Gem::Version
71
+ version: '0'
72
+ requirements: []
73
+ rubyforge_project:
74
+ rubygems_version: 2.6.12
75
+ signing_key:
76
+ specification_version: 4
77
+ summary: Integrates Puppeter into Beaker by adding extra helper methods
78
+ test_files: []