puppet 6.0.4-universal-darwin → 6.0.5-universal-darwin

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.

Files changed (125) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile.lock +15 -15
  3. data/Rakefile +3 -1
  4. data/ext/solaris/smf/svc-puppetd +8 -1
  5. data/ext/solaris/smf/svc-puppetmasterd +8 -1
  6. data/lib/puppet/application/device.rb +48 -32
  7. data/lib/puppet/application/ssl.rb +31 -17
  8. data/lib/puppet/defaults.rb +2 -1
  9. data/lib/puppet/face/config.rb +1 -1
  10. data/lib/puppet/forge.rb +4 -1
  11. data/lib/puppet/pops/evaluator/collectors/abstract_collector.rb +3 -1
  12. data/lib/puppet/pops/model/pn_transformer.rb +5 -0
  13. data/lib/puppet/pops/types/p_timespan_type.rb +2 -2
  14. data/lib/puppet/pops/types/string_converter.rb +11 -2
  15. data/lib/puppet/provider/package/dnf.rb +2 -1
  16. data/lib/puppet/provider/package/windows/exe_package.rb +13 -0
  17. data/lib/puppet/provider/package/windows/msi_package.rb +8 -0
  18. data/lib/puppet/provider/package/windows/package.rb +9 -1
  19. data/lib/puppet/provider/package/yum.rb +1 -1
  20. data/lib/puppet/provider/parsedfile.rb +25 -4
  21. data/lib/puppet/provider/service/smf.rb +54 -0
  22. data/lib/puppet/provider/service/systemd.rb +2 -0
  23. data/lib/puppet/provider/service/upstart.rb +1 -0
  24. data/lib/puppet/rest/route.rb +1 -1
  25. data/lib/puppet/ssl/host.rb +23 -11
  26. data/lib/puppet/transaction.rb +4 -1
  27. data/lib/puppet/transaction/event_manager.rb +13 -1
  28. data/lib/puppet/transaction/resource_harness.rb +3 -1
  29. data/lib/puppet/util/command_line.rb +2 -3
  30. data/lib/puppet/util/filetype.rb +36 -4
  31. data/lib/puppet/util/selinux.rb +1 -1
  32. data/lib/puppet/util/windows/api_types.rb +1 -1
  33. data/lib/puppet/util/windows/registry.rb +29 -5
  34. data/lib/puppet/util/windows/service.rb +106 -99
  35. data/lib/puppet/version.rb +1 -1
  36. data/locales/ja/puppet.po +232 -183
  37. data/locales/puppet.pot +145 -117
  38. data/man/man5/puppet.conf.5 +3 -3
  39. data/man/man8/puppet-agent.8 +1 -1
  40. data/man/man8/puppet-apply.8 +1 -1
  41. data/man/man8/puppet-catalog.8 +1 -1
  42. data/man/man8/puppet-config.8 +2 -2
  43. data/man/man8/puppet-describe.8 +1 -1
  44. data/man/man8/puppet-device.8 +23 -19
  45. data/man/man8/puppet-doc.8 +1 -1
  46. data/man/man8/puppet-epp.8 +1 -1
  47. data/man/man8/puppet-facts.8 +1 -1
  48. data/man/man8/puppet-filebucket.8 +1 -1
  49. data/man/man8/puppet-generate.8 +1 -1
  50. data/man/man8/puppet-help.8 +1 -1
  51. data/man/man8/puppet-key.8 +1 -1
  52. data/man/man8/puppet-lookup.8 +1 -1
  53. data/man/man8/puppet-man.8 +1 -1
  54. data/man/man8/puppet-module.8 +1 -1
  55. data/man/man8/puppet-node.8 +1 -1
  56. data/man/man8/puppet-parser.8 +1 -1
  57. data/man/man8/puppet-plugin.8 +1 -1
  58. data/man/man8/puppet-report.8 +1 -1
  59. data/man/man8/puppet-resource.8 +1 -1
  60. data/man/man8/puppet-script.8 +1 -1
  61. data/man/man8/puppet-ssl.8 +6 -3
  62. data/man/man8/puppet-status.8 +1 -1
  63. data/man/man8/puppet.8 +2 -2
  64. data/spec/fixtures/unit/provider/service/smf/svcs_fmri.out +6 -0
  65. data/spec/fixtures/unit/provider/service/smf/svcs_multiple_fmris.out +13 -0
  66. data/spec/integration/ssl/key_spec.rb +0 -4
  67. data/spec/integration/transaction_spec.rb +559 -0
  68. data/spec/integration/util/windows/registry_spec.rb +39 -0
  69. data/spec/unit/application/device_spec.rb +10 -7
  70. data/spec/unit/application/lookup_spec.rb +2 -1
  71. data/spec/unit/application/ssl_spec.rb +21 -2
  72. data/spec/unit/forge/forge_spec.rb +4 -2
  73. data/spec/unit/functions/logging_spec.rb +10 -3
  74. data/spec/unit/indirector/yaml_spec.rb +1 -1
  75. data/spec/unit/pops/loaders/loader_spec.rb +6 -7
  76. data/spec/unit/pops/model/pn_transformer_spec.rb +4 -0
  77. data/spec/unit/pops/types/p_timespan_type_spec.rb +22 -0
  78. data/spec/unit/pops/types/p_timestamp_type_spec.rb +19 -0
  79. data/spec/unit/pops/types/string_converter_spec.rb +20 -0
  80. data/spec/unit/provider/group/ldap_spec.rb +22 -25
  81. data/spec/unit/provider/group/pw_spec.rb +7 -10
  82. data/spec/unit/provider/nameservice/directoryservice_spec.rb +97 -103
  83. data/spec/unit/provider/package/aix_spec.rb +5 -8
  84. data/spec/unit/provider/package/apt_spec.rb +3 -6
  85. data/spec/unit/provider/package/dnf_spec.rb +36 -37
  86. data/spec/unit/provider/package/dpkg_spec.rb +18 -21
  87. data/spec/unit/provider/package/freebsd_spec.rb +4 -7
  88. data/spec/unit/provider/package/gem_spec.rb +41 -41
  89. data/spec/unit/provider/package/hpux_spec.rb +7 -10
  90. data/spec/unit/provider/package/macports_spec.rb +13 -15
  91. data/spec/unit/provider/package/nim_spec.rb +3 -10
  92. data/spec/unit/provider/package/openbsd_spec.rb +14 -17
  93. data/spec/unit/provider/package/pip3_spec.rb +3 -6
  94. data/spec/unit/provider/package/pip_spec.rb +45 -49
  95. data/spec/unit/provider/package/pkgin_spec.rb +13 -18
  96. data/spec/unit/provider/package/pkgng_spec.rb +21 -24
  97. data/spec/unit/provider/package/puppet_gem_spec.rb +6 -9
  98. data/spec/unit/provider/package/tdnf_spec.rb +9 -12
  99. data/spec/unit/provider/package/yum_spec.rb +30 -16
  100. data/spec/unit/provider/package/zypper_spec.rb +17 -19
  101. data/spec/unit/provider/service/bsd_spec.rb +7 -9
  102. data/spec/unit/provider/service/daemontools_spec.rb +12 -16
  103. data/spec/unit/provider/service/debian_spec.rb +6 -10
  104. data/spec/unit/provider/service/freebsd_spec.rb +2 -2
  105. data/spec/unit/provider/service/openbsd_spec.rb +13 -17
  106. data/spec/unit/provider/service/rcng_spec.rb +2 -4
  107. data/spec/unit/provider/service/redhat_spec.rb +12 -11
  108. data/spec/unit/provider/service/runit_spec.rb +7 -14
  109. data/spec/unit/provider/service/smf_spec.rb +77 -13
  110. data/spec/unit/provider/service/src_spec.rb +11 -16
  111. data/spec/unit/provider/service/systemd_spec.rb +18 -0
  112. data/spec/unit/provider/user/hpux_spec.rb +3 -5
  113. data/spec/unit/provider/user/ldap_spec.rb +29 -32
  114. data/spec/unit/provider/user/pw_spec.rb +10 -13
  115. data/spec/unit/rest/route_spec.rb +1 -1
  116. data/spec/unit/ssl/host_spec.rb +21 -0
  117. data/spec/unit/ssl/key_spec.rb +2 -4
  118. data/spec/unit/transaction/event_manager_spec.rb +12 -1
  119. data/spec/unit/transaction/resource_harness_spec.rb +18 -0
  120. data/spec/unit/transaction_spec.rb +25 -0
  121. data/spec/unit/util/filetype_spec.rb +13 -5
  122. data/spec/unit/util/logging_spec.rb +0 -41
  123. data/spec/unit/util/monkey_patches_spec.rb +18 -5
  124. data/spec/unit/util/selinux_spec.rb +4 -0
  125. metadata +8 -2
@@ -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 "PUPPETCONF" "5" "October 2018" "Puppet, Inc." "Puppet manual"
4
+ .TH "PUPPETCONF" "5" "January 2019" "Puppet, Inc." "Puppet manual"
5
5
  \fBThis page is autogenerated; any changes will get overwritten\fR
6
6
  .
7
7
  .SH "Configuration settings"
@@ -774,7 +774,7 @@ Where the host\'s certificate revocation list can be found\. This is distinct fr
774
774
  .IP "" 0
775
775
  .
776
776
  .SS "hostcsr"
777
- Where individual hosts store and look for their certificate requests\.
777
+ This setting is deprecated\.
778
778
  .
779
779
  .IP "\(bu" 4
780
780
  \fIDefault\fR: $ssldir/csr_$certname\.pem
@@ -868,7 +868,7 @@ The time to wait for data to be read from an HTTP connection\. If nothing is rea
868
868
  The HTTP User\-Agent string to send when making network requests\.
869
869
  .
870
870
  .IP "\(bu" 4
871
- \fIDefault\fR: Puppet/6\.0\.4 Ruby/2\.4\.1\-p111 (x86_64\-linux)
871
+ \fIDefault\fR: Puppet/6\.0\.5 Ruby/2\.4\.1\-p111 (x86_64\-linux)
872
872
  .
873
873
  .IP "" 0
874
874
  .
@@ -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\-AGENT" "8" "October 2018" "Puppet, Inc." "Puppet manual"
4
+ .TH "PUPPET\-AGENT" "8" "January 2019" "Puppet, Inc." "Puppet manual"
5
5
  .
6
6
  .SH "NAME"
7
7
  \fBpuppet\-agent\fR \- The puppet agent daemon
@@ -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\-APPLY" "8" "October 2018" "Puppet, Inc." "Puppet manual"
4
+ .TH "PUPPET\-APPLY" "8" "January 2019" "Puppet, Inc." "Puppet manual"
5
5
  .
6
6
  .SH "NAME"
7
7
  \fBpuppet\-apply\fR \- Apply Puppet manifests locally
@@ -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\-CATALOG" "8" "October 2018" "Puppet, Inc." "Puppet manual"
4
+ .TH "PUPPET\-CATALOG" "8" "January 2019" "Puppet, Inc." "Puppet manual"
5
5
  .
6
6
  .SH "NAME"
7
7
  \fBpuppet\-catalog\fR \- Compile, save, view, and convert catalogs\.
@@ -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\-CONFIG" "8" "October 2018" "Puppet, Inc." "Puppet manual"
4
+ .TH "PUPPET\-CONFIG" "8" "January 2019" "Puppet, Inc." "Puppet manual"
5
5
  .
6
6
  .SH "NAME"
7
7
  \fBpuppet\-config\fR \- Interact with Puppet\'s settings\.
@@ -66,7 +66,7 @@ By default, this action deletes the configuration setting from the \'main\' conf
66
66
  \fBSYNOPSIS\fR
67
67
  .
68
68
  .IP
69
- puppet config print [\-\-section SECTION_NAME] (all | \fIsetting\fR [\fIsetting\fR \.\.\.]
69
+ puppet config print [\-\-section SECTION_NAME] all | \fIsetting\fR [\fIsetting\fR \.\.\.]
70
70
  .
71
71
  .IP
72
72
  \fBDESCRIPTION\fR
@@ -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\-DESCRIBE" "8" "October 2018" "Puppet, Inc." "Puppet manual"
4
+ .TH "PUPPET\-DESCRIBE" "8" "January 2019" "Puppet, Inc." "Puppet manual"
5
5
  .
6
6
  .SH "NAME"
7
7
  \fBpuppet\-describe\fR \- Display help about resource types
@@ -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\-DEVICE" "8" "October 2018" "Puppet, Inc." "Puppet manual"
4
+ .TH "PUPPET\-DEVICE" "8" "January 2019" "Puppet, Inc." "Puppet manual"
5
5
  .
6
6
  .SH "NAME"
7
7
  \fBpuppet\-device\fR \- Manage remote network devices
@@ -13,7 +13,7 @@ Retrieves catalogs from the Puppet master and applies them to remote devices\.
13
13
  This subcommand can be run manually; or periodically using cron, a scheduled task, or a similar tool\.
14
14
  .
15
15
  .SH "USAGE"
16
- puppet device [\-d|\-\-debug] [\-\-detailed\-exitcodes] [\-\-deviceconfig \fIfile\fR] [\-h|\-\-help] [\-l|\-\-logdest syslog|\fIfile\fR|console] [\-v|\-\-verbose] [\-w|\-\-waitforcert \fIseconds\fR] [\-f|\-\-facts] [\-a|\-\-apply \fIfile\fR] [\-r|\-\-resource \fItype\fR [name]] [\-t|\-\-target \fIdevice\fR] [\-\-user=\fIuser\fR] [\-V|\-\-version]
16
+ puppet device [\-h|\-\-help] [\-v|\-\-verbose] [\-d|\-\-debug] [\-l|\-\-logdest syslog|\fIfile\fR|console] [\-\-detailed\-exitcodes] [\-\-deviceconfig \fIfile\fR] [\-w|\-\-waitforcert \fIseconds\fR] [\-\-libdir \fIdirectory\fR] [\-a|\-\-apply \fIfile\fR] [\-f|\-\-facts] [\-r|\-\-resource \fItype\fR [name]] [\-t|\-\-target \fIdevice\fR] [\-\-user=\fIuser\fR] [\-V|\-\-version]
17
17
  .
18
18
  .SH "DESCRIPTION"
19
19
  Devices require a proxy Puppet agent to request certificates, collect facts, retrieve and apply catalogs, and store reports\.
@@ -43,10 +43,25 @@ See https://puppet\.com/docs/puppet/latest/config_file_device\.html for details\
43
43
  Note that any setting that\'s valid in the configuration file is also a valid long argument\. For example, \'server\' is a valid configuration parameter, so you can specify \'\-\-server \fIservername\fR\' as an argument\.
44
44
  .
45
45
  .TP
46
- \-\-debug
46
+ \-\-help, \-h
47
+ Print this help message
48
+ .
49
+ .TP
50
+ \-\-verbose, \-v
51
+ Turn on verbose reporting\.
52
+ .
53
+ .TP
54
+ \-\-debug, \-d
47
55
  Enable full debugging\.
48
56
  .
49
57
  .TP
58
+ \-\-logdest, \-l
59
+ Where to send log messages\. Choose between \'syslog\' (the POSIX syslog service), \'console\', or the path to a log file\. If debugging or verbosity is enabled, this defaults to \'console\'\. Otherwise, it defaults to \'syslog\'\.
60
+ .
61
+ .IP
62
+ A path ending with \'\.json\' will receive structured output in JSON format\. The log file will not have an ending \']\' automatically written to it due to the appending nature of logging\. It must be appended manually to make the content valid JSON\.
63
+ .
64
+ .TP
50
65
  \-\-detailed\-exitcodes
51
66
  Provide transaction information via exit codes\. If this is enabled, an exit code of \'1\' means at least one device had a compile failure, an exit code of \'2\' means at least one device had resource changes, and an exit code of \'4\' means at least one device had resource failures\. Exit codes of \'3\', \'5\', \'6\', or \'7\' means that a bitwise combination of the preceding exit codes happened\.
52
67
  .
@@ -55,15 +70,12 @@ Provide transaction information via exit codes\. If this is enabled, an exit cod
55
70
  Path to the device config file for puppet device\. Default: $confdir/device\.conf
56
71
  .
57
72
  .TP
58
- \-\-help
59
- Print this help message
73
+ \-\-waitforcert, \-w
74
+ This option only matters for targets that do not yet have certificates and it is enabled by default, with a value of 120 (seconds)\. This causes +puppet device+ to poll the server every 2 minutes and ask it to sign a certificate request\. This is useful for the initial setup of a target\. You can turn off waiting for certificates by specifying a time of 0\.
60
75
  .
61
76
  .TP
62
- \-\-logdest
63
- Where to send log messages\. Choose between \'syslog\' (the POSIX syslog service), \'console\', or the path to a log file\. If debugging or verbosity is enabled, this defaults to \'console\'\. Otherwise, it defaults to \'syslog\'\.
64
- .
65
- .IP
66
- A path ending with \'\.json\' will receive structured output in JSON format\. The log file will not have an ending \']\' automatically written to it due to the appending nature of logging\. It must be appended manually to make the content valid JSON\.
77
+ \-\-libdir
78
+ Override the per\-device libdir with a local directory\. Specifying a libdir also disables pluginsync\. This is useful for testing\.
67
79
  .
68
80
  .TP
69
81
  \-\-apply
@@ -89,14 +101,6 @@ Output found resources in yaml format, suitable to use with Hiera and create_res
89
101
  \-\-user
90
102
  The user to run as\.
91
103
  .
92
- .TP
93
- \-\-verbose
94
- Turn on verbose reporting\.
95
- .
96
- .TP
97
- \-\-waitforcert
98
- This option only matters for daemons that do not yet have certificates and it is enabled by default, with a value of 120 (seconds)\. This causes +puppet agent+ to connect to the server every 2 minutes and ask it to sign a certificate request\. This is useful for the initial setup of a puppet client\. You can turn off waiting for certificates by specifying a time of 0\.
99
- .
100
104
  .SH "EXAMPLE"
101
105
  .
102
106
  .nf
@@ -109,4 +113,4 @@ This option only matters for daemons that do not yet have certificates and it is
109
113
  Brice Figureau
110
114
  .
111
115
  .SH "COPYRIGHT"
112
- Copyright (c) 2011 Puppet Inc\., LLC Licensed under the Apache 2\.0 License
116
+ Copyright (c) 2011\-2018 Puppet Inc\., LLC Licensed under the Apache 2\.0 License
@@ -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\-DOC" "8" "October 2018" "Puppet, Inc." "Puppet manual"
4
+ .TH "PUPPET\-DOC" "8" "January 2019" "Puppet, Inc." "Puppet manual"
5
5
  .
6
6
  .SH "NAME"
7
7
  \fBpuppet\-doc\fR \- Generate Puppet references
@@ -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\-EPP" "8" "October 2018" "Puppet, Inc." "Puppet manual"
4
+ .TH "PUPPET\-EPP" "8" "January 2019" "Puppet, Inc." "Puppet manual"
5
5
  .
6
6
  .SH "NAME"
7
7
  \fBpuppet\-epp\fR \- Interact directly with the EPP template parser/renderer\.
@@ -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\-FACTS" "8" "October 2018" "Puppet, Inc." "Puppet manual"
4
+ .TH "PUPPET\-FACTS" "8" "January 2019" "Puppet, Inc." "Puppet manual"
5
5
  .
6
6
  .SH "NAME"
7
7
  \fBpuppet\-facts\fR \- Retrieve and store facts\.
@@ -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\-FILEBUCKET" "8" "October 2018" "Puppet, Inc." "Puppet manual"
4
+ .TH "PUPPET\-FILEBUCKET" "8" "January 2019" "Puppet, Inc." "Puppet manual"
5
5
  .
6
6
  .SH "NAME"
7
7
  \fBpuppet\-filebucket\fR \- Store and retrieve files in a filebucket
@@ -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\-GENERATE" "8" "October 2018" "Puppet, Inc." "Puppet manual"
4
+ .TH "PUPPET\-GENERATE" "8" "January 2019" "Puppet, Inc." "Puppet manual"
5
5
  .
6
6
  .SH "NAME"
7
7
  \fBpuppet\-generate\fR \- Generates Puppet code from Ruby definitions\.
@@ -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\-HELP" "8" "October 2018" "Puppet, Inc." "Puppet manual"
4
+ .TH "PUPPET\-HELP" "8" "January 2019" "Puppet, Inc." "Puppet manual"
5
5
  .
6
6
  .SH "NAME"
7
7
  \fBpuppet\-help\fR \- Display Puppet help\.
@@ -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\-KEY" "8" "October 2018" "Puppet, Inc." "Puppet manual"
4
+ .TH "PUPPET\-KEY" "8" "January 2019" "Puppet, Inc." "Puppet manual"
5
5
  .
6
6
  .SH "NAME"
7
7
  \fBpuppet\-key\fR \- Create, save, and remove certificate keys\.
@@ -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\-LOOKUP" "8" "October 2018" "Puppet, Inc." "Puppet manual"
4
+ .TH "PUPPET\-LOOKUP" "8" "January 2019" "Puppet, Inc." "Puppet manual"
5
5
  .
6
6
  .SH "NAME"
7
7
  \fBpuppet\-lookup\fR \- Interactive Hiera lookup
@@ -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\-MAN" "8" "October 2018" "Puppet, Inc." "Puppet manual"
4
+ .TH "PUPPET\-MAN" "8" "January 2019" "Puppet, Inc." "Puppet manual"
5
5
  .
6
6
  .SH "NAME"
7
7
  \fBpuppet\-man\fR \- Display Puppet manual pages\.
@@ -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\-MODULE" "8" "October 2018" "Puppet, Inc." "Puppet manual"
4
+ .TH "PUPPET\-MODULE" "8" "January 2019" "Puppet, Inc." "Puppet manual"
5
5
  .
6
6
  .SH "NAME"
7
7
  \fBpuppet\-module\fR \- Creates, installs and searches for modules on the Puppet Forge\.
@@ -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\-NODE" "8" "October 2018" "Puppet, Inc." "Puppet manual"
4
+ .TH "PUPPET\-NODE" "8" "January 2019" "Puppet, Inc." "Puppet manual"
5
5
  .
6
6
  .SH "NAME"
7
7
  \fBpuppet\-node\fR \- View and manage node definitions\.
@@ -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" "October 2018" "Puppet, Inc." "Puppet manual"
4
+ .TH "PUPPET\-PARSER" "8" "January 2019" "Puppet, Inc." "Puppet manual"
5
5
  .
6
6
  .SH "NAME"
7
7
  \fBpuppet\-parser\fR \- Interact directly with the parser\.
@@ -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" "October 2018" "Puppet, Inc." "Puppet manual"
4
+ .TH "PUPPET\-PLUGIN" "8" "January 2019" "Puppet, Inc." "Puppet manual"
5
5
  .
6
6
  .SH "NAME"
7
7
  \fBpuppet\-plugin\fR \- Interact with the Puppet plugin system\.
@@ -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" "October 2018" "Puppet, Inc." "Puppet manual"
4
+ .TH "PUPPET\-REPORT" "8" "January 2019" "Puppet, Inc." "Puppet manual"
5
5
  .
6
6
  .SH "NAME"
7
7
  \fBpuppet\-report\fR \- Create, display, and submit reports\.
@@ -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" "October 2018" "Puppet, Inc." "Puppet manual"
4
+ .TH "PUPPET\-RESOURCE" "8" "January 2019" "Puppet, Inc." "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\-SCRIPT" "8" "October 2018" "Puppet, Inc." "Puppet manual"
4
+ .TH "PUPPET\-SCRIPT" "8" "January 2019" "Puppet, Inc." "Puppet manual"
5
5
  .
6
6
  .SH "NAME"
7
7
  \fBpuppet\-script\fR \- Run a puppet manifests as a script without compiling a catalog
@@ -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\-SSL" "8" "October 2018" "Puppet, Inc." "Puppet manual"
4
+ .TH "PUPPET\-SSL" "8" "January 2019" "Puppet, Inc." "Puppet manual"
5
5
  .
6
6
  .SH "NAME"
7
7
  \fBpuppet\-ssl\fR \- Manage SSL keys and certificates for puppet SSL clients
@@ -10,7 +10,7 @@
10
10
  Manage SSL keys and certificates for SSL clients needing to communicate with a puppet infrastructure\.
11
11
  .
12
12
  .SH "USAGE"
13
- puppet ssl \fIaction\fR [\-h|\-\-help] [\-v|\-\-verbose] [\-d|\-\-debug] [\-\-localca]
13
+ puppet ssl \fIaction\fR [\-h|\-\-help] [\-v|\-\-verbose] [\-d|\-\-debug] [\-\-localca] [\-\-target CERTNAME]
14
14
  .
15
15
  .SH "OPTIONS"
16
16
  .
@@ -26,6 +26,9 @@ puppet ssl \fIaction\fR [\-h|\-\-help] [\-v|\-\-verbose] [\-d|\-\-debug] [\-\-lo
26
26
  .IP "\(bu" 4
27
27
  \-\-localca Also clean the local CA certificate and CRL\.
28
28
  .
29
+ .IP "\(bu" 4
30
+ \-\-target CERTNAME Clean the specified device certificate instead of this host\'s certificate\.
31
+ .
29
32
  .IP "" 0
30
33
  .
31
34
  .SH "ACTIONS"
@@ -44,5 +47,5 @@ Verify the private key and certificate are present and match, verify the certifi
44
47
  .
45
48
  .TP
46
49
  clean
47
- Remove the private key and certificate related files for this host\. If \fB\-\-localca\fR is specified, then also remove this host\'s local copy of the CA certificate(s) and CRL bundle\.
50
+ Remove the private key and certificate related files for this host\. If \fB\-\-localca\fR is specified, then also remove this host\'s local copy of the CA certificate(s) and CRL bundle\. if \fB\-\-target CERTNAME\fR is specified, then remove the files for the specified device on this host instead of this host\.
48
51
 
@@ -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" "October 2018" "Puppet, Inc." "Puppet manual"
4
+ .TH "PUPPET\-STATUS" "8" "January 2019" "Puppet, Inc." "Puppet manual"
5
5
  .
6
6
  .SH "NAME"
7
7
  \fBpuppet\-status\fR \- View puppet server status\.
@@ -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" "8" "October 2018" "Puppet, Inc." "Puppet manual"
4
+ .TH "PUPPET" "8" "January 2019" "Puppet, Inc." "Puppet manual"
5
5
  .
6
6
  .SH "NAME"
7
7
  \fBpuppet\fR
@@ -25,4 +25,4 @@ Specialized:
25
25
  catalog Compile, save, view, and convert catalogs\. describe Display help about resource types device Manage remote network devices doc Generate Puppet references epp Interact directly with the EPP template parser/renderer\. facts Retrieve and store facts\. filebucket Store and retrieve files in a filebucket generate Generates Puppet code from Ruby definitions\. node View and manage node definitions\. parser Interact directly with the parser\. script Run a puppet manifests as a script without compiling a catalog ssl Manage SSL keys and certificates for puppet SSL clients
26
26
  .
27
27
  .P
28
- See \'puppet help \fIsubcommand\fR \fIaction\fR\' for help on a specific subcommand action\. See \'puppet help \fIsubcommand\fR\' for help on a specific subcommand\. Puppet v6\.0\.4
28
+ See \'puppet help \fIsubcommand\fR \fIaction\fR\' for help on a specific subcommand action\. See \'puppet help \fIsubcommand\fR\' for help on a specific subcommand\. Puppet v6\.0\.5
@@ -0,0 +1,6 @@
1
+ fmri svc:/application/tstapp:default
2
+ name Dummy
3
+ enabled false
4
+ state disabled
5
+ next_state none
6
+ state_time July 26, 2018 11:57:49 AM PDT
@@ -0,0 +1,13 @@
1
+ fmri svc:/application/tstapp:one
2
+ name Dummy
3
+ enabled false
4
+ state disabled
5
+ next_state none
6
+ state_time July 26, 2018 11:57:49 AM PDT
7
+
8
+ fmri svc:/application/tstapp:two
9
+ name Dummy
10
+ enabled false
11
+ state disabled
12
+ next_state none
13
+ state_time July 26, 2018 11:57:49 AM PDT
@@ -41,8 +41,6 @@ describe Puppet::SSL::Key, unless: Puppet::Util::Platform.jruby? do
41
41
  end
42
42
 
43
43
  it "should be able to read an existing private key given the correct password" do
44
- Puppet[:keylength] = '50'
45
-
46
44
  key_name = 'test'
47
45
  # use OpenSSL APIs to generate a private key
48
46
  private_key = OpenSSL::PKey::RSA.generate(512)
@@ -69,8 +67,6 @@ describe Puppet::SSL::Key, unless: Puppet::Util::Platform.jruby? do
69
67
  end
70
68
 
71
69
  it 'should export the private key to PEM using the password' do
72
- Puppet[:keylength] = '50'
73
-
74
70
  key_name = 'test'
75
71
 
76
72
  # uses specified :passfile when writing the private key
@@ -0,0 +1,559 @@
1
+ #! /usr/bin/env ruby
2
+ require 'spec_helper'
3
+ require 'puppet_spec/compiler'
4
+
5
+ require 'puppet/transaction'
6
+
7
+ Puppet::Type.newtype(:devicetype) do
8
+ apply_to_device
9
+ newparam(:name)
10
+ end
11
+
12
+ describe Puppet::Transaction do
13
+ include PuppetSpec::Files
14
+ include PuppetSpec::Compiler
15
+
16
+ before do
17
+ Puppet::Util::Storage.stubs(:store)
18
+ end
19
+
20
+ def mk_catalog(*resources)
21
+ catalog = Puppet::Resource::Catalog.new(Puppet::Node.new("mynode"))
22
+ resources.each { |res| catalog.add_resource res }
23
+ catalog
24
+ end
25
+
26
+ def touch_path
27
+ Puppet.features.microsoft_windows? ? "#{ENV['windir']}\\system32" : "/usr/bin:/bin"
28
+ end
29
+
30
+ def usr_bin_touch(path)
31
+ Puppet.features.microsoft_windows? ? "#{ENV['windir']}\\system32\\cmd.exe /c \"type NUL >> \"#{path}\"\"" : "/usr/bin/touch #{path}"
32
+ end
33
+
34
+ def touch(path)
35
+ Puppet.features.microsoft_windows? ? "cmd.exe /c \"type NUL >> \"#{path}\"\"" : "touch #{path}"
36
+ end
37
+
38
+ it "should not apply generated resources if the parent resource fails" do
39
+ catalog = Puppet::Resource::Catalog.new
40
+ resource = Puppet::Type.type(:file).new :path => make_absolute("/foo/bar"), :backup => false
41
+ catalog.add_resource resource
42
+
43
+ child_resource = Puppet::Type.type(:file).new :path => make_absolute("/foo/bar/baz"), :backup => false
44
+
45
+ resource.expects(:eval_generate).returns([child_resource])
46
+
47
+ transaction = Puppet::Transaction.new(catalog, nil, Puppet::Graph::SequentialPrioritizer.new)
48
+
49
+ resource.expects(:retrieve).raises "this is a failure"
50
+ resource.stubs(:err)
51
+
52
+ child_resource.expects(:retrieve).never
53
+
54
+ transaction.evaluate
55
+ end
56
+
57
+ it "should not apply virtual resources" do
58
+ catalog = Puppet::Resource::Catalog.new
59
+ resource = Puppet::Type.type(:file).new :path => make_absolute("/foo/bar"), :backup => false
60
+ resource.virtual = true
61
+ catalog.add_resource resource
62
+
63
+ transaction = Puppet::Transaction.new(catalog, nil, Puppet::Graph::SequentialPrioritizer.new)
64
+
65
+ resource.expects(:evaluate).never
66
+
67
+ transaction.evaluate
68
+ end
69
+
70
+ it "should apply exported resources" do
71
+ catalog = Puppet::Resource::Catalog.new
72
+ path = tmpfile("exported_files")
73
+ resource = Puppet::Type.type(:file).new :path => path, :backup => false, :ensure => :file
74
+ resource.exported = true
75
+ catalog.add_resource resource
76
+
77
+ catalog.apply
78
+ expect(Puppet::FileSystem.exist?(path)).to be_truthy
79
+ end
80
+
81
+ it "should not apply virtual exported resources" do
82
+ catalog = Puppet::Resource::Catalog.new
83
+ resource = Puppet::Type.type(:file).new :path => make_absolute("/foo/bar"), :backup => false
84
+ resource.exported = true
85
+ resource.virtual = true
86
+ catalog.add_resource resource
87
+
88
+ transaction = Puppet::Transaction.new(catalog, nil, Puppet::Graph::SequentialPrioritizer.new)
89
+
90
+ resource.expects(:evaluate).never
91
+
92
+ transaction.evaluate
93
+ end
94
+
95
+ it "should not apply device resources on normal host" do
96
+ catalog = Puppet::Resource::Catalog.new
97
+ resource = Puppet::Type.type(:devicetype).new :name => "FastEthernet 0/1"
98
+ catalog.add_resource resource
99
+
100
+ transaction = Puppet::Transaction.new(catalog, nil, Puppet::Graph::SequentialPrioritizer.new)
101
+ transaction.for_network_device = false
102
+
103
+ transaction.expects(:apply).never.with(resource, nil)
104
+
105
+ transaction.evaluate
106
+ expect(transaction.resource_status(resource)).to be_skipped
107
+ end
108
+
109
+ it "should not apply host resources on device" do
110
+ catalog = Puppet::Resource::Catalog.new
111
+ resource = Puppet::Type.type(:file).new :path => make_absolute("/foo/bar"), :backup => false
112
+ catalog.add_resource resource
113
+
114
+ transaction = Puppet::Transaction.new(catalog, nil, Puppet::Graph::SequentialPrioritizer.new)
115
+ transaction.for_network_device = true
116
+
117
+ transaction.expects(:apply).never.with(resource, nil)
118
+
119
+ transaction.evaluate
120
+ expect(transaction.resource_status(resource)).to be_skipped
121
+ end
122
+
123
+ it "should apply device resources on device" do
124
+ catalog = Puppet::Resource::Catalog.new
125
+ resource = Puppet::Type.type(:devicetype).new :name => "FastEthernet 0/1"
126
+ catalog.add_resource resource
127
+
128
+ transaction = Puppet::Transaction.new(catalog, nil, Puppet::Graph::SequentialPrioritizer.new)
129
+ transaction.for_network_device = true
130
+
131
+ transaction.expects(:apply).with(resource, nil)
132
+
133
+ transaction.evaluate
134
+ expect(transaction.resource_status(resource)).not_to be_skipped
135
+ end
136
+
137
+ it "should apply resources appliable on host and device on a device" do
138
+ catalog = Puppet::Resource::Catalog.new
139
+ resource = Puppet::Type.type(:schedule).new :name => "test"
140
+ catalog.add_resource resource
141
+
142
+ transaction = Puppet::Transaction.new(catalog, nil, Puppet::Graph::SequentialPrioritizer.new)
143
+ transaction.for_network_device = true
144
+
145
+ transaction.expects(:apply).with(resource, nil)
146
+
147
+ transaction.evaluate
148
+ expect(transaction.resource_status(resource)).not_to be_skipped
149
+ end
150
+
151
+ # Verify that one component requiring another causes the contained
152
+ # resources in the requiring component to get refreshed.
153
+ it "should propagate events from a contained resource through its container to its dependent container's contained resources" do
154
+ file = Puppet::Type.type(:file).new :path => tmpfile("event_propagation"), :ensure => :present
155
+ execfile = File.join(tmpdir("exec_event"), "exectestingness2")
156
+ exec = Puppet::Type.type(:exec).new :command => touch(execfile), :path => ENV['PATH']
157
+ catalog = mk_catalog(file)
158
+
159
+ fcomp = Puppet::Type.type(:component).new(:name => "Foo[file]")
160
+ catalog.add_resource fcomp
161
+ catalog.add_edge(fcomp, file)
162
+
163
+ ecomp = Puppet::Type.type(:component).new(:name => "Foo[exec]")
164
+ catalog.add_resource ecomp
165
+ catalog.add_resource exec
166
+ catalog.add_edge(ecomp, exec)
167
+
168
+ ecomp[:subscribe] = Puppet::Resource.new(:foo, "file")
169
+ exec[:refreshonly] = true
170
+
171
+ exec.expects(:refresh)
172
+ catalog.apply
173
+ end
174
+
175
+ # Make sure that multiple subscriptions get triggered.
176
+ it "should propagate events to all dependent resources", :unless => RUBY_PLATFORM == 'java' do
177
+ path = tmpfile("path")
178
+ file1 = tmpfile("file1")
179
+ file2 = tmpfile("file2")
180
+
181
+ file = Puppet::Type.type(:file).new(
182
+ :path => path,
183
+ :ensure => "file"
184
+ )
185
+
186
+ exec1 = Puppet::Type.type(:exec).new(
187
+ :path => ENV["PATH"],
188
+ :command => touch(file1),
189
+ :refreshonly => true,
190
+ :subscribe => Puppet::Resource.new(:file, path)
191
+ )
192
+
193
+ exec2 = Puppet::Type.type(:exec).new(
194
+ :path => ENV["PATH"],
195
+ :command => touch(file2),
196
+ :refreshonly => true,
197
+ :subscribe => Puppet::Resource.new(:file, path)
198
+ )
199
+
200
+ catalog = mk_catalog(file, exec1, exec2)
201
+ catalog.apply
202
+ expect(Puppet::FileSystem.exist?(file1)).to be_truthy
203
+ expect(Puppet::FileSystem.exist?(file2)).to be_truthy
204
+ end
205
+
206
+ it "does not refresh resources that have 'noop => true'" do
207
+ path = tmpfile("path")
208
+
209
+ notify = Puppet::Type.type(:notify).new(
210
+ :name => "trigger",
211
+ :notify => Puppet::Resource.new(:exec, "noop exec")
212
+ )
213
+
214
+ noop_exec = Puppet::Type.type(:exec).new(
215
+ :name => "noop exec",
216
+ :path => ENV["PATH"],
217
+ :command => touch(path),
218
+ :noop => true
219
+ )
220
+
221
+ catalog = mk_catalog(notify, noop_exec)
222
+ catalog.apply
223
+ expect(Puppet::FileSystem.exist?(path)).to be_falsey
224
+ end
225
+
226
+ it "should apply no resources whatsoever if a pre_run_check fails" do
227
+ path = tmpfile("path")
228
+ file = Puppet::Type.type(:file).new(
229
+ :path => path,
230
+ :ensure => "file"
231
+ )
232
+ notify = Puppet::Type.type(:notify).new(
233
+ :title => "foo"
234
+ )
235
+ notify.expects(:pre_run_check).raises(Puppet::Error, "fail for testing")
236
+
237
+ catalog = mk_catalog(file, notify)
238
+ expect { catalog.apply }.to raise_error(Puppet::Error, /Some pre-run checks failed/)
239
+ expect(Puppet::FileSystem.exist?(path)).not_to be_truthy
240
+ end
241
+
242
+ it "one failed refresh should propagate its failure to dependent refreshes", :unless => RUBY_PLATFORM == 'java' do
243
+ path = tmpfile("path")
244
+ newfile = tmpfile("file")
245
+ file = Puppet::Type.type(:file).new(
246
+ :path => path,
247
+ :ensure => "file"
248
+ )
249
+
250
+ exec1 = Puppet::Type.type(:exec).new(
251
+ :path => ENV["PATH"],
252
+ :command => touch(File.expand_path("/this/cannot/possibly/exist")),
253
+ :logoutput => true,
254
+ :refreshonly => true,
255
+ :subscribe => file,
256
+ :title => "one"
257
+ )
258
+
259
+ exec2 = Puppet::Type.type(:exec).new(
260
+ :path => ENV["PATH"],
261
+ :command => touch(newfile),
262
+ :logoutput => true,
263
+ :refreshonly => true,
264
+ :subscribe => [file, exec1],
265
+ :title => "two"
266
+ )
267
+
268
+ exec1.stubs(:err)
269
+
270
+ catalog = mk_catalog(file, exec1, exec2)
271
+ catalog.apply
272
+ expect(Puppet::FileSystem.exist?(newfile)).to be_falsey
273
+ end
274
+
275
+ # Ensure when resources have been generated with eval_generate that event
276
+ # propagation still works when filtering with tags
277
+ context "when filtering with tags", :unless => RUBY_PLATFORM == 'java' do
278
+ context "when resources are dependent on dynamically generated resources" do
279
+ it "should trigger (only) appropriately tagged dependent resources" do
280
+ source = dir_containing('sourcedir', {'foo' => 'bar'})
281
+ target = tmpdir('targetdir')
282
+ file1 = tmpfile("file1")
283
+ file2 = tmpfile("file2")
284
+
285
+ file = Puppet::Type.type(:file).new(
286
+ :path => target,
287
+ :source => source,
288
+ :ensure => :present,
289
+ :recurse => true,
290
+ :tag => "foo_tag",
291
+ )
292
+
293
+ exec1 = Puppet::Type.type(:exec).new(
294
+ :path => ENV["PATH"],
295
+ :command => touch(file1),
296
+ :refreshonly => true,
297
+ :subscribe => file,
298
+ :tag => "foo_tag",
299
+ )
300
+
301
+ exec2 = Puppet::Type.type(:exec).new(
302
+ :path => ENV["PATH"],
303
+ :command => touch(file2),
304
+ :refreshonly => true,
305
+ :subscribe => file,
306
+ )
307
+
308
+ Puppet[:tags] = "foo_tag"
309
+ catalog = mk_catalog(file, exec1, exec2)
310
+ catalog.apply
311
+ expect(Puppet::FileSystem.exist?(file1)).to be_truthy
312
+ expect(Puppet::FileSystem.exist?(file2)).to be_falsey
313
+ end
314
+
315
+ it "should trigger implicitly tagged dependent resources, ie via type name" do
316
+ file1 = tmpfile("file1")
317
+ file2 = tmpfile("file2")
318
+
319
+ exec1 = Puppet::Type.type(:exec).new(
320
+ :name => "exec1",
321
+ :path => ENV["PATH"],
322
+ :command => touch(file1),
323
+ )
324
+
325
+ exec1.stubs(:eval_generate).returns(
326
+ [ (Puppet::Type.type(:notify).new :name => "eval1_notify")]
327
+ )
328
+
329
+ exec2 = Puppet::Type.type(:exec).new(
330
+ :name => "exec2",
331
+ :path => ENV["PATH"],
332
+ :command => touch(file2),
333
+ :refreshonly => true,
334
+ :subscribe => exec1,
335
+ )
336
+ exec2.stubs(:eval_generate).returns(
337
+ [ (Puppet::Type.type(:notify).new :name => "eval2_notify")]
338
+ )
339
+
340
+ Puppet[:tags] = "exec"
341
+ catalog = mk_catalog(exec1, exec2)
342
+ catalog.apply
343
+ expect(Puppet::FileSystem.exist?(file1)).to be_truthy
344
+ expect(Puppet::FileSystem.exist?(file2)).to be_truthy
345
+ end
346
+ end
347
+
348
+ it "should propagate events correctly from a tagged container when running with tags" do
349
+ file1 = tmpfile("original_tag")
350
+ file2 = tmpfile("tag_propagation")
351
+ command1 = usr_bin_touch(file1)
352
+ command2 = usr_bin_touch(file2)
353
+ manifest = <<-"MANIFEST"
354
+ class foo {
355
+ exec { 'notify test':
356
+ command => '#{command1}',
357
+ refreshonly => true,
358
+ }
359
+ }
360
+
361
+ class test {
362
+ include foo
363
+
364
+ exec { 'test':
365
+ command => '#{command2}',
366
+ notify => Class['foo'],
367
+ }
368
+ }
369
+
370
+ include test
371
+ MANIFEST
372
+
373
+ Puppet[:tags] = 'test'
374
+ apply_compiled_manifest(manifest)
375
+ expect(Puppet::FileSystem.exist?(file1)).to be_truthy
376
+ expect(Puppet::FileSystem.exist?(file2)).to be_truthy
377
+ end
378
+ end
379
+
380
+ describe "skipping resources" do
381
+ let(:fname) { tmpfile("exec") }
382
+
383
+ let(:file) do
384
+ Puppet::Type.type(:file).new(
385
+ :name => tmpfile("file"),
386
+ :ensure => "file",
387
+ :backup => false
388
+ )
389
+ end
390
+
391
+ let(:exec) do
392
+ Puppet::Type.type(:exec).new(
393
+ :name => touch(fname),
394
+ :path => touch_path,
395
+ :subscribe => Puppet::Resource.new("file", file.name)
396
+ )
397
+ end
398
+
399
+ it "does not trigger unscheduled resources", :unless => RUBY_PLATFORM == 'java' do
400
+ catalog = mk_catalog
401
+ catalog.add_resource(*Puppet::Type.type(:schedule).mkdefaultschedules)
402
+
403
+ Puppet[:ignoreschedules] = false
404
+
405
+ exec[:schedule] = "monthly"
406
+
407
+ catalog.add_resource(file, exec)
408
+
409
+ # Run it once so further runs don't schedule the resource
410
+ catalog.apply
411
+ expect(Puppet::FileSystem.exist?(fname)).to be_truthy
412
+
413
+ # Now remove it, so it can get created again
414
+ Puppet::FileSystem.unlink(fname)
415
+
416
+ file[:content] = "some content"
417
+
418
+ catalog.apply
419
+ expect(Puppet::FileSystem.exist?(fname)).to be_falsey
420
+ end
421
+
422
+ it "does not trigger untagged resources" do
423
+ catalog = mk_catalog
424
+
425
+ Puppet[:tags] = "runonly"
426
+ file.tag("runonly")
427
+
428
+ catalog.add_resource(file, exec)
429
+ catalog.apply
430
+ expect(Puppet::FileSystem.exist?(fname)).to be_falsey
431
+ end
432
+
433
+ it "does not trigger skip-tagged resources" do
434
+ catalog = mk_catalog
435
+
436
+ Puppet[:skip_tags] = "skipme"
437
+ exec.tag("skipme")
438
+
439
+ catalog.add_resource(file, exec)
440
+ catalog.apply
441
+ expect(Puppet::FileSystem.exist?(fname)).to be_falsey
442
+ end
443
+
444
+ it "does not trigger resources with failed dependencies" do
445
+ catalog = mk_catalog
446
+ file[:path] = make_absolute("/foo/bar/baz")
447
+
448
+ catalog.add_resource(file, exec)
449
+ catalog.apply
450
+
451
+ expect(Puppet::FileSystem.exist?(fname)).to be_falsey
452
+ end
453
+ end
454
+
455
+ it "should not attempt to evaluate resources with failed dependencies", :unless => RUBY_PLATFORM == 'java' do
456
+
457
+ exec = Puppet::Type.type(:exec).new(
458
+ :command => "#{File.expand_path('/bin/mkdir')} /this/path/cannot/possibly/exist",
459
+ :title => "mkdir"
460
+ )
461
+
462
+ file1 = Puppet::Type.type(:file).new(
463
+ :title => "file1",
464
+ :path => tmpfile("file1"),
465
+ :require => exec,
466
+ :ensure => :file
467
+ )
468
+
469
+ file2 = Puppet::Type.type(:file).new(
470
+ :title => "file2",
471
+ :path => tmpfile("file2"),
472
+ :require => file1,
473
+ :ensure => :file
474
+ )
475
+
476
+ catalog = mk_catalog(exec, file1, file2)
477
+ transaction = catalog.apply
478
+
479
+ expect(Puppet::FileSystem.exist?(file1[:path])).to be_falsey
480
+ expect(Puppet::FileSystem.exist?(file2[:path])).to be_falsey
481
+
482
+ expect(transaction.resource_status(file1).skipped).to be_truthy
483
+ expect(transaction.resource_status(file2).skipped).to be_truthy
484
+
485
+ expect(transaction.resource_status(file1).failed_dependencies).to eq([exec])
486
+ expect(transaction.resource_status(file2).failed_dependencies).to eq([exec])
487
+ end
488
+
489
+ it "on failure, skips dynamically-generated dependents", :unless => RUBY_PLATFORM == 'java' do
490
+ exec = Puppet::Type.type(:exec).new(
491
+ :command => "#{File.expand_path('/bin/mkdir')} /this/path/cannot/possibly/exist",
492
+ :title => "mkdir"
493
+ )
494
+
495
+ tmp = tmpfile("dir1")
496
+ FileUtils.mkdir_p(tmp)
497
+ FileUtils.mkdir_p(File.join(tmp, "foo"))
498
+
499
+ purge_dir = Puppet::Type.type(:file).new(
500
+ :title => "dir1",
501
+ :path => tmp,
502
+ :require => exec,
503
+ :ensure => :directory,
504
+ :recurse => true,
505
+ :purge => true
506
+ )
507
+
508
+ catalog = mk_catalog(exec, purge_dir)
509
+ txn = catalog.apply
510
+
511
+ expect(txn.resource_status(purge_dir).skipped).to be_truthy
512
+
513
+ children = catalog.relationship_graph.direct_dependents_of(purge_dir)
514
+
515
+ children.each do |child|
516
+ expect(txn.resource_status(child).skipped).to be_truthy
517
+ end
518
+
519
+ expect(Puppet::FileSystem.exist?(File.join(tmp, "foo"))).to be_truthy
520
+ end
521
+
522
+ it "should not trigger subscribing resources on failure", :unless => RUBY_PLATFORM == 'java' do
523
+ file1 = tmpfile("file1")
524
+ file2 = tmpfile("file2")
525
+
526
+ create_file1 = Puppet::Type.type(:exec).new(
527
+ :command => usr_bin_touch(file1)
528
+ )
529
+
530
+ exec = Puppet::Type.type(:exec).new(
531
+ :command => "#{File.expand_path('/bin/mkdir')} /this/path/cannot/possibly/exist",
532
+ :title => "mkdir",
533
+ :notify => create_file1
534
+ )
535
+
536
+ create_file2 = Puppet::Type.type(:exec).new(
537
+ :command => usr_bin_touch(file2),
538
+ :subscribe => exec
539
+ )
540
+
541
+ catalog = mk_catalog(exec, create_file1, create_file2)
542
+ catalog.apply
543
+
544
+ expect(Puppet::FileSystem.exist?(file1)).to be_falsey
545
+ expect(Puppet::FileSystem.exist?(file2)).to be_falsey
546
+ end
547
+
548
+ # #801 -- resources only checked in noop should be rescheduled immediately.
549
+ it "should immediately reschedule noop resources" do
550
+ Puppet::Type.type(:schedule).mkdefaultschedules
551
+ resource = Puppet::Type.type(:notify).new(:name => "mymessage", :noop => true)
552
+ catalog = Puppet::Resource::Catalog.new
553
+ catalog.add_resource resource
554
+
555
+ trans = catalog.apply
556
+
557
+ expect(trans.resource_harness).to be_scheduled(resource)
558
+ end
559
+ end