poise-boiler 1.1.10 → 1.1.11

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: 8ef60e7bfec2579685ca4869b7c01da0c3fab167
4
- data.tar.gz: 3b69e2bd68f4104fba50e91855bb133bc01e1310
3
+ metadata.gz: c57f0874cd6f3de21e85242546d75f7697155947
4
+ data.tar.gz: 45f94bce4cfea5c06202a51cdc09c04dddaaa26b
5
5
  SHA512:
6
- metadata.gz: b304e48949147a4f3ad8682404b700d53af313a52cca5ddca7c109d028a9d1f76af83df04184596f4a52dff597723cf639ab2b2ae9ab6c8e5144d9fca9086e04
7
- data.tar.gz: ba76027ff93e660b83209cf0477e39de34c0e80407f32b3ef8733f63936e20951c81dff6cb4542225cd17d9fce09a7092a8d5bcd010b5797c25bfe8844ce2920
6
+ metadata.gz: 59f322469323237e2b8069aecd7e2c37b50209f174593d4d530735d3a8520a1cb428e85ef5ed1914c3fc60528284ec946eb062fa974077d5f78bc91d40e2cd87
7
+ data.tar.gz: 58ed212f372a7a488459f9d555c9b8fe7a206748c55688e138f589a043c76dcf287360b829430f1e0fadf07a0145ceee28f599ae301a98c44f2958a3136d3c3b
@@ -1,5 +1,9 @@
1
1
  # Changelog
2
2
 
3
+ ## v1.1.11
4
+
5
+ * Make sure `ss` is available on EL7 for `port` resources in Serverspec.
6
+
3
7
  ## v1.1.10
4
8
 
5
9
  * Better fix for faraday gzip issues.
@@ -29,6 +29,8 @@ module PoiseBoiler
29
29
  require 'rspec'
30
30
  require 'rspec/its'
31
31
  require 'simplecov'
32
+ require 'pry'
33
+ require 'pry-byebug'
32
34
 
33
35
  # Check for coverage stuffs
34
36
  formatters = []
@@ -32,6 +32,8 @@ module PoiseBoiler
32
32
  'rhel' => %w{centos-6 centos-7},
33
33
  'centos' => %w{rhel},
34
34
  'linux' => %w{ubuntu rhel},
35
+ 'unix' => %w{linux freebsd},
36
+ 'all' => %{unix windows},
35
37
  }
36
38
 
37
39
  # Return a YAML string suitable for inclusion in a .kitchen.yml config. This
@@ -42,7 +44,14 @@ module PoiseBoiler
42
44
  # @example .kitchen.yml
43
45
  # #<% require 'poise_boiler' %>
44
46
  # <%= PoiseBoiler.kitchen %>
45
- def kitchen(platforms: 'ubuntu-14.04')
47
+ def kitchen(platforms: 'ubuntu-14.04', root: nil)
48
+ # Figure out the directory that contains the kitchen.yml.
49
+ root ||= if caller.find {|line| !line.start_with?(File.expand_path('../..', __FILE__)) } =~ /^(.*?):\d+:in/
50
+ File.expand_path('..', $1)
51
+ else
52
+ # ¯\_(ツ)_/¯
53
+ Dir.pwd
54
+ end
46
55
  # SPEC_BLOCK_CI is used to force non-locking behavior inside tests.
47
56
  chef_version = ENV['CHEF_VERSION'] || if ENV['SPEC_BLOCK_CI'] != 'true'
48
57
  # If there isn't a specific override, lock TK to use the same version of Chef as the Gemfile.
@@ -59,16 +68,29 @@ module PoiseBoiler
59
68
  else
60
69
  ''
61
70
  end
71
+ docker_enabled = File.exist?(File.expand_path('test/docker/docker.key', root))
62
72
  {
63
73
  'chef_versions' => %w{12},
64
74
  'driver' => {
65
- 'name' => (ENV['TRAVIS'] == 'true' ? 'dummy' : 'vagrant'),
75
+ 'name' => (docker_enabled ? 'docker' : ENV['TRAVIS'] == 'true' ? 'dummy' : 'vagrant'),
66
76
  'require_chef_omnibus' => chef_version || true,
77
+ 'dockerfile' => File.expand_path('../kitchen/Dockerfile.erb', __FILE__),
78
+ # No password for securiteeeee.
79
+ 'password' => nil,
80
+ # Our docker settings.
81
+ 'binary' => (ENV['TRAVIS'] == 'true' ? './' : '') + 'docker',
82
+ 'socket' => 'tcp://docker.poise.io:443',
83
+ 'tls_verify' => 'true',
84
+ 'tls_cacert' => 'test/docker/docker.ca',
85
+ 'tls_cert' => 'test/docker/docker.pem',
86
+ 'tls_key' => 'test/docker/docker.key',
87
+ # Cache some stuff in the Docker image.
67
88
  'provision_command' => [
68
89
  # Run some installs at provision so they are cached in the image.
69
- # Install net-tools for netstat which is used by serverspec.
90
+ # Install net-tools for netstat which is used by serverspec, and
91
+ # iproute for ss (only used on EL7).
70
92
  "test ! -f /etc/debian_version || apt-get install -y net-tools",
71
- "test ! -f /etc/redhat-release || yum -y install net-tools",
93
+ "test ! -f /etc/redhat-release || yum -y install net-tools iproute",
72
94
  # Make sure the hostname utilitiy is installed on CentOS 7. The
73
95
  # ||true is for EL6 which has no hostname package. Sigh.
74
96
  "test ! -f /etc/redhat-release || yum -y install hostname || true",
@@ -82,8 +104,9 @@ module PoiseBoiler
82
104
  },
83
105
  'transport' => {
84
106
  'name' => 'sftp',
107
+ 'ssh_key' => docker_enabled ? File.expand_path('.kitchen/docker_id_rsa', root) : nil,
85
108
  },
86
- 'platforms' => expand_kitchen_platforms(platforms).map {|p| {'name' => p, 'run_list' => platform_run_list(p)} },
109
+ 'platforms' => expand_kitchen_platforms(platforms).map {|p| platform_definition(p) },
87
110
  }.to_yaml.gsub(/---[ \n]/, '')
88
111
  end
89
112
 
@@ -100,6 +123,14 @@ module PoiseBoiler
100
123
  platforms
101
124
  end
102
125
 
126
+ def platform_definition(name)
127
+ {
128
+ 'name' => name,
129
+ 'run_list' => platform_run_list(name),
130
+ 'driver_config' => platform_driver(name),
131
+ }
132
+ end
133
+
103
134
  # Return the platform-level run list for a given platform.
104
135
  #
105
136
  # @param platform [String] Platform name.
@@ -111,5 +142,20 @@ module PoiseBoiler
111
142
  []
112
143
  end
113
144
  end
145
+
146
+ def platform_driver(platform)
147
+ if platform.start_with?('freebsd')
148
+ {
149
+ 'binary' => (ENV['TRAVIS'] == 'true' ? './' : '') + 'docker-1.7.1',
150
+ 'image' => 'lexaguskov/freebsd',
151
+ 'socket' => ENV['POISE_DOCKER_FREEBSD'] || 'tcp://dockerbsd.poise.io:443',
152
+ }
153
+ else
154
+ {
155
+ 'binary' => (ENV['TRAVIS'] == 'true' ? './' : '') + 'docker',
156
+ 'socket' => ENV['POISE_DOCKER_LINUX'] || 'tcp://docker.poise.io:443',
157
+ }
158
+ end
159
+ end
114
160
  end
115
161
  end
@@ -0,0 +1,82 @@
1
+ <%# Pull in the base image. %>
2
+ FROM <%= @image %>
3
+ <%# Pass through proxy settings from Test Kitchen or the system. %>
4
+ <% http_proxy = @http_proxy || ENV['http_proxy'] || ENV['HTTP_PROXY'] %>
5
+ <% https_proxy = @https_proxy || ENV['https_proxy'] || ENV['HTTPS_PROXY'] %>
6
+ <% no_proxy = @no_proxy || ENV['no_proxy'] || ENV['NO_PROXY'] %>
7
+ <% if http_proxy %>
8
+ ENV http_proxy <%= http_proxy %>
9
+ ENV HTTP_PROXY <%= http_proxy %>
10
+ <% end %>
11
+ <% if https_proxy %>
12
+ ENV https_proxy <%= https_proxy %>
13
+ ENV HTTPS_PROXY <%= https_proxy %>
14
+ <% end %>
15
+ <% if no_proxy %>
16
+ ENV no_proxy <%= no_proxy %>
17
+ ENV NO_PROXY <%= no_proxy %>
18
+ <% end %>
19
+ <%# Per-platform initializations. %>
20
+ <% case @platform; when 'debian', 'ubuntu' %>
21
+ <% if @disable_upstart %>
22
+ RUN dpkg-divert --local --rename --add /sbin/initctl
23
+ RUN ln -sf /bin/true /sbin/initctl
24
+ <% end %>
25
+ ENV DEBIAN_FRONTEND noninteractive
26
+ RUN apt-get update -o dockercachebust=<%= Date.today %>
27
+ RUN apt-get install -y sudo openssh-server curl lsb-release net-tools
28
+ <% when 'rhel', 'centos', 'fedora' %>
29
+ RUN yum clean all
30
+ RUN yum install -y sudo openssh-server openssh-clients which curl net-tools passwd
31
+ <%# CentOS 7 does not install hostname by default, but EL6 has no hostname package. %>
32
+ RUN yum install -y hostname || true
33
+ RUN ssh-keygen -t rsa -f /etc/ssh/ssh_host_rsa_key -N ''
34
+ RUN ssh-keygen -t dsa -f /etc/ssh/ssh_host_dsa_key -N ''
35
+ <% when 'arch' %>
36
+ RUN pacman -Syu --noconfirm
37
+ RUN pacman -S --noconfirm openssh sudo curl
38
+ RUN ssh-keygen -A -t rsa -f /etc/ssh/ssh_host_rsa_key
39
+ RUN ssh-keygen -A -t dsa -f /etc/ssh/ssh_host_dsa_key
40
+ <% when 'gentoo' %>
41
+ RUN emerge sync
42
+ RUN emerge net-misc/openssh app-admin/sudo
43
+ RUN ssh-keygen -A -t rsa -f /etc/ssh/ssh_host_rsa_key
44
+ RUN ssh-keygen -A -t dsa -f /etc/ssh/ssh_host_dsa_key
45
+ <% when 'gentoo-paludis' %>
46
+ RUN cave sync
47
+ RUN cave resolve -zx net-misc/openssh app-admin/sudo
48
+ RUN ssh-keygen -A -t rsa -f /etc/ssh/ssh_host_rsa_key
49
+ RUN ssh-keygen -A -t dsa -f /etc/ssh/ssh_host_dsa_key
50
+ <% when 'freebsd' %>
51
+ RUN echo "nameserver 8.8.8.8" >> /etc/resolv.conf \
52
+ && env ASSUME_ALWAYS_YES=true pkg install sudo curl bash
53
+ RUN ssh-keygen -A -t rsa -f /etc/ssh/ssh_host_rsa_key
54
+ RUN ssh-keygen -A -t dsa -f /etc/ssh/ssh_host_dsa_key
55
+ <% end %>
56
+ <%# Create the kitchen user, give it sudo, and create and authorized keys. %>
57
+ <% homedir = @username == 'root' ? '/root' : "/home/#{@username}" %>
58
+ RUN if ! getent passwd <%= @username %>; then \
59
+ <% if @platform == 'freebsd' %>pw <% end %>useradd <%= @username %> -d <%= homedir %> -m -s /bin/<%= @platform == 'freebsd' ? 'csh' : 'bash' %>; \
60
+ fi
61
+ <% if @password && !@password.empty? %>
62
+ RUN echo <%= @username %>:<%= @password %> | chpasswd
63
+ <% else %>
64
+ RUN passwd -d <%= @username %>
65
+ <% end %>
66
+ RUN echo '<%= @username %> ALL=(ALL) NOPASSWD:ALL' >> /etc/sudoers
67
+ RUN mkdir -p /etc/sudoers.d
68
+ RUN echo '<%= @username %> ALL=(ALL) NOPASSWD:ALL' >> /etc/sudoers.d/<%= @username %>
69
+ RUN chmod 0440 /etc/sudoers.d/<%= @username %>
70
+ RUN mkdir -p <%= homedir %>/.ssh
71
+ RUN chown -R <%= @username %> <%= homedir %>/.ssh
72
+ RUN chmod 0700 <%= homedir %>/.ssh
73
+ RUN touch <%= homedir %>/.ssh/authorized_keys
74
+ RUN chown <%= @username %> <%= homedir %>/.ssh/authorized_keys
75
+ RUN chmod 0600 <%= homedir %>/.ssh/authorized_keys
76
+ <%# Custom provisioning commands. %>
77
+ <% Array(@provision_command).each do |cmd| %>
78
+ RUN <%= cmd %>
79
+ <% end %>
80
+ <%# Write out the authorized_keys, this happens last because it breaks the
81
+ layer cache on each new test run. %>
82
+ RUN echo '<%= IO.read(@public_key).strip %>' >> <%= homedir %>/.ssh/authorized_keys
@@ -16,5 +16,5 @@
16
16
 
17
17
 
18
18
  module PoiseBoiler
19
- VERSION = '1.1.10'
19
+ VERSION = '1.1.11'
20
20
  end
@@ -37,12 +37,13 @@ Gem::Specification.new do |spec|
37
37
  # Development gems
38
38
  spec.add_dependency 'addressable', '~> 2.3'
39
39
  spec.add_dependency 'rake', '~> 10.4'
40
- spec.add_dependency 'travis', '~> 1.7'
40
+ # spec.add_dependency 'travis', '~> 1.8'
41
41
  spec.add_dependency 'yard', '~> 0.8'
42
42
  spec.add_dependency 'yard-classmethods', '~> 1.0'
43
43
  spec.add_dependency 'halite', '~> 1.0' # This is a circular dependency
44
44
  spec.add_dependency 'mixlib-shellout', '>= 1.4', '< 3.0' # Chef 11 means shellout 1.4 :-(
45
45
  spec.add_dependency 'pry' # Travis depends on old-ass pry, see https://github.com/travis-ci/travis.rb/issues/245
46
+ spec.add_dependency 'pry-byebug'
46
47
 
47
48
  # Test gems
48
49
  spec.add_dependency 'rspec', '~> 3.2'
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: poise-boiler
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.10
4
+ version: 1.1.11
5
5
  platform: ruby
6
6
  authors:
7
7
  - Noah Kantrowitz
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-10-07 00:00:00.000000000 Z
11
+ date: 2015-12-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: addressable
@@ -38,20 +38,6 @@ dependencies:
38
38
  - - "~>"
39
39
  - !ruby/object:Gem::Version
40
40
  version: '10.4'
41
- - !ruby/object:Gem::Dependency
42
- name: travis
43
- requirement: !ruby/object:Gem::Requirement
44
- requirements:
45
- - - "~>"
46
- - !ruby/object:Gem::Version
47
- version: '1.7'
48
- type: :runtime
49
- prerelease: false
50
- version_requirements: !ruby/object:Gem::Requirement
51
- requirements:
52
- - - "~>"
53
- - !ruby/object:Gem::Version
54
- version: '1.7'
55
41
  - !ruby/object:Gem::Dependency
56
42
  name: yard
57
43
  requirement: !ruby/object:Gem::Requirement
@@ -128,6 +114,20 @@ dependencies:
128
114
  - - ">="
129
115
  - !ruby/object:Gem::Version
130
116
  version: '0'
117
+ - !ruby/object:Gem::Dependency
118
+ name: pry-byebug
119
+ requirement: !ruby/object:Gem::Requirement
120
+ requirements:
121
+ - - ">="
122
+ - !ruby/object:Gem::Version
123
+ version: '0'
124
+ type: :runtime
125
+ prerelease: false
126
+ version_requirements: !ruby/object:Gem::Requirement
127
+ requirements:
128
+ - - ">="
129
+ - !ruby/object:Gem::Version
130
+ version: '0'
131
131
  - !ruby/object:Gem::Dependency
132
132
  name: rspec
133
133
  requirement: !ruby/object:Gem::Requirement
@@ -370,6 +370,7 @@ files:
370
370
  - lib/poise_boiler/helpers/rake/travis.rb
371
371
  - lib/poise_boiler/helpers/spec_helper.rb
372
372
  - lib/poise_boiler/kitchen.rb
373
+ - lib/poise_boiler/kitchen/Dockerfile.erb
373
374
  - lib/poise_boiler/rake.rb
374
375
  - lib/poise_boiler/rakefile.rb
375
376
  - lib/poise_boiler/spec_helper.rb