chef-validation 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +5 -0
- data/README.md +23 -3
- data/lib/chef/validation/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d0844bcbcca288ca5407207912b1febc255f8b11
|
4
|
+
data.tar.gz: de5b5cd82b7ee5b3a379b52b0273d558fdcad500
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b440d9f5f0b19a4136c139a8fd7e5db0d5ca9fccf5bf4ee9602fd05a36620369d764784103482efecef4379c920ae0c30e888332a4a6387877c91c392a072c78
|
7
|
+
data.tar.gz: e01810ecc8163971e38e918ff12b4b5daa4ff45c646446f9ec42f2fb9df43f779fda53aedfc26b3afb4f4416b88daecbcdf6258f3299feeab3bd018fa0dbe638
|
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
# validation
|
1
|
+
# chef-validation
|
2
2
|
|
3
3
|
Perform validation on your node's attributes from a Cookbook's attribute metadata definitions.
|
4
4
|
|
@@ -9,7 +9,7 @@ Perform validation on your node's attributes from a Cookbook's attribute metadat
|
|
9
9
|
|
10
10
|
## Usage
|
11
11
|
|
12
|
-
Add the validation cookbook to your cookbook's metadata
|
12
|
+
Add the validation cookbook to your cookbook's metadata and define your attribute rules:
|
13
13
|
|
14
14
|
```
|
15
15
|
name "my_app"
|
@@ -21,14 +21,34 @@ long_description "Installs/Configures my_app"
|
|
21
21
|
version "0.1.0"
|
22
22
|
|
23
23
|
depends "validation"
|
24
|
+
|
25
|
+
grouping "my_app",
|
26
|
+
title: "My Application"
|
27
|
+
attribute "my_app/log_level",
|
28
|
+
required: "required",
|
29
|
+
default: "debug",
|
30
|
+
choices: [
|
31
|
+
"debug",
|
32
|
+
"fatal",
|
33
|
+
"warn",
|
34
|
+
"info"
|
35
|
+
]
|
36
|
+
attribute "my_app/cookie",
|
37
|
+
required: "required",
|
38
|
+
default: "",
|
39
|
+
type: "string"
|
24
40
|
```
|
25
41
|
|
26
|
-
|
42
|
+
Attribute rules are already part of Chef metadata. However, they are not used at all by the Chef client application itself. You'll need to ensure that you still initialize attributes to their supposedly default value in an attributes file or a recipe.
|
43
|
+
|
44
|
+
Since Chef client doesn't do anything with these attribute definitions we need to leverage the `validate_attributes` definition provided by this cookbook. Place a line like this in one of your cookbook's recipes.
|
27
45
|
|
28
46
|
```
|
29
47
|
validate_attributes "my_app"
|
30
48
|
```
|
31
49
|
|
50
|
+
I recommend placing this in the top of your "default" recipe for each cookbook that you maintain.
|
51
|
+
|
32
52
|
### Compile time validation
|
33
53
|
|
34
54
|
By default, attribute validation will occur at convergence time but this can be switched to compile time by setting an attribute on the `validate_attributes` definition.
|