inspec-chef 0.3.3 → 0.3.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/inspec-chef/input.rb +20 -7
- data/lib/inspec-chef/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: '0787aed4a0054aa070d1457bc3d26e241ce74180199d0dd7a46ca4ec9acdc952'
|
4
|
+
data.tar.gz: 7d417717bfb8d91ad32e49217c86c1f12c90f8ae5469e76c6711561d507db64e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a94ee8f3bfce202c599151468fda195ad8c4dfbd61b533bf11372306665a818b23fc0860c3e796c6573bb241f23e422c36f8a0fff10fee79ac2821bc4d14969d
|
7
|
+
data.tar.gz: c9730f1dd6dc92f0c8a0ddd72f7fd345213a7bb9eab1cf3a87e56615189699aaa0bc671f79e1a1a22bd2462738c2d609048a71e671748d50780ec2ac2c71d95d
|
data/lib/inspec-chef/input.rb
CHANGED
@@ -115,16 +115,24 @@ module InspecPlugins
|
|
115
115
|
|
116
116
|
# ========================================================================
|
117
117
|
# Interfacing with Inspec and Chef
|
118
|
+
#
|
118
119
|
|
119
|
-
#
|
120
|
-
|
121
|
-
def kitchen_provisioner_config
|
120
|
+
# Access to kitchen data
|
121
|
+
def kitchen
|
122
122
|
require "binding_of_caller"
|
123
|
-
|
123
|
+
binding.callers.find { |b| b.frame_description == "verify" }.receiver
|
124
|
+
end
|
124
125
|
|
126
|
+
# Return provisioner config
|
127
|
+
def kitchen_provisioner_config
|
125
128
|
kitchen.provisioner.send(:provided_config)
|
126
129
|
end
|
127
130
|
|
131
|
+
# Return verifier config
|
132
|
+
def kitchen_verifier_config
|
133
|
+
kitchen.verifier.send(:provided_config)
|
134
|
+
end
|
135
|
+
|
128
136
|
# Get plugin specific configuration
|
129
137
|
def plugin_conf
|
130
138
|
inspec_config.fetch_plugin_config("inspec-chef")
|
@@ -147,7 +155,7 @@ module InspecPlugins
|
|
147
155
|
def connect_to_chef_server
|
148
156
|
# From within TestKitchen we need no Chef Server connection
|
149
157
|
if inside_testkitchen?
|
150
|
-
logger.info "Running from TestKitchen, using
|
158
|
+
logger.info "Running from TestKitchen, using static settings instead of Chef Server"
|
151
159
|
|
152
160
|
# Only connect once
|
153
161
|
elsif !server_connected?
|
@@ -191,8 +199,7 @@ module InspecPlugins
|
|
191
199
|
|
192
200
|
chef_server.data_bag_item.fetch(item, bag: databag).data
|
193
201
|
else
|
194
|
-
|
195
|
-
filename = File.join(config[:data_bags_path], databag, item + ".json")
|
202
|
+
filename = File.join(data_bags_path, databag, item + ".json")
|
196
203
|
|
197
204
|
begin
|
198
205
|
return JSON.load(File.read(filename))
|
@@ -202,6 +209,12 @@ module InspecPlugins
|
|
202
209
|
end
|
203
210
|
end
|
204
211
|
|
212
|
+
# Calculate lookup path for databags within TestKitchen
|
213
|
+
def data_bags_path
|
214
|
+
# These can occur on suite-level, provisioner-level, verifier or at the default location
|
215
|
+
kitchen_provisioner_config[:data_bags_path] || kitchen_verifier_config[:data_bags_path] || File.join('test', 'data_bags')
|
216
|
+
end
|
217
|
+
|
205
218
|
# Retrieve attributes of a node
|
206
219
|
def get_attributes(node)
|
207
220
|
unless inside_testkitchen?
|
data/lib/inspec-chef/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: inspec-chef
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Thomas Heinen
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-04-
|
11
|
+
date: 2020-04-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: chef-api
|