chef 0.10.8 → 0.10.10.beta.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (197) hide show
  1. data/distro/arch/etc/rc.d/chef-client +15 -1
  2. data/distro/common/html/chef-client.8.html +4 -4
  3. data/distro/common/html/chef-expander.8.html +4 -4
  4. data/distro/common/html/chef-expanderctl.8.html +4 -4
  5. data/distro/common/html/chef-server-webui.8.html +4 -4
  6. data/distro/common/html/chef-server.8.html +4 -4
  7. data/distro/common/html/chef-solo.8.html +4 -4
  8. data/distro/common/html/chef-solr.8.html +4 -4
  9. data/distro/common/html/knife-bootstrap.1.html +6 -10
  10. data/distro/common/html/knife-client.1.html +4 -4
  11. data/distro/common/html/knife-configure.1.html +4 -4
  12. data/distro/common/html/knife-cookbook-site.1.html +6 -6
  13. data/distro/common/html/knife-cookbook.1.html +4 -4
  14. data/distro/common/html/knife-data-bag.1.html +4 -4
  15. data/distro/common/html/knife-environment.1.html +4 -4
  16. data/distro/common/html/knife-exec.1.html +4 -4
  17. data/distro/common/html/knife-index.1.html +4 -4
  18. data/distro/common/html/knife-node.1.html +5 -5
  19. data/distro/common/html/knife-role.1.html +4 -4
  20. data/distro/common/html/knife-search.1.html +4 -4
  21. data/distro/common/html/knife-ssh.1.html +5 -6
  22. data/distro/common/html/knife-status.1.html +4 -4
  23. data/distro/common/html/knife-tag.1.html +4 -4
  24. data/distro/common/html/knife.1.html +7 -8
  25. data/distro/common/html/shef.1.html +4 -4
  26. data/distro/common/man/man1/knife-bootstrap.1 +4 -4
  27. data/distro/common/man/man1/knife-client.1 +1 -1
  28. data/distro/common/man/man1/knife-configure.1 +1 -1
  29. data/distro/common/man/man1/knife-cookbook-site.1 +4 -4
  30. data/distro/common/man/man1/knife-cookbook.1 +1 -1
  31. data/distro/common/man/man1/knife-data-bag.1 +1 -1
  32. data/distro/common/man/man1/knife-environment.1 +1 -1
  33. data/distro/common/man/man1/knife-exec.1 +1 -1
  34. data/distro/common/man/man1/knife-index.1 +1 -1
  35. data/distro/common/man/man1/knife-node.1 +2 -2
  36. data/distro/common/man/man1/knife-role.1 +1 -1
  37. data/distro/common/man/man1/knife-search.1 +1 -1
  38. data/distro/common/man/man1/knife-ssh.1 +3 -7
  39. data/distro/common/man/man1/knife-status.1 +1 -1
  40. data/distro/common/man/man1/knife-tag.1 +1 -1
  41. data/distro/common/man/man1/knife.1 +5 -9
  42. data/distro/common/man/man1/shef.1 +1 -1
  43. data/distro/common/man/man8/chef-client.8 +1 -1
  44. data/distro/common/man/man8/chef-expander.8 +1 -1
  45. data/distro/common/man/man8/chef-expanderctl.8 +1 -1
  46. data/distro/common/man/man8/chef-server-webui.8 +1 -1
  47. data/distro/common/man/man8/chef-server.8 +1 -1
  48. data/distro/common/man/man8/chef-solo.8 +1 -1
  49. data/distro/common/man/man8/chef-solr.8 +1 -1
  50. data/distro/common/markdown/man1/knife-bootstrap.mkd +3 -7
  51. data/distro/common/markdown/man1/knife-cookbook-site.mkd +3 -3
  52. data/distro/common/markdown/man1/knife-node.mkd +2 -2
  53. data/distro/common/markdown/man1/knife-ssh.mkd +2 -5
  54. data/distro/common/markdown/man1/knife.mkd +7 -9
  55. data/distro/debian/etc/init.d/chef-client +22 -1
  56. data/distro/redhat/etc/init.d/chef-client +12 -1
  57. data/distro/windows/service_manager.rb +164 -0
  58. data/lib/chef/application.rb +12 -6
  59. data/lib/chef/application/client.rb +4 -3
  60. data/lib/chef/application/knife.rb +7 -12
  61. data/lib/chef/application/solo.rb +2 -1
  62. data/lib/chef/application/windows_service.rb +224 -0
  63. data/lib/chef/checksum_cache.rb +1 -0
  64. data/lib/chef/client.rb +3 -16
  65. data/lib/chef/config.rb +42 -13
  66. data/lib/chef/cookbook/metadata.rb +1 -1
  67. data/lib/chef/cookbook/syntax_check.rb +2 -2
  68. data/lib/chef/cookbook_version.rb +5 -0
  69. data/lib/chef/daemon.rb +1 -1
  70. data/lib/chef/exceptions.rb +7 -1
  71. data/lib/chef/file_access_control.rb +13 -87
  72. data/lib/chef/file_access_control/unix.rb +119 -0
  73. data/lib/chef/file_access_control/windows.rb +257 -0
  74. data/lib/chef/handler/json_file.rb +7 -1
  75. data/lib/chef/knife.rb +10 -16
  76. data/lib/chef/knife/bootstrap.rb +15 -8
  77. data/lib/chef/knife/bootstrap/centos5-gems.erb +1 -1
  78. data/lib/chef/knife/bootstrap/chef-full.erb +59 -0
  79. data/lib/chef/knife/bootstrap/ubuntu10.04-apt.erb +1 -0
  80. data/lib/chef/knife/configure.rb +2 -2
  81. data/lib/chef/knife/cookbook_site_download.rb +60 -21
  82. data/lib/chef/knife/cookbook_site_install.rb +16 -21
  83. data/lib/chef/knife/cookbook_upload.rb +77 -48
  84. data/lib/chef/knife/core/bootstrap_context.rb +3 -1
  85. data/lib/chef/knife/core/cookbook_scm_repo.rb +1 -1
  86. data/lib/chef/knife/core/node_editor.rb +1 -1
  87. data/lib/chef/knife/core/subcommand_loader.rb +1 -1
  88. data/lib/chef/knife/core/ui.rb +3 -2
  89. data/lib/chef/knife/help_topics.rb +1 -1
  90. data/lib/chef/knife/node_run_list_add.rb +14 -6
  91. data/lib/chef/knife/node_run_list_remove.rb +3 -3
  92. data/lib/chef/knife/ssh.rb +32 -13
  93. data/lib/chef/mash.rb +14 -0
  94. data/lib/chef/mixin/command.rb +1 -0
  95. data/lib/chef/mixin/command/unix.rb +5 -0
  96. data/lib/chef/mixin/convert_to_class_name.rb +2 -0
  97. data/lib/chef/mixin/deep_merge.rb +40 -18
  98. data/lib/chef/mixin/enforce_ownership_and_permissions.rb +39 -0
  99. data/lib/chef/mixin/language.rb +89 -3
  100. data/lib/chef/mixin/language_include_recipe.rb +8 -4
  101. data/lib/chef/mixin/path_sanity.rb +67 -0
  102. data/lib/chef/mixin/recipe_definition_dsl_core.rb +19 -11
  103. data/lib/chef/mixin/securable.rb +152 -0
  104. data/lib/chef/mixin/shell_out.rb +1 -1
  105. data/lib/chef/mixin/template.rb +8 -3
  106. data/lib/chef/mixins.rb +3 -0
  107. data/lib/chef/monkey_patches/moneta.rb +50 -0
  108. data/lib/chef/monkey_patches/string.rb +1 -1
  109. data/lib/chef/node.rb +2 -1
  110. data/lib/chef/platform.rb +34 -0
  111. data/lib/chef/provider.rb +23 -21
  112. data/lib/chef/provider/cron.rb +17 -12
  113. data/lib/chef/provider/cron/solaris.rb +6 -18
  114. data/lib/chef/provider/deploy.rb +14 -15
  115. data/lib/chef/provider/deploy/timestamped.rb +0 -1
  116. data/lib/chef/provider/directory.rb +1 -3
  117. data/lib/chef/provider/execute.rb +2 -2
  118. data/lib/chef/provider/file.rb +1 -75
  119. data/lib/chef/provider/git.rb +11 -9
  120. data/lib/chef/provider/group/gpasswd.rb +14 -9
  121. data/lib/chef/provider/link.rb +28 -59
  122. data/lib/chef/provider/mdadm.rb +2 -2
  123. data/lib/chef/provider/mount/mount.rb +1 -1
  124. data/lib/chef/provider/package.rb +10 -6
  125. data/lib/chef/provider/package/apt.rb +3 -1
  126. data/lib/chef/provider/package/dpkg.rb +1 -1
  127. data/lib/chef/provider/package/portage.rb +6 -3
  128. data/lib/chef/provider/package/rubygems.rb +75 -6
  129. data/lib/chef/provider/package/smartos.rb +84 -0
  130. data/lib/chef/provider/package/yum-dump.py +3 -2
  131. data/lib/chef/provider/package/yum.rb +51 -10
  132. data/lib/chef/provider/remote_directory.rb +24 -3
  133. data/lib/chef/provider/remote_file.rb +0 -6
  134. data/lib/chef/provider/route.rb +3 -3
  135. data/lib/chef/provider/service/debian.rb +2 -2
  136. data/lib/chef/provider/service/freebsd.rb +1 -1
  137. data/lib/chef/provider/service/macosx.rb +125 -0
  138. data/lib/chef/provider/service/windows.rb +5 -1
  139. data/lib/chef/provider/subversion.rb +10 -7
  140. data/lib/chef/providers.rb +3 -0
  141. data/lib/chef/resource.rb +181 -87
  142. data/lib/chef/resource/apt_package.rb +10 -1
  143. data/lib/chef/resource/chef_gem.rb +53 -0
  144. data/lib/chef/resource/conditional.rb +3 -0
  145. data/lib/chef/resource/cookbook_file.rb +12 -6
  146. data/lib/chef/resource/cron.rb +9 -0
  147. data/lib/chef/resource/directory.rb +14 -31
  148. data/lib/chef/resource/execute.rb +11 -9
  149. data/lib/chef/resource/file.rb +9 -33
  150. data/lib/chef/resource/link.rb +13 -8
  151. data/lib/chef/resource/mdadm.rb +10 -1
  152. data/lib/chef/resource/remote_directory.rb +13 -2
  153. data/lib/chef/resource/remote_file.rb +14 -7
  154. data/lib/chef/resource/smartos_package.rb +36 -0
  155. data/lib/chef/resource/template.rb +12 -5
  156. data/lib/chef/resource_platform_map.rb +153 -0
  157. data/lib/chef/resources.rb +2 -0
  158. data/lib/chef/rest.rb +55 -10
  159. data/lib/chef/rest/auth_credentials.rb +1 -0
  160. data/lib/chef/rest/rest_request.rb +24 -8
  161. data/lib/chef/role.rb +8 -2
  162. data/lib/chef/run_list.rb +1 -1
  163. data/lib/chef/run_list/run_list_expansion.rb +2 -2
  164. data/lib/chef/run_list/run_list_item.rb +7 -0
  165. data/lib/chef/runner.rb +4 -0
  166. data/lib/chef/shef.rb +2 -2
  167. data/lib/chef/shef/shef_session.rb +4 -5
  168. data/lib/chef/shell_out.rb +2 -245
  169. data/lib/chef/util/file_edit.rb +99 -89
  170. data/lib/chef/version.rb +1 -1
  171. data/lib/chef/win32/api.rb +349 -0
  172. data/lib/chef/win32/api/error.rb +921 -0
  173. data/lib/chef/win32/api/file.rb +289 -0
  174. data/lib/chef/win32/api/memory.rb +105 -0
  175. data/lib/chef/win32/api/process.rb +40 -0
  176. data/lib/chef/win32/api/psapi.rb +51 -0
  177. data/lib/chef/win32/api/security.rb +341 -0
  178. data/lib/chef/win32/api/system.rb +192 -0
  179. data/lib/chef/win32/api/unicode.rb +178 -0
  180. data/lib/chef/win32/error.rb +73 -0
  181. data/lib/chef/win32/file.rb +117 -0
  182. data/lib/chef/win32/file/info.rb +100 -0
  183. data/lib/chef/win32/handle.rb +48 -0
  184. data/lib/chef/win32/memory.rb +101 -0
  185. data/lib/chef/win32/process.rb +84 -0
  186. data/lib/chef/win32/security.rb +489 -0
  187. data/lib/chef/win32/security/ace.rb +125 -0
  188. data/lib/chef/win32/security/acl.rb +101 -0
  189. data/lib/chef/win32/security/securable_object.rb +109 -0
  190. data/lib/chef/win32/security/security_descriptor.rb +93 -0
  191. data/lib/chef/win32/security/sid.rb +199 -0
  192. data/lib/chef/win32/security/token.rb +64 -0
  193. data/lib/chef/win32/unicode.rb +43 -0
  194. data/lib/chef/win32/version.rb +119 -0
  195. metadata +104 -158
  196. data/lib/chef/shell_out/unix.rb +0 -223
  197. data/lib/chef/shell_out/windows.rb +0 -588
@@ -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 "KNIFE" "1" "December 2011" "Chef 0.10.8" "Chef Manual"
4
+ .TH "KNIFE" "1" "April 2012" "Chef 0.10.10.beta.1" "Chef Manual"
5
5
  .
6
6
  .SH "NAME"
7
7
  \fBknife\fR \- Chef Server API client utility
@@ -96,7 +96,7 @@ Which format to use for output\. See FORMATS for details\.
96
96
  More verbose output\. Use twice for max verbosity
97
97
  .
98
98
  .TP
99
- \fB\-n\fR, \fB\-\-no\-editor\fR
99
+ \fB\-d\fR, \fB\-\-disable\-editing\fR
100
100
  Do not open EDITOR, just accept the data as is
101
101
  .
102
102
  .TP
@@ -120,12 +120,8 @@ Say yes to all prompts for confirmation
120
120
  Accept default values for all questions
121
121
  .
122
122
  .TP
123
- \fB\-\-color\fR
124
- Use colored output
125
- .
126
- .TP
127
- \fB\-\-no\-color\fR
128
- Don\'t use colors in the output
123
+ \fB\-\-[no\-]color\fR
124
+ Use colored output\. Color enabled by default\.
129
125
  .
130
126
  .TP
131
127
  \fB\-h\fR, \fB\-\-help\fR
@@ -256,7 +252,7 @@ A note about git: Opscode and many folks in the Chef community use git, but it i
256
252
  .
257
253
  .TP
258
254
  \fBEDITOR\fR
259
- The text editor to use for editing data\. The \-\-editor option takes precedence over this value, and the \-\-no\-editor option supresses data editing entirely\.
255
+ The text editor to use for editing data\. The \-\-editor option takes precedence over this value, and the \-\-disable\-editing option supresses data editing entirely\.
260
256
  .
261
257
  .SH "SEE ALSO"
262
258
  \fBchef\-client(8)\fR \fBchef\-server(8)\fR \fBshef(1)\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 "SHEF" "1" "December 2011" "Chef 0.10.8" "Chef Manual"
4
+ .TH "SHEF" "1" "April 2012" "Chef 0.10.10.beta.1" "Chef Manual"
5
5
  .
6
6
  .SH "NAME"
7
7
  \fBshef\fR \- Interactive Chef Console
@@ -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 "CHEF\-CLIENT" "8" "December 2011" "Chef 0.10.8" "Chef Manual"
4
+ .TH "CHEF\-CLIENT" "8" "April 2012" "Chef 0.10.10.beta.1" "Chef Manual"
5
5
  .
6
6
  .SH "NAME"
7
7
  \fBchef\-client\fR \- Runs a client node connecting to a chef\-server\.
@@ -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 "CHEF\-EXPANDER" "8" "December 2011" "Chef 0.10.8" "Chef Manual"
4
+ .TH "CHEF\-EXPANDER" "8" "April 2012" "Chef 0.10.10.beta.1" "Chef Manual"
5
5
  .
6
6
  .SH "NAME"
7
7
  \fBchef\-expander\fR \- fetches messages from RabbitMQ, processes, and loads into chef\-solr
@@ -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 "CHEF\-EXPANDERCTL" "8" "December 2011" "Chef 0.10.8" "Chef Manual"
4
+ .TH "CHEF\-EXPANDERCTL" "8" "April 2012" "Chef 0.10.10.beta.1" "Chef Manual"
5
5
  .
6
6
  .SH "NAME"
7
7
  \fBchef\-expanderctl\fR \- management program for chef\-expander
@@ -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 "CHEF\-SERVER\-WEBUI" "8" "December 2011" "Chef 0.10.8" "Chef Manual"
4
+ .TH "CHEF\-SERVER\-WEBUI" "8" "April 2012" "Chef 0.10.10.beta.1" "Chef Manual"
5
5
  .
6
6
  .SH "NAME"
7
7
  \fBchef\-server\-webui\fR \- Start the Chef Server merb application slice providing Web User Interface (Management Console)\.
@@ -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 "CHEF\-SERVER" "8" "December 2011" "Chef 0.10.8" "Chef Manual"
4
+ .TH "CHEF\-SERVER" "8" "April 2012" "Chef 0.10.10.beta.1" "Chef Manual"
5
5
  .
6
6
  .SH "NAME"
7
7
  \fBchef\-server\fR \- Start the Chef Server merb application slice\.
@@ -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 "CHEF\-SOLO" "8" "December 2011" "Chef 0.10.8" "Chef Manual"
4
+ .TH "CHEF\-SOLO" "8" "April 2012" "Chef 0.10.10.beta.1" "Chef Manual"
5
5
  .
6
6
  .SH "NAME"
7
7
  \fBchef\-solo\fR \- Runs chef in solo mode against a specified cookbook location\.
@@ -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 "CHEF\-SOLR" "8" "December 2011" "Chef 0.10.8" "Chef Manual"
4
+ .TH "CHEF\-SOLR" "8" "April 2012" "Chef 0.10.10.beta.1" "Chef Manual"
5
5
  .
6
6
  .SH "NAME"
7
7
  \fBchef\-solr\fR \- Runs as Chef\'s search server
@@ -29,8 +29,8 @@ __knife__ __bootstrap__ _(options)_
29
29
  Execute the bootstrap via sudo
30
30
  * `-d`, `--distro DISTRO`:
31
31
  Bootstrap a distro using a template
32
- * `--no-host-key-verify`:
33
- Disable host key verification
32
+ * `--[no-]host-key-verify`:
33
+ Enable host key verification, which is the default behavior.
34
34
 
35
35
  ## DESCRIPTION
36
36
 
@@ -61,11 +61,7 @@ target node (FQDN). The following distros are supported:
61
61
  * ubuntu10.04-apt
62
62
 
63
63
  The gems installations will use RubyGems 1.3.6 and Chef installed as a
64
- gem. The apt installation will use the Opscode APT repository. The
65
- RubyGems installation requires installing gems with native extensions,
66
- so development related packages (ruby-dev, build-essential) are
67
- installed. These are not installed with the apt installation, as native
68
- extensions are already compiled in the required packages.
64
+ gem. The apt installation will use the Opscode APT repository.
69
65
 
70
66
  In addition to handling the software installation, these bootstrap
71
67
  templates do the following:
@@ -11,8 +11,8 @@ __knife__ __cookbook site__ _sub-command_ _(options)_
11
11
  ## INSTALL
12
12
  __cookbook site install COOKBOOK [VERSION]__ _(options)_
13
13
 
14
- * `-D`, `--no-dependencies `:
15
- Do not install dependencies automatically
14
+ * `-D`, `--skip-dependencies `:
15
+ Skip automatic installation of dependencies.
16
16
  * `-o`, `--cookbook-path PATH`:
17
17
  Install cookbooks to PATH
18
18
  * `-B`, `--branch BRANCH`:
@@ -35,7 +35,7 @@ changes as a separate patch. When an updated upstream version becomes
35
35
  available, you will be able to merge the upstream changes while
36
36
  maintaining your local modifications.
37
37
 
38
- Unless _-D_ is specified, the process is applied recursively to all the
38
+ Unless _--skip-dependencies_ is specified, the process is applied recursively to all the
39
39
  cookbooks _COOKBOOK_ depends on (via metadata _dependencies_).
40
40
 
41
41
  ## DOWNLOAD
@@ -41,7 +41,7 @@ regular expression literals in scripting languages).
41
41
  ## CREATE
42
42
  __knife node create__ _name_ _(options)_
43
43
 
44
- Create a new node. Unless the --no-editor option is given, an empty node
44
+ Create a new node. Unless the --disable-editing option is given, an empty node
45
45
  object will be created and displayed in your text editor. If the editor
46
46
  exits with a successful exit status, the node data will be posted to the
47
47
  Chef Server to create the node.
@@ -100,7 +100,7 @@ __knife node show__ _node name_ _(options)_
100
100
  Display more, but not all, of the node's data when using the default
101
101
  _summary_ format
102
102
 
103
- Displays the node identified by _node name_ on stdout.
103
+ Displays the node identified by _node name_ on stdout.
104
104
 
105
105
  ## RUN LIST ITEM FORMAT
106
106
  Run list items may be either roles or recipes. When adding a role to a
@@ -19,11 +19,8 @@ __knife__ __ssh QUERY COMMAND__ _(options)_
19
19
  The SSH identity file used for authentication
20
20
  * `-p`, `--ssh-port PORT`:
21
21
  The ssh port
22
- * `-i`, `--identity-file IDENTITY_FILE`:
23
- The SSH identity file used for authentication
24
- * `--no-host-key-verify`:
25
- Disable host key verification
26
-
22
+ * `--[no-]host-key-verify`:
23
+ Verify host key, enabled by default.
27
24
 
28
25
  ## DESCRIPTION
29
26
 
@@ -48,7 +48,7 @@ documentation using `knife help TOPIC`.
48
48
  Which format to use for output. See FORMATS for details.
49
49
  * `-V`, `--verbose`:
50
50
  More verbose output. Use twice for max verbosity
51
- * `-n`, `--no-editor`:
51
+ * `-d`, `--disable-editing`:
52
52
  Do not open EDITOR, just accept the data as is
53
53
  * `-u`, `--user` USER:
54
54
  API Client Username, corresponds to `Chef::Config` `node_name`.
@@ -60,10 +60,8 @@ documentation using `knife help TOPIC`.
60
60
  Say yes to all prompts for confirmation
61
61
  * `--defaults`:
62
62
  Accept default values for all questions
63
- * `--color`:
64
- Use colored output
65
- * `--no-color`:
66
- Don't use colors in the output
63
+ * `--[no-]color`:
64
+ Use colored output. Color enabled by default.
67
65
  * `-h`, `--help`:
68
66
  Show the available options for a command.
69
67
 
@@ -124,7 +122,7 @@ If the config file exists, knife uses these settings for __GENERAL OPTIONS__ def
124
122
  and is listed as the license in the cookbook metadata. Currently
125
123
  supported licenses are "apachev2" and "none". Any other values will
126
124
  result in an empty license in the metadata (needs to be filled in by the
127
- author), and no comment preamble in the default recipe. Currently supported
125
+ author), and no comment preamble in the default recipe. Currently supported
128
126
  readme formats are "md", "mkd", "txt", and "rdoc". Any other value will
129
127
  result in an unformatted README.
130
128
 
@@ -134,7 +132,7 @@ _~/.chef/knife.rb_
134
132
 
135
133
  Ruby DSL configuration file for knife. See __CONFIGURATION__.
136
134
 
137
- ## FORMATS
135
+ ## FORMATS
138
136
 
139
137
  The amount of content displayed and the output format are
140
138
  modified by the `--format` option. If no alternate format is selected,
@@ -145,7 +143,7 @@ Valid formats are:
145
143
  * `summary`:
146
144
  displays the node in a custom, summarized format (default)
147
145
  * `text`:
148
- displays the node data in its entirety using the colorized tree display
146
+ displays the node data in its entirety using the colorized tree display
149
147
  * `json`:
150
148
  displays the node in JSON format
151
149
  * `yaml`:
@@ -181,7 +179,7 @@ recommended though, and git fits with a lot of the workflow paradigms.
181
179
  ## ENVIRONMENT
182
180
  * `EDITOR`:
183
181
  The text editor to use for editing data. The --editor option takes
184
- precedence over this value, and the --no-editor option supresses
182
+ precedence over this value, and the --disable-editing option supresses
185
183
  data editing entirely.
186
184
 
187
185
  ## SEE ALSO
@@ -88,6 +88,19 @@ reload_server() {
88
88
  return $errcode
89
89
  }
90
90
 
91
+ run_server() {
92
+ if [ -z "$DAEMONUSER" ] ; then
93
+ killproc -p $PIDFILE $DAEMON -USR1
94
+ errcode=$?
95
+ else
96
+ start-stop-daemon --stop --signal USR1 --quiet --pidfile $PIDFILE \
97
+ --user $DAEMONUSER \
98
+ --exec $DAEMON
99
+ errcode=$?
100
+ fi
101
+ return $errcode
102
+ }
103
+
91
104
  force_stop() {
92
105
  [ ! -e "$PIDFILE" ] && return
93
106
  if running ; then
@@ -174,9 +187,17 @@ case "$1" in
174
187
  log_end_msg $errcode
175
188
  fi
176
189
  ;;
190
+ run)
191
+ if running; then
192
+ log_daemon_msg "Triggering run of $DESC" "$NAME"
193
+ errcode=0
194
+ run_server || errcode=$?
195
+ log_end_msg $errcode
196
+ fi
197
+ ;;
177
198
  *)
178
199
  N=/etc/init.d/$NAME
179
- echo "Usage: $N {start|stop|force-stop|restart|force-reload|status}" >&2
200
+ echo "Usage: $N {start|stop|force-stop|restart|force-reload|status|run}" >&2
180
201
  exit 1
181
202
  ;;
182
203
  esac
@@ -64,6 +64,14 @@ reload() {
64
64
  return $retval
65
65
  }
66
66
 
67
+ run() {
68
+ echo -n $"Triggering run of $prog: "
69
+ killproc -p $pidfile chef-client -USR1
70
+ retval=$?
71
+ echo
72
+ return $retval
73
+ }
74
+
67
75
  force_reload() {
68
76
  restart
69
77
  }
@@ -103,8 +111,11 @@ case "$1" in
103
111
  rh_status_q || exit 0
104
112
  restart
105
113
  ;;
114
+ run)
115
+ $1
116
+ ;;
106
117
  *)
107
- echo $"Usage: $0 {start|stop|status|restart|condrestart|try-restart|reload|force-reload}"
118
+ echo $"Usage: $0 {start|stop|status|restart|condrestart|try-restart|reload|force-reload|run}"
108
119
  exit 2
109
120
  esac
110
121
  exit $?
@@ -0,0 +1,164 @@
1
+ #
2
+ # Author:: Seth Chisamore (<schisamo@opscode.com>)
3
+ # Copyright:: Copyright (c) 2011 Opscode, Inc.
4
+ # License:: Apache License, Version 2.0
5
+ #
6
+ # Licensed under the Apache License, Version 2.0 (the "License");
7
+ # you may not use this file except in compliance with the License.
8
+ # You may obtain a copy of the License at
9
+ #
10
+ # http://www.apache.org/licenses/LICENSE-2.0
11
+ #
12
+ # Unless required by applicable law or agreed to in writing, software
13
+ # distributed under the License is distributed on an "AS IS" BASIS,
14
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
+ # See the License for the specific language governing permissions and
16
+ # limitations under the License.
17
+ #
18
+
19
+ require 'win32/service'
20
+ require 'rbconfig'
21
+ require 'mixlib/cli'
22
+
23
+ class Chef
24
+ class Windows
25
+ class ServiceManager
26
+ include Config
27
+ include Mixlib::CLI
28
+
29
+ option :action,
30
+ :short => "-a ACTION",
31
+ :long => "--action ACTION",
32
+ :default => "start",
33
+ :description => "Action to carry out on the resource; one of 'install', 'uninstall', 'start', 'stop', 'pause', or 'resume'"
34
+
35
+ option :name,
36
+ :short => "-n NAME",
37
+ :long => "--name NAME",
38
+ :default => "chef-client",
39
+ :description => "The service name to use."
40
+
41
+ option :display_name,
42
+ :long => "--display_name NAME",
43
+ :default => "chef-client",
44
+ :description => "The display name to use for the service."
45
+
46
+ option :description,
47
+ :short => "-d DESCRIPTION",
48
+ :long => "--description DESCRIPTION",
49
+ :default => "chef-client",
50
+ :description => "The description for the service."
51
+
52
+ option :config_file,
53
+ :short => "-c CONFIG",
54
+ :long => "--config CONFIG",
55
+ :default => "#{ENV['SYSTEMDRIVE']}/chef/client.rb",
56
+ :description => "The configuration file to use"
57
+
58
+ option :log_location,
59
+ :short => "-L LOGLOCATION",
60
+ :long => "--logfile LOGLOCATION",
61
+ :description => "Set the log file location",
62
+ :default => "#{ENV['SYSTEMDRIVE']}/chef/client.log"
63
+
64
+ option :splay,
65
+ :short => "-s SECONDS",
66
+ :long => "--splay SECONDS",
67
+ :description => "The splay time for running at intervals, in seconds",
68
+ :proc => lambda { |s| s.to_i }
69
+
70
+ option :interval,
71
+ :short => "-i SECONDS",
72
+ :long => "--interval SECONDS",
73
+ :description => "Set the number of seconds to wait between chef-client runs",
74
+ :proc => lambda { |s| s.to_i }
75
+
76
+ option :help,
77
+ :short => "-h",
78
+ :long => "--help",
79
+ :description => "Show this message",
80
+ :on => :tail,
81
+ :boolean => true,
82
+ :show_options => true,
83
+ :exit => 0
84
+
85
+ def run
86
+ parse_options
87
+
88
+ case config[:action]
89
+ when 'install'
90
+ ruby = File.join(RbConfig::CONFIG['bindir'], 'ruby')
91
+ path = File.expand_path(File.join(File.dirname(__FILE__), '..', '..', 'lib', 'chef', 'application', 'windows_service.rb'))
92
+
93
+ opts = ""
94
+ opts << " -c #{config[:config_file]}" if config[:config_file]
95
+ opts << " -L #{config[:log_location]}" if config[:log_location]
96
+ opts << " -i #{config[:interval]}" if config[:interval]
97
+ opts << " -s #{config[:splay]}" if config[:splay]
98
+
99
+ # Quote the full paths to deal with possible spaces in the path name.
100
+ # Also ensure all forward slashes are backslashes
101
+ cmd = "\"#{ruby}\" \"#{path}\" #{opts}".gsub(File::SEPARATOR, File::ALT_SEPARATOR)
102
+
103
+ Win32::Service.new(
104
+ :service_name => config[:name],
105
+ :display_name => config[:display_name],
106
+ :description => config[:description],
107
+ :binary_path_name => cmd)
108
+ puts "Service '#{config[:name]}' has successfully been 'installed'."
109
+ when 'start'
110
+ # TODO: allow override of startup parameters here?
111
+ take_action('start', RUNNING) if Win32::Service.exists?(config[:name])
112
+ when 'stop'
113
+ take_action('stop', STOPPED) if Win32::Service.exists?(config[:name])
114
+ when 'uninstall', 'delete'
115
+ take_action('stop', STOPPED)
116
+ if Win32::Service.exists?(config[:name])
117
+ Win32::Service.delete(config[:name])
118
+ puts "Service #{config[:name]} deleted"
119
+ end
120
+ when 'pause'
121
+ take_action('pause', PAUSED)
122
+ when 'resume'
123
+ take_action('resume', RUNNING)
124
+ end
125
+ end
126
+
127
+ private
128
+
129
+ # Just some state constants
130
+ STOPPED = "stopped"
131
+ RUNNING = "running"
132
+ PAUSED = "paused"
133
+
134
+ def take_action(action=nil, desired_state=nil)
135
+ if Win32::Service.exists?(config[:name])
136
+ if current_state != desired_state
137
+ Win32::Service.send(action, config[:name])
138
+ wait_for_state(desired_state)
139
+ puts "Service '#{config[:name]}' is now '#{current_state}'."
140
+ else
141
+ puts "Service '#{config[:name]}' is already '#{desired_state}'."
142
+ end
143
+ else
144
+ puts "Cannot '#{action}' service '#{config[:name]}', service does not exist."
145
+ end
146
+ end
147
+
148
+ def current_state
149
+ Win32::Service.status(config[:name]).current_state
150
+ end
151
+
152
+ # Helper method that waits for a status to change its state since state
153
+ # changes aren't usually instantaneous.
154
+ def wait_for_state(desired_state)
155
+ while current_state != desired_state
156
+ puts "One moment... #{current_state}"
157
+ sleep 1
158
+ end
159
+ end
160
+ end
161
+ end
162
+ end
163
+
164
+ Chef::Windows::ServiceManager.new.run