puppet 3.1.0.rc1 → 3.1.0.rc2
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of puppet might be problematic. Click here for more details.
- data/COMMITTERS.md +185 -0
- data/ext/debian/changelog.erb +6 -0
- data/ext/debian/puppet-common.manpages +1 -0
- data/ext/debian/puppet.default +3 -1
- data/ext/debian/puppetmaster.default +6 -3
- data/ext/redhat/puppet.spec.erb +16 -5
- data/lib/puppet.rb +3 -5
- data/lib/puppet/defaults.rb +6 -5
- data/lib/puppet/dsl.rb +3 -7
- data/lib/puppet/dsl/resource_api.rb +120 -0
- data/lib/puppet/dsl/resource_type_api.rb +34 -0
- data/lib/puppet/module_tool.rb +23 -11
- data/lib/puppet/network/formats.rb +1 -1
- data/lib/puppet/node/environment.rb +1 -3
- data/lib/puppet/parser/ast/definition.rb +5 -2
- data/lib/puppet/parser/ast/hostclass.rb +3 -2
- data/lib/puppet/parser/ast/node.rb +5 -2
- data/lib/puppet/parser/ast/resourceparam.rb +1 -1
- data/lib/puppet/parser/compiler.rb +0 -10
- data/lib/puppet/parser/lexer.rb +50 -39
- data/lib/puppet/parser/parser_support.rb +29 -11
- data/lib/puppet/parser/scope.rb +2 -2
- data/lib/puppet/parser/type_loader.rb +7 -31
- data/lib/puppet/provider/package/openbsd.rb +16 -2
- data/lib/puppet/provider/package/pip.rb +11 -2
- data/lib/puppet/provider/package/portage.rb +29 -12
- data/lib/puppet/provider/service/launchd.rb +19 -14
- data/lib/puppet/provider/service/upstart.rb +1 -1
- data/lib/puppet/provider/user/hpux.rb +37 -2
- data/lib/puppet/resource.rb +25 -38
- data/lib/puppet/resource/type.rb +6 -14
- data/lib/puppet/settings.rb +1 -1
- data/lib/puppet/ssl/certificate_authority.rb +4 -1
- data/lib/puppet/ssl/certificate_request.rb +3 -1
- data/lib/puppet/ssl/certificate_signer.rb +22 -0
- data/lib/puppet/type.rb +4 -4
- data/lib/puppet/util/methodhelper.rb +0 -19
- data/lib/puppet/util/rubygems.rb +3 -1
- data/lib/puppet/util/selinux.rb +1 -6
- data/lib/puppet/version.rb +1 -1
- data/man/man5/puppet.conf.5 +81 -95
- data/man/man8/extlookup2hiera.8 +23 -0
- data/man/man8/puppet-agent.8 +3 -3
- data/man/man8/puppet-apply.8 +2 -6
- data/man/man8/puppet-ca.8 +6 -7
- data/man/man8/puppet-catalog.8 +6 -7
- data/man/man8/puppet-cert.8 +4 -4
- data/man/man8/puppet-certificate.8 +6 -7
- data/man/man8/puppet-certificate_request.8 +6 -7
- data/man/man8/puppet-certificate_revocation_list.8 +6 -7
- data/man/man8/puppet-config.8 +4 -8
- data/man/man8/puppet-describe.8 +1 -1
- data/man/man8/puppet-device.8 +1 -1
- data/man/man8/puppet-doc.8 +3 -3
- data/man/man8/puppet-facts.8 +4 -8
- data/man/man8/puppet-file.8 +6 -7
- data/man/man8/puppet-filebucket.8 +1 -1
- data/man/man8/puppet-help.8 +2 -6
- data/man/man8/puppet-inspect.8 +1 -1
- data/man/man8/puppet-instrumentation_data.8 +3 -7
- data/man/man8/puppet-instrumentation_listener.8 +3 -7
- data/man/man8/puppet-instrumentation_probe.8 +3 -7
- data/man/man8/puppet-key.8 +6 -7
- data/man/man8/puppet-kick.8 +5 -1
- data/man/man8/puppet-man.8 +2 -6
- data/man/man8/puppet-master.8 +2 -2
- data/man/man8/puppet-module.8 +11 -9
- data/man/man8/puppet-node.8 +38 -37
- data/man/man8/puppet-parser.8 +2 -6
- data/man/man8/puppet-plugin.8 +2 -6
- data/man/man8/puppet-queue.8 +1 -1
- data/man/man8/puppet-report.8 +3 -7
- data/man/man8/puppet-resource.8 +1 -1
- data/man/man8/puppet-resource_type.8 +3 -7
- data/man/man8/puppet-secret_agent.8 +2 -6
- data/man/man8/puppet-status.8 +3 -7
- data/man/man8/puppet.8 +1 -1
- data/spec/integration/parser/ruby_manifest_spec.rb +128 -0
- data/spec/lib/puppet_spec/compiler.rb +0 -11
- data/spec/spec_helper.rb +3 -4
- data/spec/unit/dsl/resource_api_spec.rb +180 -0
- data/spec/unit/dsl/resource_type_api_spec.rb +53 -0
- data/spec/unit/module_tool_spec.rb +79 -46
- data/spec/unit/network/formats_spec.rb +4 -0
- data/spec/unit/node/environment_spec.rb +0 -13
- data/spec/unit/parser/compiler_spec.rb +0 -26
- data/spec/unit/parser/parser_spec.rb +14 -0
- data/spec/unit/parser/type_loader_spec.rb +4 -15
- data/spec/unit/provider/package/openbsd_spec.rb +148 -35
- data/spec/unit/provider/package/pip_spec.rb +49 -25
- data/spec/unit/provider/package/portage_spec.rb +65 -0
- data/spec/unit/provider/service/launchd_spec.rb +6 -5
- data/spec/unit/provider/user/hpux_spec.rb +39 -11
- data/spec/unit/provider/user/useradd_spec.rb +14 -14
- data/spec/unit/resource/type_spec.rb +7 -49
- data/spec/unit/resource_spec.rb +0 -32
- data/spec/unit/ssl/certificate_request_spec.rb +18 -0
- data/spec/unit/util/rubygems_spec.rb +1 -1
- data/spec/unit/util/selinux_spec.rb +0 -2
- metadata +17 -50
- data/lib/puppet/dsl/actions.rb +0 -283
- data/lib/puppet/dsl/blank_slate.rb +0 -55
- data/lib/puppet/dsl/context.rb +0 -393
- data/lib/puppet/dsl/parser.rb +0 -57
- data/lib/puppet/dsl/resource_decorator.rb +0 -56
- data/lib/puppet/dsl/resource_reference.rb +0 -95
- data/lib/puppet/dsl/type_reference.rb +0 -102
- data/lib/puppet/util/manifest_filetype_helper.rb +0 -22
- data/spec/integration/dsl/classes_spec.rb +0 -191
- data/spec/integration/dsl/defaults_spec.rb +0 -38
- data/spec/integration/dsl/definitions_spec.rb +0 -73
- data/spec/integration/dsl/functions_spec.rb +0 -95
- data/spec/integration/dsl/nodes_spec.rb +0 -96
- data/spec/integration/dsl/params_spec.rb +0 -146
- data/spec/integration/dsl/relationships_spec.rb +0 -46
- data/spec/integration/dsl/resources_spec.rb +0 -202
- data/spec/integration/dsl/type_loading_spec.rb +0 -64
- data/spec/lib/matchers/catalog.rb +0 -50
- data/spec/lib/puppet_spec/dsl.rb +0 -29
- data/spec/unit/dsl/actions_spec.rb +0 -402
- data/spec/unit/dsl/blank_slate_spec.rb +0 -27
- data/spec/unit/dsl/context_spec.rb +0 -678
- data/spec/unit/dsl/parser_spec.rb +0 -56
- data/spec/unit/dsl/resource_decorator_spec.rb +0 -94
- data/spec/unit/dsl/resource_reference_spec.rb +0 -150
- data/spec/unit/dsl/type_reference_spec.rb +0 -164
- data/spec/unit/util/manifest_filetype_helper_spec.rb +0 -29
data/man/man8/puppet-parser.8
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
.\" generated with Ronn/v0.7.3
|
2
2
|
.\" http://github.com/rtomayko/ronn/tree/0.7.3
|
3
3
|
.
|
4
|
-
.TH "PUPPET\-PARSER" "8" "
|
4
|
+
.TH "PUPPET\-PARSER" "8" "January 2013" "Puppet Labs, LLC" "Puppet manual"
|
5
5
|
.
|
6
6
|
.SH "NAME"
|
7
7
|
\fBpuppet\-parser\fR \- Interact directly with the parser\.
|
@@ -10,16 +10,12 @@
|
|
10
10
|
puppet parser \fIaction\fR
|
11
11
|
.
|
12
12
|
.SH "OPTIONS"
|
13
|
-
Note that any configuration parameter that\'s valid in the configuration file is also a valid long argument, although it may or may not be relevant to the present action\. For example, \fBserver\fR
|
13
|
+
Note that any configuration parameter that\'s valid in the configuration file is also a valid long argument, although it may or may not be relevant to the present action\. For example, \fBserver\fR and \fBrun_mode\fR are valid configuration parameters, so you can specify \fB\-\-server <servername>\fR, or \fB\-\-run_mode <runmode>\fR as an argument\.
|
14
14
|
.
|
15
15
|
.P
|
16
16
|
See the configuration file documentation at \fIhttp://docs\.puppetlabs\.com/references/stable/configuration\.html\fR for the full list of acceptable parameters\. A commented list of all configuration options can also be generated by running puppet with \fB\-\-genconfig\fR\.
|
17
17
|
.
|
18
18
|
.TP
|
19
|
-
\-\-mode MODE
|
20
|
-
The run mode to use for the current action\. Valid modes are \fBuser\fR, \fBagent\fR, and \fBmaster\fR\.
|
21
|
-
.
|
22
|
-
.TP
|
23
19
|
\-\-render\-as FORMAT
|
24
20
|
The format in which to render output\. The most common formats are \fBjson\fR, \fBs\fR (string), \fByaml\fR, and \fBconsole\fR, but other options such as \fBdot\fR are sometimes available\.
|
25
21
|
.
|
data/man/man8/puppet-plugin.8
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
.\" generated with Ronn/v0.7.3
|
2
2
|
.\" http://github.com/rtomayko/ronn/tree/0.7.3
|
3
3
|
.
|
4
|
-
.TH "PUPPET\-PLUGIN" "8" "
|
4
|
+
.TH "PUPPET\-PLUGIN" "8" "January 2013" "Puppet Labs, LLC" "Puppet manual"
|
5
5
|
.
|
6
6
|
.SH "NAME"
|
7
7
|
\fBpuppet\-plugin\fR \- Interact with the Puppet plugin system\.
|
@@ -16,16 +16,12 @@ This subcommand provides network access to the puppet master\'s store of plugins
|
|
16
16
|
The puppet master serves Ruby code collected from the \fBlib\fR directories of its modules\. These plugins can be used on agent nodes to extend Facter and implement custom types and providers\. Plugins are normally downloaded by puppet agent during the course of a run\.
|
17
17
|
.
|
18
18
|
.SH "OPTIONS"
|
19
|
-
Note that any configuration parameter that\'s valid in the configuration file is also a valid long argument, although it may or may not be relevant to the present action\. For example, \fBserver\fR
|
19
|
+
Note that any configuration parameter that\'s valid in the configuration file is also a valid long argument, although it may or may not be relevant to the present action\. For example, \fBserver\fR and \fBrun_mode\fR are valid configuration parameters, so you can specify \fB\-\-server <servername>\fR, or \fB\-\-run_mode <runmode>\fR as an argument\.
|
20
20
|
.
|
21
21
|
.P
|
22
22
|
See the configuration file documentation at \fIhttp://docs\.puppetlabs\.com/references/stable/configuration\.html\fR for the full list of acceptable parameters\. A commented list of all configuration options can also be generated by running puppet with \fB\-\-genconfig\fR\.
|
23
23
|
.
|
24
24
|
.TP
|
25
|
-
\-\-mode MODE
|
26
|
-
The run mode to use for the current action\. Valid modes are \fBuser\fR, \fBagent\fR, and \fBmaster\fR\.
|
27
|
-
.
|
28
|
-
.TP
|
29
25
|
\-\-render\-as FORMAT
|
30
26
|
The format in which to render output\. The most common formats are \fBjson\fR, \fBs\fR (string), \fByaml\fR, and \fBconsole\fR, but other options such as \fBdot\fR are sometimes available\.
|
31
27
|
.
|
data/man/man8/puppet-queue.8
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
.\" generated with Ronn/v0.7.3
|
2
2
|
.\" http://github.com/rtomayko/ronn/tree/0.7.3
|
3
3
|
.
|
4
|
-
.TH "PUPPET\-QUEUE" "8" "
|
4
|
+
.TH "PUPPET\-QUEUE" "8" "January 2013" "Puppet Labs, LLC" "Puppet manual"
|
5
5
|
.
|
6
6
|
.SH "NAME"
|
7
7
|
\fBpuppet\-queue\fR \- Queuing daemon for asynchronous storeconfigs
|
data/man/man8/puppet-report.8
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
.\" generated with Ronn/v0.7.3
|
2
2
|
.\" http://github.com/rtomayko/ronn/tree/0.7.3
|
3
3
|
.
|
4
|
-
.TH "PUPPET\-REPORT" "8" "
|
4
|
+
.TH "PUPPET\-REPORT" "8" "January 2013" "Puppet Labs, LLC" "Puppet manual"
|
5
5
|
.
|
6
6
|
.SH "NAME"
|
7
7
|
\fBpuppet\-report\fR \- Create, display, and submit reports\.
|
@@ -10,16 +10,12 @@
|
|
10
10
|
puppet report \fIaction\fR [\-\-terminus TERMINUS] [\-\-extra HASH]
|
11
11
|
.
|
12
12
|
.SH "OPTIONS"
|
13
|
-
Note that any configuration parameter that\'s valid in the configuration file is also a valid long argument, although it may or may not be relevant to the present action\. For example, \fBserver\fR
|
13
|
+
Note that any configuration parameter that\'s valid in the configuration file is also a valid long argument, although it may or may not be relevant to the present action\. For example, \fBserver\fR and \fBrun_mode\fR are valid configuration parameters, so you can specify \fB\-\-server <servername>\fR, or \fB\-\-run_mode <runmode>\fR as an argument\.
|
14
14
|
.
|
15
15
|
.P
|
16
16
|
See the configuration file documentation at \fIhttp://docs\.puppetlabs\.com/references/stable/configuration\.html\fR for the full list of acceptable parameters\. A commented list of all configuration options can also be generated by running puppet with \fB\-\-genconfig\fR\.
|
17
17
|
.
|
18
18
|
.TP
|
19
|
-
\-\-mode MODE
|
20
|
-
The run mode to use for the current action\. Valid modes are \fBuser\fR, \fBagent\fR, and \fBmaster\fR\.
|
21
|
-
.
|
22
|
-
.TP
|
23
19
|
\-\-render\-as FORMAT
|
24
20
|
The format in which to render output\. The most common formats are \fBjson\fR, \fBs\fR (string), \fByaml\fR, and \fBconsole\fR, but other options such as \fBdot\fR are sometimes available\.
|
25
21
|
.
|
@@ -84,7 +80,7 @@ puppet report info [\-\-terminus TERMINUS] [\-\-extra HASH]
|
|
84
80
|
\fBDESCRIPTION\fR
|
85
81
|
.
|
86
82
|
.IP
|
87
|
-
Prints the default terminus class for this subcommand\. Note that different run modes may have different default termini; when in doubt, specify the run mode with the \'\-\-
|
83
|
+
Prints the default terminus class for this subcommand\. Note that different run modes may have different default termini; when in doubt, specify the run mode with the \'\-\-run_mode\' option\.
|
88
84
|
.
|
89
85
|
.TP
|
90
86
|
\fBsave\fR \- API only: submit a report\.
|
data/man/man8/puppet-resource.8
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
.\" generated with Ronn/v0.7.3
|
2
2
|
.\" http://github.com/rtomayko/ronn/tree/0.7.3
|
3
3
|
.
|
4
|
-
.TH "PUPPET\-RESOURCE" "8" "
|
4
|
+
.TH "PUPPET\-RESOURCE" "8" "January 2013" "Puppet Labs, LLC" "Puppet manual"
|
5
5
|
.
|
6
6
|
.SH "NAME"
|
7
7
|
\fBpuppet\-resource\fR \- The resource abstraction layer shell
|
@@ -1,7 +1,7 @@
|
|
1
1
|
.\" generated with Ronn/v0.7.3
|
2
2
|
.\" http://github.com/rtomayko/ronn/tree/0.7.3
|
3
3
|
.
|
4
|
-
.TH "PUPPET\-RESOURCE_TYPE" "8" "
|
4
|
+
.TH "PUPPET\-RESOURCE_TYPE" "8" "January 2013" "Puppet Labs, LLC" "Puppet manual"
|
5
5
|
.
|
6
6
|
.SH "NAME"
|
7
7
|
\fBpuppet\-resource_type\fR \- View classes, defined resource types, and nodes from all manifests\.
|
@@ -16,16 +16,12 @@ This subcommand reads information about the resource collections (classes, nodes
|
|
16
16
|
It will eventually be extended to examine native resource types\.
|
17
17
|
.
|
18
18
|
.SH "OPTIONS"
|
19
|
-
Note that any configuration parameter that\'s valid in the configuration file is also a valid long argument, although it may or may not be relevant to the present action\. For example, \fBserver\fR
|
19
|
+
Note that any configuration parameter that\'s valid in the configuration file is also a valid long argument, although it may or may not be relevant to the present action\. For example, \fBserver\fR and \fBrun_mode\fR are valid configuration parameters, so you can specify \fB\-\-server <servername>\fR, or \fB\-\-run_mode <runmode>\fR as an argument\.
|
20
20
|
.
|
21
21
|
.P
|
22
22
|
See the configuration file documentation at \fIhttp://docs\.puppetlabs\.com/references/stable/configuration\.html\fR for the full list of acceptable parameters\. A commented list of all configuration options can also be generated by running puppet with \fB\-\-genconfig\fR\.
|
23
23
|
.
|
24
24
|
.TP
|
25
|
-
\-\-mode MODE
|
26
|
-
The run mode to use for the current action\. Valid modes are \fBuser\fR, \fBagent\fR, and \fBmaster\fR\.
|
27
|
-
.
|
28
|
-
.TP
|
29
25
|
\-\-render\-as FORMAT
|
30
26
|
The format in which to render output\. The most common formats are \fBjson\fR, \fBs\fR (string), \fByaml\fR, and \fBconsole\fR, but other options such as \fBdot\fR are sometimes available\.
|
31
27
|
.
|
@@ -105,7 +101,7 @@ puppet resource_type info [\-\-terminus TERMINUS] [\-\-extra HASH]
|
|
105
101
|
\fBDESCRIPTION\fR
|
106
102
|
.
|
107
103
|
.IP
|
108
|
-
Prints the default terminus class for this subcommand\. Note that different run modes may have different default termini; when in doubt, specify the run mode with the \'\-\-
|
104
|
+
Prints the default terminus class for this subcommand\. Note that different run modes may have different default termini; when in doubt, specify the run mode with the \'\-\-run_mode\' option\.
|
109
105
|
.
|
110
106
|
.TP
|
111
107
|
\fBsave\fR \- Invalid for this subcommand\.
|
@@ -1,7 +1,7 @@
|
|
1
1
|
.\" generated with Ronn/v0.7.3
|
2
2
|
.\" http://github.com/rtomayko/ronn/tree/0.7.3
|
3
3
|
.
|
4
|
-
.TH "PUPPET\-SECRET_AGENT" "8" "
|
4
|
+
.TH "PUPPET\-SECRET_AGENT" "8" "January 2013" "Puppet Labs, LLC" "Puppet manual"
|
5
5
|
.
|
6
6
|
.SH "NAME"
|
7
7
|
\fBpuppet\-secret_agent\fR \- Mimics puppet agent\.
|
@@ -13,16 +13,12 @@ puppet secret_agent \fIaction\fR
|
|
13
13
|
This subcommand currently functions as a proof of concept, demonstrating how the Faces API exposes Puppet\'s internal systems to application logic; compare the actual code for puppet agent\. It will eventually replace puppet agent entirely, and can provide a template for users who wish to implement agent\-like functionality with non\-standard application logic\.
|
14
14
|
.
|
15
15
|
.SH "OPTIONS"
|
16
|
-
Note that any configuration parameter that\'s valid in the configuration file is also a valid long argument, although it may or may not be relevant to the present action\. For example, \fBserver\fR
|
16
|
+
Note that any configuration parameter that\'s valid in the configuration file is also a valid long argument, although it may or may not be relevant to the present action\. For example, \fBserver\fR and \fBrun_mode\fR are valid configuration parameters, so you can specify \fB\-\-server <servername>\fR, or \fB\-\-run_mode <runmode>\fR as an argument\.
|
17
17
|
.
|
18
18
|
.P
|
19
19
|
See the configuration file documentation at \fIhttp://docs\.puppetlabs\.com/references/stable/configuration\.html\fR for the full list of acceptable parameters\. A commented list of all configuration options can also be generated by running puppet with \fB\-\-genconfig\fR\.
|
20
20
|
.
|
21
21
|
.TP
|
22
|
-
\-\-mode MODE
|
23
|
-
The run mode to use for the current action\. Valid modes are \fBuser\fR, \fBagent\fR, and \fBmaster\fR\.
|
24
|
-
.
|
25
|
-
.TP
|
26
22
|
\-\-render\-as FORMAT
|
27
23
|
The format in which to render output\. The most common formats are \fBjson\fR, \fBs\fR (string), \fByaml\fR, and \fBconsole\fR, but other options such as \fBdot\fR are sometimes available\.
|
28
24
|
.
|
data/man/man8/puppet-status.8
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
.\" generated with Ronn/v0.7.3
|
2
2
|
.\" http://github.com/rtomayko/ronn/tree/0.7.3
|
3
3
|
.
|
4
|
-
.TH "PUPPET\-STATUS" "8" "
|
4
|
+
.TH "PUPPET\-STATUS" "8" "January 2013" "Puppet Labs, LLC" "Puppet manual"
|
5
5
|
.
|
6
6
|
.SH "NAME"
|
7
7
|
\fBpuppet\-status\fR \- View puppet server status\.
|
@@ -10,16 +10,12 @@
|
|
10
10
|
puppet status \fIaction\fR [\-\-terminus TERMINUS] [\-\-extra HASH]
|
11
11
|
.
|
12
12
|
.SH "OPTIONS"
|
13
|
-
Note that any configuration parameter that\'s valid in the configuration file is also a valid long argument, although it may or may not be relevant to the present action\. For example, \fBserver\fR
|
13
|
+
Note that any configuration parameter that\'s valid in the configuration file is also a valid long argument, although it may or may not be relevant to the present action\. For example, \fBserver\fR and \fBrun_mode\fR are valid configuration parameters, so you can specify \fB\-\-server <servername>\fR, or \fB\-\-run_mode <runmode>\fR as an argument\.
|
14
14
|
.
|
15
15
|
.P
|
16
16
|
See the configuration file documentation at \fIhttp://docs\.puppetlabs\.com/references/stable/configuration\.html\fR for the full list of acceptable parameters\. A commented list of all configuration options can also be generated by running puppet with \fB\-\-genconfig\fR\.
|
17
17
|
.
|
18
18
|
.TP
|
19
|
-
\-\-mode MODE
|
20
|
-
The run mode to use for the current action\. Valid modes are \fBuser\fR, \fBagent\fR, and \fBmaster\fR\.
|
21
|
-
.
|
22
|
-
.TP
|
23
19
|
\-\-render\-as FORMAT
|
24
20
|
The format in which to render output\. The most common formats are \fBjson\fR, \fBs\fR (string), \fByaml\fR, and \fBconsole\fR, but other options such as \fBdot\fR are sometimes available\.
|
25
21
|
.
|
@@ -102,7 +98,7 @@ puppet status info [\-\-terminus TERMINUS] [\-\-extra HASH]
|
|
102
98
|
\fBDESCRIPTION\fR
|
103
99
|
.
|
104
100
|
.IP
|
105
|
-
Prints the default terminus class for this subcommand\. Note that different run modes may have different default termini; when in doubt, specify the run mode with the \'\-\-
|
101
|
+
Prints the default terminus class for this subcommand\. Note that different run modes may have different default termini; when in doubt, specify the run mode with the \'\-\-run_mode\' option\.
|
106
102
|
.
|
107
103
|
.TP
|
108
104
|
\fBsave\fR \- Invalid for this subcommand\.
|
data/man/man8/puppet.8
CHANGED
@@ -0,0 +1,128 @@
|
|
1
|
+
#! /usr/bin/env ruby
|
2
|
+
require 'spec_helper'
|
3
|
+
|
4
|
+
require 'tempfile'
|
5
|
+
require 'puppet_spec/files'
|
6
|
+
|
7
|
+
describe "Pure ruby manifests" do
|
8
|
+
include PuppetSpec::Files
|
9
|
+
|
10
|
+
before do
|
11
|
+
@node = Puppet::Node.new "testnode"
|
12
|
+
|
13
|
+
@scope_resource = stub 'scope_resource', :builtin? => true, :finish => nil, :ref => 'Class[main]'
|
14
|
+
@scope = stub 'scope', :resource => @scope_resource, :source => mock("source")
|
15
|
+
@test_dir = tmpdir('ruby_manifest_test')
|
16
|
+
Puppet.expects(:deprecation_warning).at_least(1)
|
17
|
+
end
|
18
|
+
|
19
|
+
after do
|
20
|
+
Puppet.settings.clear
|
21
|
+
end
|
22
|
+
|
23
|
+
def write_file(name, contents)
|
24
|
+
path = File.join(@test_dir, name)
|
25
|
+
File.open(path, "w") { |f| f.write(contents) }
|
26
|
+
path
|
27
|
+
end
|
28
|
+
|
29
|
+
def compile(contents)
|
30
|
+
Puppet[:code] = contents
|
31
|
+
Dir.chdir(@test_dir) do
|
32
|
+
Puppet::Parser::Compiler.compile(Puppet::Node.new("mynode"))
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
36
|
+
it "should allow classes" do
|
37
|
+
write_file('foo.rb', ["hostclass 'one' do notify('one_notify') end",
|
38
|
+
"hostclass 'two' do notify('two_notify') end"].join("\n"))
|
39
|
+
catalog = compile("import 'foo'\ninclude one")
|
40
|
+
catalog.resource("Notify[one_notify]").should_not be_nil
|
41
|
+
catalog.resource("Notify[two_notify]").should be_nil
|
42
|
+
end
|
43
|
+
|
44
|
+
it "should allow defines" do
|
45
|
+
write_file('foo.rb', 'define "bar", :arg do notify("bar_#{@name}_#{@arg}") end')
|
46
|
+
catalog = compile("import 'foo'\nbar { instance: arg => 'xyz' }")
|
47
|
+
catalog.resource("Notify[bar_instance_xyz]").should_not be_nil
|
48
|
+
catalog.resource("Bar[instance]").should_not be_nil
|
49
|
+
end
|
50
|
+
|
51
|
+
it "should allow node declarations" do
|
52
|
+
write_file('foo.rb', "node 'mynode' do notify('mynode') end")
|
53
|
+
catalog = compile("import 'foo'")
|
54
|
+
node_declaration = catalog.resource("Notify[mynode]")
|
55
|
+
node_declaration.should_not be_nil
|
56
|
+
node_declaration.title.should == 'mynode'
|
57
|
+
end
|
58
|
+
|
59
|
+
it "should allow access to the environment" do
|
60
|
+
write_file('foo.rb', ["hostclass 'bar' do",
|
61
|
+
" if environment.is_a? Puppet::Node::Environment",
|
62
|
+
" notify('success')",
|
63
|
+
" end",
|
64
|
+
"end"].join("\n"))
|
65
|
+
compile("import 'foo'\ninclude bar").resource("Notify[success]").should_not be_nil
|
66
|
+
end
|
67
|
+
|
68
|
+
it "should allow creation of resources of built-in types" do
|
69
|
+
write_file('foo.rb', "hostclass 'bar' do file 'test_file', :owner => 'root', :mode => '644' end")
|
70
|
+
catalog = compile("import 'foo'\ninclude bar")
|
71
|
+
file = catalog.resource("File[test_file]")
|
72
|
+
file.should be_a(Puppet::Resource)
|
73
|
+
file.type.should == 'File'
|
74
|
+
file.title.should == 'test_file'
|
75
|
+
file.exported.should_not be
|
76
|
+
file.virtual.should_not be
|
77
|
+
file[:owner].should == 'root'
|
78
|
+
file[:mode].should == '644'
|
79
|
+
file[:stage].should be_nil # TODO: is this correct behavior?
|
80
|
+
end
|
81
|
+
|
82
|
+
it "should allow calling user-defined functions" do
|
83
|
+
write_file('foo.rb', "hostclass 'bar' do user_func 'name', :arg => 'xyz' end")
|
84
|
+
catalog = compile(['define user_func($arg) { notify {"n_$arg": } }',
|
85
|
+
'import "foo"',
|
86
|
+
'include bar'].join("\n"))
|
87
|
+
catalog.resource("Notify[n_xyz]").should_not be_nil
|
88
|
+
catalog.resource("User_func[name]").should_not be_nil
|
89
|
+
end
|
90
|
+
|
91
|
+
it "should be properly cached for multiple compiles" do
|
92
|
+
# Note: we can't test this by calling compile() twice, because
|
93
|
+
# that sets Puppet[:code], which clears out all cached
|
94
|
+
# environments.
|
95
|
+
Puppet[:filetimeout] = 1000
|
96
|
+
write_file('foo.rb', "hostclass 'bar' do notify('success') end")
|
97
|
+
Puppet[:code] = "import 'foo'\ninclude bar"
|
98
|
+
|
99
|
+
# Compile the catalog and check it
|
100
|
+
catalog = Dir.chdir(@test_dir) do
|
101
|
+
Puppet::Parser::Compiler.compile(Puppet::Node.new("mynode"))
|
102
|
+
end
|
103
|
+
catalog.resource("Notify[success]").should_not be_nil
|
104
|
+
|
105
|
+
# Secretly change the file to make it invalid. This change
|
106
|
+
# shouldn't be noticed because the we've set a high
|
107
|
+
# Puppet[:filetimeout].
|
108
|
+
write_file('foo.rb', "raise 'should not be executed'")
|
109
|
+
|
110
|
+
# Compile the catalog a second time and make sure it's still ok.
|
111
|
+
catalog = Dir.chdir(@test_dir) do
|
112
|
+
Puppet::Parser::Compiler.compile(Puppet::Node.new("mynode"))
|
113
|
+
end
|
114
|
+
catalog.resource("Notify[success]").should_not be_nil
|
115
|
+
end
|
116
|
+
|
117
|
+
it "should be properly reloaded when stale" do
|
118
|
+
Puppet[:filetimeout] = -1 # force stale check to happen all the time
|
119
|
+
write_file('foo.rb', "hostclass 'bar' do notify('version1') end")
|
120
|
+
catalog = compile("import 'foo'\ninclude bar")
|
121
|
+
catalog.resource("Notify[version1]").should_not be_nil
|
122
|
+
sleep 1 # so that timestamp will change forcing file reload
|
123
|
+
write_file('foo.rb', "hostclass 'bar' do notify('version2') end")
|
124
|
+
catalog = compile("import 'foo'\ninclude bar")
|
125
|
+
catalog.resource("Notify[version1]").should be_nil
|
126
|
+
catalog.resource("Notify[version2]").should_not be_nil
|
127
|
+
end
|
128
|
+
end
|
@@ -3,15 +3,4 @@ module PuppetSpec::Compiler
|
|
3
3
|
Puppet[:code] = string
|
4
4
|
Puppet::Parser::Compiler.compile(node)
|
5
5
|
end
|
6
|
-
|
7
|
-
def compile_ruby_to_catalog(string = nil, node = Puppet::Node.new('foonode'))
|
8
|
-
File.stubs(:read).returns(string)
|
9
|
-
Puppet::Parser::Compiler.compile(node)
|
10
|
-
end
|
11
|
-
|
12
|
-
def prepare_compiler
|
13
|
-
let(:compiler) { Puppet::Parser::Compiler.new(Puppet::Node.new("floppy", :environment => 'production')) }
|
14
|
-
let(:scope) { Puppet::Parser::Scope.new compiler }
|
15
|
-
end
|
16
|
-
|
17
6
|
end
|
data/spec/spec_helper.rb
CHANGED
@@ -1,7 +1,6 @@
|
|
1
|
-
# NOTE: a lot of the stuff in this file is duplicated in the
|
2
|
-
#
|
3
|
-
#
|
4
|
-
# have the puppet core itself use puppetlabs_spec_helper
|
1
|
+
# NOTE: a lot of the stuff in this file is duplicated in the "puppet_spec_helper" in the project
|
2
|
+
# puppetlabs_spec_helper. We should probably eat our own dog food and get rid of most of this from here,
|
3
|
+
# and have the puppet core itself use puppetlabs_spec_helper
|
5
4
|
|
6
5
|
dir = File.expand_path(File.dirname(__FILE__))
|
7
6
|
$LOAD_PATH.unshift File.join(dir, 'lib')
|
@@ -0,0 +1,180 @@
|
|
1
|
+
#! /usr/bin/env ruby
|
2
|
+
require 'spec_helper'
|
3
|
+
|
4
|
+
require 'puppet/dsl/resource_api'
|
5
|
+
|
6
|
+
describe Puppet::DSL::ResourceAPI do
|
7
|
+
before do
|
8
|
+
@compiler = Puppet::Parser::Compiler.new(Puppet::Node.new("foo"))
|
9
|
+
@scope = Puppet::Parser::Scope.new(@compiler, :source => "foo")
|
10
|
+
@resource = Puppet::Parser::Resource.new(:mytype, "myresource", :scope => @scope)
|
11
|
+
@api = Puppet::DSL::ResourceAPI.new(@resource, @scope, proc { })
|
12
|
+
end
|
13
|
+
|
14
|
+
it "should include the resource type collection helper" do
|
15
|
+
Puppet::DSL::ResourceAPI.ancestors.should be_include(Puppet::Resource::TypeCollectionHelper)
|
16
|
+
end
|
17
|
+
|
18
|
+
it "should use the scope's environment as its environment" do
|
19
|
+
@scope.expects(:environment).returns "myenv"
|
20
|
+
@api.environment.should == "myenv"
|
21
|
+
end
|
22
|
+
|
23
|
+
it "should be able to set all of its parameters as instance variables" do
|
24
|
+
@resource["foo"] = "myval"
|
25
|
+
@api.set_instance_variables
|
26
|
+
@api.instance_variable_get("@foo").should == "myval"
|
27
|
+
end
|
28
|
+
|
29
|
+
describe "when calling a function" do
|
30
|
+
it "should return false if the function does not exist" do
|
31
|
+
Puppet::Parser::Functions.expects(:function).with("myfunc").returns nil
|
32
|
+
@api.call_function("myfunc", "foo").should be_false
|
33
|
+
end
|
34
|
+
|
35
|
+
it "should use the scope the call the provided function with the provided arguments and return the results" do
|
36
|
+
scope = stub 'scope'
|
37
|
+
@api.stubs(:scope).returns scope
|
38
|
+
Puppet::Parser::Functions.expects(:function).with("myfunc").returns "myfunc_method"
|
39
|
+
|
40
|
+
scope.expects(:myfunc_method).with("one", "two")
|
41
|
+
@api.call_function("myfunc", ["one", "two"])
|
42
|
+
end
|
43
|
+
|
44
|
+
it "should call 'include' when asked to call 'acquire'" do
|
45
|
+
scope = stub 'scope'
|
46
|
+
@api.stubs(:scope).returns scope
|
47
|
+
@api.stubs(:valid_type?).returns false
|
48
|
+
|
49
|
+
scope.expects(:function_include).with("one", "two")
|
50
|
+
@api.acquire("one", "two")
|
51
|
+
end
|
52
|
+
end
|
53
|
+
|
54
|
+
describe "when determining if a provided name is a valid type" do
|
55
|
+
it "should be valid if it's :class" do
|
56
|
+
@api.should be_valid_type(:class)
|
57
|
+
end
|
58
|
+
|
59
|
+
it "should be valid if it's :node" do
|
60
|
+
@api.should be_valid_type(:node)
|
61
|
+
end
|
62
|
+
|
63
|
+
it "should be valid if it's a builtin type" do
|
64
|
+
Puppet::Type.expects(:type).with(:mytype).returns "whatever"
|
65
|
+
@api.should be_valid_type(:mytype)
|
66
|
+
end
|
67
|
+
|
68
|
+
it "should be valid if it's a defined resource type in the environment's known resource types" do
|
69
|
+
collection = stub 'collection'
|
70
|
+
@api.stubs(:known_resource_types).returns collection
|
71
|
+
collection.expects(:definition).with(:mytype).returns "whatever"
|
72
|
+
@api.should be_valid_type(:mytype)
|
73
|
+
end
|
74
|
+
|
75
|
+
it "should not be valid unless it's a node, class, builtin type, or defined resource" do
|
76
|
+
collection = stub 'collection'
|
77
|
+
@api.stubs(:known_resource_types).returns collection
|
78
|
+
collection.expects(:definition).returns nil
|
79
|
+
Puppet::Type.expects(:type).returns nil
|
80
|
+
@api.should_not be_valid_type(:mytype)
|
81
|
+
end
|
82
|
+
end
|
83
|
+
|
84
|
+
describe "when creating a resource" do
|
85
|
+
before do
|
86
|
+
@api.scope.stubs(:source).returns stub("source")
|
87
|
+
@api.scope.compiler.stubs(:add_resource)
|
88
|
+
@created_resource = Puppet::Parser::Resource.new("yay", "eh", :scope => @api.scope)
|
89
|
+
end
|
90
|
+
|
91
|
+
it "should create and return a resource of the type specified" do
|
92
|
+
Puppet::Parser::Resource.expects(:new).with { |type, title, args| type == "mytype" }.returns @created_resource
|
93
|
+
@api.create_resource("mytype", "myname", {:foo => "bar"}).should == [@created_resource]
|
94
|
+
end
|
95
|
+
|
96
|
+
it "should use the name from the first element of the provided argument array" do
|
97
|
+
Puppet::Parser::Resource.expects(:new).with { |type, title, args| title == "myname" }.returns @created_resource
|
98
|
+
@api.create_resource("mytype", "myname", {:foo => "bar"})
|
99
|
+
end
|
100
|
+
|
101
|
+
it "should create multiple resources if the first element of the argument array is an array" do
|
102
|
+
second_resource = Puppet::Parser::Resource.new('yay', "eh", :scope => @api.scope)
|
103
|
+
Puppet::Parser::Resource.expects(:new).with { |type, title, args| title == "first" }.returns @created_resource
|
104
|
+
Puppet::Parser::Resource.expects(:new).with { |type, title, args| title == "second" }.returns @created_resource
|
105
|
+
@api.create_resource("mytype", ["first", "second"], {:foo => "bar"})
|
106
|
+
end
|
107
|
+
|
108
|
+
it "should provide its scope as the scope" do
|
109
|
+
Puppet::Parser::Resource.expects(:new).with { |type, title, args| args[:scope] == @api.scope }.returns @created_resource
|
110
|
+
@api.create_resource("mytype", "myname", {:foo => "bar"})
|
111
|
+
end
|
112
|
+
|
113
|
+
it "should set each provided argument as a parameter on the created resource" do
|
114
|
+
result = @api.create_resource("mytype", "myname", {"foo" => "bar", "biz" => "baz"}).shift
|
115
|
+
result["foo"].should == "bar"
|
116
|
+
result["biz"].should == "baz"
|
117
|
+
end
|
118
|
+
|
119
|
+
it "should add the resource to the scope's copmiler" do
|
120
|
+
Puppet::Parser::Resource.expects(:new).returns @created_resource
|
121
|
+
@api.scope.compiler.expects(:add_resource).with(@api.scope, @created_resource)
|
122
|
+
@api.create_resource("mytype", "myname", {:foo => "bar"})
|
123
|
+
end
|
124
|
+
|
125
|
+
it "should fail if the resource parameters are not a hash" do
|
126
|
+
lambda { @api.create_resource("mytype", "myname", %w{foo bar}) }.should raise_error(ArgumentError)
|
127
|
+
end
|
128
|
+
end
|
129
|
+
|
130
|
+
describe "when an unknown method is called" do
|
131
|
+
it "should create a resource if the method name is a valid type" do
|
132
|
+
@api.expects(:valid_type?).with(:mytype).returns true
|
133
|
+
@api.expects(:create_resource).with(:mytype, "myname", {:foo => "bar"}).returns true
|
134
|
+
|
135
|
+
@api.mytype("myname", :foo => "bar")
|
136
|
+
end
|
137
|
+
|
138
|
+
it "should call any function whose name matches the undefined method if the name is not a valid type" do
|
139
|
+
@api.expects(:valid_type?).with(:myfunc).returns false
|
140
|
+
@api.expects(:create_resource).never
|
141
|
+
|
142
|
+
Puppet::Parser::Functions.expects(:function).with(:myfunc).returns true
|
143
|
+
|
144
|
+
@api.expects(:call_function).with(:myfunc, %w{foo bar})
|
145
|
+
|
146
|
+
@api.myfunc("foo", "bar")
|
147
|
+
end
|
148
|
+
|
149
|
+
it "should raise a method missing error if the method is neither a type nor a function" do
|
150
|
+
@api.expects(:valid_type?).with(:myfunc).returns false
|
151
|
+
@api.expects(:create_resource).never
|
152
|
+
|
153
|
+
Puppet::Parser::Functions.expects(:function).with(:myfunc).returns false
|
154
|
+
|
155
|
+
@api.expects(:call_function).never
|
156
|
+
|
157
|
+
lambda { @api.myfunc("foo", "bar") }.should raise_error(NoMethodError)
|
158
|
+
end
|
159
|
+
end
|
160
|
+
|
161
|
+
it "should mark the specified resource as exported when creating a single exported resource" do
|
162
|
+
resources = @api.export @api.file("/my/file", :ensure => :present)
|
163
|
+
resources[0].should be_exported
|
164
|
+
end
|
165
|
+
|
166
|
+
it "should mark all created resources as exported when creating exported resources using a block" do
|
167
|
+
@compiler.expects(:add_resource).with { |s, res| res.exported == true }
|
168
|
+
@api.export { file "/my/file", :ensure => :present }
|
169
|
+
end
|
170
|
+
|
171
|
+
it "should mark the specified resource as virtual when creating a single virtual resource" do
|
172
|
+
resources = @api.virtual @api.file("/my/file", :ensure => :present)
|
173
|
+
resources[0].should be_virtual
|
174
|
+
end
|
175
|
+
|
176
|
+
it "should mark all created resources as virtual when creating virtual resources using a block" do
|
177
|
+
@compiler.expects(:add_resource).with { |s, res| res.virtual == true }
|
178
|
+
@api.virtual { file "/my/file", :ensure => :present }
|
179
|
+
end
|
180
|
+
end
|