chef-validation 0.2.1 → 0.2.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +6 -0
- data/lib/chef/validation.rb +1 -1
- data/lib/chef/validation/validator.rb +7 -2
- data/lib/chef/validation/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6ef3435c33e89c5cc6869e0698f5c5b5e21de1e5
|
4
|
+
data.tar.gz: 8aef1ac842fdeb3c599875243f2a5647d923f21b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9de30d6d0c1c2ca4833edb902df7d4f70a12de74ebc6d2f00a993789bb7d4aaeeaafa4b443032fa41143498a4bca0bc3bbfd3a0fe5294cccad4308d45b8c4dc1
|
7
|
+
data.tar.gz: 71e82ceb8fca3e7bb89c7e92a9aad38a22e1ad610ecd5c7375330b3ace9c90806c8031d309605fb05dc116166999341ee1d3914f9f6ad75d446fbd12d4af57d3
|
data/CHANGELOG.md
CHANGED
data/lib/chef/validation.rb
CHANGED
@@ -60,7 +60,7 @@ module Chef::Validation
|
|
60
60
|
def validate_one(node, name)
|
61
61
|
total_errors = {}
|
62
62
|
unless cookbook = ContextExt.cookbook(node.run_context, name)
|
63
|
-
raise "Cookbook not found: #{
|
63
|
+
raise "Cookbook not found in run_context: #{name}"
|
64
64
|
end
|
65
65
|
reload_metadata(cookbook)
|
66
66
|
unless (errors = Validator.run(node, cookbook.metadata)).empty?
|
@@ -43,7 +43,7 @@ module Chef::Validation
|
|
43
43
|
end
|
44
44
|
end
|
45
45
|
if rules["required"].present?
|
46
|
-
errors += validate_required(
|
46
|
+
errors += validate_required(rules["required"], value)
|
47
47
|
end
|
48
48
|
if rules["type"].present?
|
49
49
|
errors += validate_type(value, rules["type"], name)
|
@@ -84,10 +84,15 @@ module Chef::Validation
|
|
84
84
|
errors
|
85
85
|
end
|
86
86
|
|
87
|
-
def validate_required(
|
87
|
+
def validate_required(required, value)
|
88
88
|
errors = []
|
89
89
|
return errors if value.is_a?(TrueClass) || value.is_a?(FalseClass)
|
90
90
|
|
91
|
+
if ['optional', 'recommended'].include?(required)
|
92
|
+
return errors
|
93
|
+
end
|
94
|
+
|
95
|
+
# Only required gets here
|
91
96
|
if value.blank?
|
92
97
|
errors << "Required attribute but was not present."
|
93
98
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: chef-validation
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jamie Winsor
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2015-07-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: chef
|