packer-config 1.4.0 → 1.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: e4920f738fb0ed191d9670882f3336847462a085
4
- data.tar.gz: c41a894f64a07e8e61c1f94dfc5160fdf700880d
3
+ metadata.gz: 640bd565ae84e2e9346f9e3a5cb0f323f041150c
4
+ data.tar.gz: 5f695eb2687ca6a915cb3eb19fea6f41af858759
5
5
  SHA512:
6
- metadata.gz: 59da5cd9f6be7590e63b8210049d4db889d4339e7f64b6f18e20cded754a377dddc8531e211fad5c801fde8aea16750aa931a27d61823d114c58756c8ccff963
7
- data.tar.gz: 304585133fb571ad92c8864f731f0454d5888cc9c85ef47879ad18ba44db52d2e82feb56535964f6430b9f73d0922ecf9a9175c3e6254315f32d327ac0aabbd0
6
+ metadata.gz: ab824fc394e16948c945c1de6914c5bbb68cc9d741bae62776a09efcfd1d7d3793927c61425dd541f8c5ee25efd8c5392d7a853a778a03a8cfa44debddbfe0ca
7
+ data.tar.gz: 5ef5968062edb9298a75f5af20a5da17d1b2ccb415a4770277719395f1d5d1cd8364af456d6125bdabc67a06bdd6a9675abff2f070dd23e89f87cf6d0aaa18e4
data/.gitignore CHANGED
@@ -12,6 +12,7 @@ spec/integration/centos-6.*-x86_64-virtualbox
12
12
  /test/version_tmp/
13
13
  /tmp/
14
14
  /.idea/
15
+ tags
15
16
 
16
17
  ## Specific to RubyMotion:
17
18
  .dat*
@@ -1,133 +1,17 @@
1
- # This configuration was generated by `rubocop --auto-gen-config`
2
- # on 2014-05-14 11:00:31 -0400 using RuboCop version 0.21.0.
3
- # The point is for the user to remove these configuration records
4
- # one by one as the offenses are removed from the code base.
5
- # Note that changes in the inspected code, or installation of new
6
- # versions of RuboCop, may require this file to be generated again.
7
-
8
- # Offense count: 6
9
- AmbiguousOperator:
10
- Enabled: false
11
-
12
- # Offense count: 22
13
- AmbiguousRegexpLiteral:
14
- Enabled: false
15
-
16
- # Offense count: 5
17
- # Configuration parameters: EnforcedStyle, SupportedStyles.
18
- ClassAndModuleChildren:
19
- Enabled: false
20
-
21
- # Turn this on eventually
22
- ClassLength:
23
- Enabled: false
24
-
25
- # Offense count: 57
26
- # Cop supports --auto-correct.
27
- DeprecatedClassMethods:
28
- Enabled: false
29
-
30
- # Offense count: 19
31
- # Cop supports --auto-correct.
32
- DeprecatedHashMethods:
33
- Enabled: false
1
+ inherit_from: .rubocop_todo.yml
34
2
 
35
3
  Documentation:
36
4
  Enabled: false
37
5
 
38
- # Offense count: 1
39
- DoubleNegation:
40
- Enabled: false
41
-
42
- # Offense count: 8
43
- # Configuration parameters: Exclude.
44
- FileName:
45
- Enabled: false
46
-
47
- # Offense count: 3
48
- # Configuration parameters: EnforcedStyle, SupportedStyles.
49
- FormatString:
50
- Enabled: false
51
-
52
- # Offense count: 9
53
- # Cop supports --auto-correct.
54
- IndentArray:
55
- Enabled: false
56
-
57
- # Offense count: 261
58
- # Cop supports --auto-correct.
59
- # Configuration parameters: EnforcedStyle, SupportedStyles.
60
- IndentHash:
61
- Enabled: false
62
-
63
- # Offense count: 3
64
- # Cop supports --auto-correct.
65
- IndentationConsistency:
66
- Enabled: false
67
-
68
6
  LeadingCommentSpace:
69
7
  Enabled: false
70
8
 
71
- # Offense count: 32
72
- # Cop supports --auto-correct.
73
- LineEndConcatenation:
74
- Enabled: false
75
-
76
9
  LineLength:
77
10
  Enabled: false
78
11
 
79
- # We'll turn this on eventually
80
- MethodLength:
81
- Enabled: false
82
-
83
- # Offense count: 9
84
- # Cop supports --auto-correct.
85
- NegatedIf:
86
- Enabled: false
87
-
88
- # Offense count: 7
89
- # Cop supports --auto-correct.
90
- NegatedWhile:
91
- Enabled: false
92
-
93
- # Offense count: 11
94
- # Cop supports --auto-correct.
95
- NonNilCheck:
96
- Enabled: false
97
-
98
- # Offense count: 110
99
- # Cop supports --auto-correct.
100
- # Configuration parameters: PreferredDelimiters.
101
- PercentLiteralDelimiters:
102
- Enabled: false
103
-
104
- # Offense count: 3
105
- SelfAssignment:
106
- Enabled: false
107
-
108
12
  SignalException:
109
13
  Enabled: false
110
14
 
111
- # Offense count: 53
112
- # Cop supports --auto-correct.
113
- SingleSpaceBeforeFirstArg:
114
- Enabled: false
115
-
116
- SpaceAroundOperators:
117
- Enabled: false
118
-
119
- # Offense count: 382
120
- # Cop supports --auto-correct.
121
- # Configuration parameters: EnforcedStyle, SupportedStyles.
122
- SpaceBeforeBlockBraces:
123
- Enabled: false
124
-
125
- # Offense count: 784
126
- # Cop supports --auto-correct.
127
- # Configuration parameters: EnforcedStyle, SupportedStyles, EnforcedStyleForEmptyBraces, SpaceBeforeBlockParameters.
128
- SpaceInsideBlockBraces:
129
- Enabled: false
130
-
131
15
  # Don't care enough about this one
132
16
  SpaceInsideHashLiteralBraces:
133
17
  Enabled: false
@@ -136,11 +20,6 @@ SpaceInsideHashLiteralBraces:
136
20
  SpecialGlobalVars:
137
21
  Enabled: false
138
22
 
139
- # Offense count: 5
140
- # Cop supports --auto-correct.
141
- StringConversionInInterpolation:
142
- Enabled: false
143
-
144
23
  StringLiterals:
145
24
  Description: Checks if uses of quotes match the configured preference.
146
25
  Enabled: false
@@ -292,46 +171,6 @@ Style/WhileUntilDo:
292
171
  Style/WhileUntilModifier:
293
172
  Enabled: false
294
173
 
295
-
296
- # Things that are off but we should turn on eventually
297
-
298
- Style/Next:
299
- Enabled: false
300
-
301
- Style/NumericLiterals:
302
- Enabled: false
303
-
304
- Metrics/ParameterLists:
305
- Enabled: false
306
-
307
- Style/TrailingComma:
308
- # EnforcedStyleForMultiline: comma
309
- Enabled: false
310
-
311
- Metrics/CyclomaticComplexity:
312
- Enabled: false
313
-
314
- Metrics/AbcSize:
315
- Enabled: false
316
-
317
- ####
318
-
319
- # Offense count: 1
320
- UnderscorePrefixedVariableName:
321
- Enabled: false
322
-
323
- # Offense count: 108
324
- UnusedBlockArgument:
325
- Enabled: false
326
-
327
- # Offense count: 159
328
- UnusedMethodArgument:
329
- Enabled: false
330
-
331
- # Offense count: 2
332
- UselessAccessModifier:
333
- Enabled: false
334
-
335
174
  # As of rubocop 0.21, it thinks kwargs are useless assignments
336
175
  UselessAssignment:
337
176
  Enabled: false
@@ -0,0 +1,151 @@
1
+ # This configuration was generated by
2
+ # `rubocop --auto-gen-config`
3
+ # on 2016-01-27 13:13:41 +0000 using RuboCop version 0.36.0.
4
+ # The point is for the user to remove these configuration records
5
+ # one by one as the offenses are removed from the code base.
6
+ # Note that changes in the inspected code, or installation of new
7
+ # versions of RuboCop, may require this file to be generated again.
8
+
9
+ # Offense count: 3
10
+ Lint/IneffectiveAccessModifier:
11
+ Exclude:
12
+ - 'lib/packer/builder.rb'
13
+ - 'lib/packer/postprocessor.rb'
14
+ - 'lib/packer/provisioner.rb'
15
+
16
+ # Offense count: 1
17
+ # Cop supports --auto-correct.
18
+ # Configuration parameters: IgnoreEmptyBlocks.
19
+ Lint/UnusedBlockArgument:
20
+ Exclude:
21
+ - 'lib/packer/runner.rb'
22
+
23
+ # Offense count: 8
24
+ # Cop supports --auto-correct.
25
+ # Configuration parameters: AllowUnusedKeywordArguments, IgnoreEmptyMethods.
26
+ Lint/UnusedMethodArgument:
27
+ Exclude:
28
+ - 'lib/packer/dataobject.rb'
29
+ - 'lib/packer/envvar.rb'
30
+ - 'lib/packer/macro.rb'
31
+ - 'lib/packer/provisioners/powershell.rb'
32
+
33
+ # Offense count: 2
34
+ Lint/UselessAccessModifier:
35
+ Exclude:
36
+ - 'lib/packer/postprocessor.rb'
37
+ - 'lib/packer/provisioner.rb'
38
+
39
+ # Offense count: 8
40
+ Metrics/AbcSize:
41
+ Max: 30
42
+
43
+ # Offense count: 4
44
+ # Configuration parameters: CountComments.
45
+ Metrics/ClassLength:
46
+ Max: 137
47
+
48
+ # Offense count: 7
49
+ # Configuration parameters: CountComments.
50
+ Metrics/MethodLength:
51
+ Max: 27
52
+
53
+ # Offense count: 1
54
+ # Cop supports --auto-correct.
55
+ # Configuration parameters: SingleLineConditionsOnly.
56
+ Style/ConditionalAssignment:
57
+ Exclude:
58
+ - 'lib/packer/dataobject.rb'
59
+
60
+ # Offense count: 9
61
+ # Cop supports --auto-correct.
62
+ Style/DeprecatedHashMethods:
63
+ Exclude:
64
+ - 'lib/packer-config.rb'
65
+ - 'lib/packer/dataobject.rb'
66
+ - 'lib/packer/postprocessor.rb'
67
+ - 'lib/packer/provisioner.rb'
68
+
69
+ # Offense count: 1
70
+ # Configuration parameters: ExpectMatchingDefinition, Regex, IgnoreExecutableScripts.
71
+ Style/FileName:
72
+ Exclude:
73
+ - 'lib/packer-config.rb'
74
+
75
+ # Offense count: 1
76
+ Style/IfInsideElse:
77
+ Exclude:
78
+ - 'lib/packer/dataobject.rb'
79
+
80
+ # Offense count: 6
81
+ # Cop supports --auto-correct.
82
+ # Configuration parameters: EnforcedStyle, SupportedStyles, IndentationWidth.
83
+ # SupportedStyles: special_inside_parentheses, consistent, align_braces
84
+ Style/IndentHash:
85
+ Enabled: false
86
+
87
+ # Offense count: 31
88
+ # Cop supports --auto-correct.
89
+ Style/MutableConstant:
90
+ Exclude:
91
+ - 'lib/packer-config.rb'
92
+ - 'lib/packer/builder.rb'
93
+ - 'lib/packer/postprocessor.rb'
94
+ - 'lib/packer/provisioner.rb'
95
+ - 'lib/packer/version.rb'
96
+ - 'spec/integration/centos_vagrant_spec.rb'
97
+ - 'spec/packer/postprocessor_spec.rb'
98
+ - 'spec/packer/provisioner_spec.rb'
99
+
100
+ # Offense count: 2
101
+ # Cop supports --auto-correct.
102
+ Style/NegatedIf:
103
+ Exclude:
104
+ - 'lib/packer/dataobject.rb'
105
+
106
+ # Offense count: 9
107
+ Style/NestedParenthesizedCalls:
108
+ Exclude:
109
+ - 'spec/packer/envvar_spec.rb'
110
+ - 'spec/packer/macro_spec.rb'
111
+ - 'spec/packer/runner_spec.rb'
112
+ - 'spec/packer_config_spec.rb'
113
+
114
+ # Offense count: 1
115
+ # Cop supports --auto-correct.
116
+ # Configuration parameters: EnforcedStyle, MinBodyLength, SupportedStyles.
117
+ # SupportedStyles: skip_modifier_ifs, always
118
+ Style/Next:
119
+ Exclude:
120
+ - 'lib/packer/dataobject.rb'
121
+
122
+ # Offense count: 1
123
+ # Cop supports --auto-correct.
124
+ Style/NumericLiterals:
125
+ MinDigits: 6
126
+
127
+ # Offense count: 34
128
+ # Cop supports --auto-correct.
129
+ # Configuration parameters: PreferredDelimiters.
130
+ Style/PercentLiteralDelimiters:
131
+ Enabled: false
132
+
133
+ # Offense count: 6
134
+ # Cop supports --auto-correct.
135
+ # Configuration parameters: EnforcedStyle, SupportedStyles.
136
+ # SupportedStyles: space, no_space
137
+ Style/SpaceBeforeBlockBraces:
138
+ Enabled: false
139
+
140
+ # Offense count: 5
141
+ # Cop supports --auto-correct.
142
+ # Configuration parameters: EnforcedStyle, SupportedStyles, EnforcedStyleForEmptyBraces, SpaceBeforeBlockParameters.
143
+ # SupportedStyles: space, no_space
144
+ Style/SpaceInsideBlockBraces:
145
+ Enabled: false
146
+
147
+ # Offense count: 1
148
+ # Cop supports --auto-correct.
149
+ Style/UnneededInterpolation:
150
+ Exclude:
151
+ - 'lib/packer/runner.rb'
@@ -7,3 +7,4 @@ rvm:
7
7
  - 2.2.0
8
8
  - 2.2.3
9
9
  - ruby-head
10
+ before_install: gem install bundler
data/COPYRIGHT CHANGED
@@ -6,6 +6,7 @@ Including, but not limited to:
6
6
  Fraser Cobb
7
7
  Greg Poirier
8
8
  Greg Diamond
9
+ Enzo Rivello
9
10
 
10
11
  For licensing information please see LICENSE. Copyright holders contributing to
11
12
  this project agree to have their contributions licensed under the terms of the
data/README.md CHANGED
@@ -53,6 +53,7 @@ The following [Packer provisioners](http://www.packer.io/docs/templates/provisio
53
53
  * [salt](https://www.packer.io/docs/provisioners/salt-masterless.html)
54
54
  * [puppet server](https://www.packer.io/docs/provisioners/puppet-server.html)
55
55
  * [puppet masterless](https://www.packer.io/docs/provisioners/puppet-masterless.html)
56
+ * [windows-restart](https://www.packer.io/docs/provisioners/windows-restart.html)
56
57
 
57
58
  ### Post-Processors
58
59
 
@@ -1,5 +1,10 @@
1
1
  # packer-config Release Notes
2
2
 
3
+ ## 1.5.0
4
+
5
+ * Adds json object support the the chef-solo provisioner (via [enzo][]).
6
+ * Fixes Travis-CI setup so tests work with newer bundler
7
+
3
8
  ## 1.4.0
4
9
 
5
10
  * Adds support for Communicators (with help from [diamond29][]).
@@ -41,3 +46,4 @@
41
46
  [grepory]: https://github.com/grepory
42
47
  [ianchesal]: https://github.com/ianchesal
43
48
  [diamond29]: https://github.com/diamond29
49
+ [enzor]: https://github.com/enzor
@@ -3,16 +3,26 @@ module Packer
3
3
  class DataObject
4
4
  attr_accessor :data
5
5
  attr_accessor :required
6
+ attr_accessor :key_dependencies
6
7
 
7
8
  def initialize
8
9
  self.data = {}
9
10
  self.required = []
11
+ self.key_dependencies = {}
10
12
  end
11
13
 
12
14
  class DataValidationError < StandardError
13
15
  end
14
16
 
15
17
  def validate
18
+ validate_required
19
+ validate_key_dependencies
20
+
21
+ # TODO(ianc) Also validate the data with the packer command?
22
+ true
23
+ end
24
+
25
+ def validate_required
16
26
  self.required.each do |r|
17
27
  if (r.is_a? Array) && (r.length > 0)
18
28
  if r.length - (r - self.data.keys).length == 0
@@ -27,8 +37,16 @@ module Packer
27
37
  end
28
38
  end
29
39
  end
30
- # TODO(ianc) Also validate the data with the packer command?
31
- true
40
+ end
41
+
42
+ def validate_key_dependencies
43
+ self.data.keys.each do |data_key|
44
+ if self.key_dependencies.has_key? data_key
45
+ if ! (self.key_dependencies[data_key] - self.data.keys).empty?
46
+ raise DataValidationError.new("Key #{data_key} requires that keys be defined: #{self.key_dependencies[data_key]}")
47
+ end
48
+ end
49
+ end
32
50
  end
33
51
 
34
52
  def add_required(*keys)
@@ -37,6 +55,10 @@ module Packer
37
55
  end
38
56
  end
39
57
 
58
+ def add_key_dependencies(key_deps)
59
+ self.key_dependencies.merge!(key_deps)
60
+ end
61
+
40
62
  def deep_copy
41
63
  Marshal.load(Marshal.dump(self.data))
42
64
  end
@@ -82,6 +104,12 @@ module Packer
82
104
  end
83
105
  end
84
106
 
107
+ def __add_array_of_ints(key, values, exclusives = [])
108
+ self.__exclusive_key_error(key, exclusives)
109
+ raise TypeError.new() unless Array.try_convert(values)
110
+ self.data[key.to_s] = values.to_ary.map(&:to_i)
111
+ end
112
+
85
113
  def __add_string(key, data, exclusives = [])
86
114
  self.__exclusive_key_error(key, exclusives)
87
115
  self.data[key.to_s] = data.to_s
@@ -92,6 +120,7 @@ module Packer
92
120
  self.data[key.to_s] = data.to_i
93
121
  end
94
122
 
123
+
95
124
  def __add_boolean(key, bool, exclusives = [])
96
125
  self.__exclusive_key_error(key, exclusives)
97
126
  if bool
@@ -109,5 +138,15 @@ module Packer
109
138
  self.data[key.to_s][k] = data[k].to_s
110
139
  end
111
140
  end
141
+
142
+
143
+ def __add_json(key, data, exclusives = [])
144
+ self.__exclusive_key_error(key, exclusives)
145
+ raise TypeError.new() unless data.is_a?(Hash)
146
+ self.data[key.to_s] = {}
147
+ data.keys.each do |k|
148
+ self.data[key.to_s][k] = data[k]
149
+ end
150
+ end
112
151
  end
113
152
  end