chef 0.10.6 → 0.10.8
Sign up to get free protection for your applications and to get access to all the features.
- data/distro/common/html/chef-client.8.html +3 -3
- data/distro/common/html/chef-expander.8.html +3 -3
- data/distro/common/html/chef-expanderctl.8.html +3 -3
- data/distro/common/html/chef-server-webui.8.html +3 -3
- data/distro/common/html/chef-server.8.html +3 -3
- data/distro/common/html/chef-solo.8.html +3 -3
- data/distro/common/html/chef-solr.8.html +3 -3
- data/distro/common/html/knife-bootstrap.1.html +3 -3
- data/distro/common/html/knife-client.1.html +3 -3
- data/distro/common/html/knife-configure.1.html +3 -3
- data/distro/common/html/knife-cookbook-site.1.html +3 -3
- data/distro/common/html/knife-cookbook.1.html +3 -3
- data/distro/common/html/knife-data-bag.1.html +3 -3
- data/distro/common/html/knife-environment.1.html +3 -3
- data/distro/common/html/knife-exec.1.html +3 -3
- data/distro/common/html/knife-index.1.html +3 -3
- data/distro/common/html/knife-node.1.html +3 -3
- data/distro/common/html/knife-role.1.html +3 -3
- data/distro/common/html/knife-search.1.html +3 -3
- data/distro/common/html/knife-ssh.1.html +3 -3
- data/distro/common/html/knife-status.1.html +3 -3
- data/distro/common/html/knife-tag.1.html +3 -3
- data/distro/common/html/knife.1.html +3 -3
- data/distro/common/html/shef.1.html +3 -3
- data/distro/common/man/man1/knife-bootstrap.1 +1 -1
- data/distro/common/man/man1/knife-client.1 +1 -1
- data/distro/common/man/man1/knife-configure.1 +1 -1
- data/distro/common/man/man1/knife-cookbook-site.1 +1 -1
- data/distro/common/man/man1/knife-cookbook.1 +1 -1
- data/distro/common/man/man1/knife-data-bag.1 +1 -1
- data/distro/common/man/man1/knife-environment.1 +1 -1
- data/distro/common/man/man1/knife-exec.1 +1 -1
- data/distro/common/man/man1/knife-index.1 +1 -1
- data/distro/common/man/man1/knife-node.1 +1 -1
- data/distro/common/man/man1/knife-role.1 +1 -1
- data/distro/common/man/man1/knife-search.1 +1 -1
- data/distro/common/man/man1/knife-ssh.1 +1 -1
- data/distro/common/man/man1/knife-status.1 +1 -1
- data/distro/common/man/man1/knife-tag.1 +1 -1
- data/distro/common/man/man1/knife.1 +1 -1
- data/distro/common/man/man1/shef.1 +1 -1
- data/distro/common/man/man8/chef-client.8 +1 -1
- data/distro/common/man/man8/chef-expander.8 +1 -1
- data/distro/common/man/man8/chef-expanderctl.8 +1 -1
- data/distro/common/man/man8/chef-server-webui.8 +1 -1
- data/distro/common/man/man8/chef-server.8 +1 -1
- data/distro/common/man/man8/chef-solo.8 +1 -1
- data/distro/common/man/man8/chef-solr.8 +1 -1
- data/lib/chef/shell_out/windows.rb +58 -27
- data/lib/chef/version.rb +1 -1
- metadata +4 -4
@@ -105,11 +105,11 @@ may not be publicly reachable.</p>
|
|
105
105
|
|
106
106
|
<h2 id="AUTHOR">AUTHOR</h2>
|
107
107
|
|
108
|
-
<p> Chef was written by Adam Jacob <a href="&#
|
108
|
+
<p> Chef was written by Adam Jacob <a href="mailto:adam@opscode.com" data-bare-link="true">adam@opscode.com</a> with many contributions from the community.</p>
|
109
109
|
|
110
110
|
<h2 id="DOCUMENTATION">DOCUMENTATION</h2>
|
111
111
|
|
112
|
-
<p> This manual page was written by Joshua Timberman <a href="mai&#
|
112
|
+
<p> This manual page was written by Joshua Timberman <a href="mailto:joshua@opscode.com" data-bare-link="true">joshua@opscode.com</a>.
|
113
113
|
Permission is granted to copy, distribute and / or modify this document under the terms of the Apache 2.0 License.</p>
|
114
114
|
|
115
115
|
<h2 id="CHEF">CHEF</h2>
|
@@ -118,7 +118,7 @@ may not be publicly reachable.</p>
|
|
118
118
|
|
119
119
|
|
120
120
|
<ol class='man-decor man-foot man foot'>
|
121
|
-
<li class='tl'>Chef 0.10.
|
121
|
+
<li class='tl'>Chef 0.10.8</li>
|
122
122
|
<li class='tc'>December 2011</li>
|
123
123
|
<li class='tr'>knife-status(1)</li>
|
124
124
|
</ol>
|
@@ -114,11 +114,11 @@
|
|
114
114
|
|
115
115
|
<h2 id="AUTHOR">AUTHOR</h2>
|
116
116
|
|
117
|
-
<p> Chef was written by Adam Jacob <a href="&#
|
117
|
+
<p> Chef was written by Adam Jacob <a href="mailto:adam@opscode.com" data-bare-link="true">adam@opscode.com</a> with many contributions from the community.</p>
|
118
118
|
|
119
119
|
<h2 id="DOCUMENTATION">DOCUMENTATION</h2>
|
120
120
|
|
121
|
-
<p> This manual page was written by Daniel DeLeo <a href="mai&#
|
121
|
+
<p> This manual page was written by Daniel DeLeo <a href="mailto:dan@opscode.com" data-bare-link="true">dan@opscode.com</a>.
|
122
122
|
Permission is granted to copy, distribute and / or modify this document under the terms of the Apache 2.0 License.</p>
|
123
123
|
|
124
124
|
<h2 id="CHEF">CHEF</h2>
|
@@ -127,7 +127,7 @@
|
|
127
127
|
|
128
128
|
|
129
129
|
<ol class='man-decor man-foot man foot'>
|
130
|
-
<li class='tl'>Chef 0.10.
|
130
|
+
<li class='tl'>Chef 0.10.8</li>
|
131
131
|
<li class='tc'>December 2011</li>
|
132
132
|
<li class='tr'>knife-tag(1)</li>
|
133
133
|
</ol>
|
@@ -292,12 +292,12 @@ data editing entirely.</dd>
|
|
292
292
|
|
293
293
|
<h2 id="AUTHOR">AUTHOR</h2>
|
294
294
|
|
295
|
-
<p> Chef was written by Adam Jacob <a href="&#
|
295
|
+
<p> Chef was written by Adam Jacob <a href="mailto:adam@opscode.com" data-bare-link="true">adam@opscode.com</a> of Opscode
|
296
296
|
(<a href="http://www.opscode.com" data-bare-link="true">http://www.opscode.com</a>), with contributions from the community.</p>
|
297
297
|
|
298
298
|
<h2 id="DOCUMENTATION">DOCUMENTATION</h2>
|
299
299
|
|
300
|
-
<p> This manual page was written by Joshua Timberman <a href="mai&#
|
300
|
+
<p> This manual page was written by Joshua Timberman <a href="mailto:joshua@opscode.com" data-bare-link="true">joshua@opscode.com</a>.</p>
|
301
301
|
|
302
302
|
<h2 id="LICENSE">LICENSE</h2>
|
303
303
|
|
@@ -311,7 +311,7 @@ data editing entirely.</dd>
|
|
311
311
|
|
312
312
|
|
313
313
|
<ol class='man-decor man-foot man foot'>
|
314
|
-
<li class='tl'>Chef 0.10.
|
314
|
+
<li class='tl'>Chef 0.10.8</li>
|
315
315
|
<li class='tc'>December 2011</li>
|
316
316
|
<li class='tr'>knife(1)</li>
|
317
317
|
</ol>
|
@@ -258,12 +258,12 @@ and may become out of sync with the behavior of those libraries.</p>
|
|
258
258
|
|
259
259
|
<h2 id="AUTHOR">AUTHOR</h2>
|
260
260
|
|
261
|
-
<p> Chef was written by Adam Jacob <a href="m&#
|
261
|
+
<p> Chef was written by Adam Jacob <a href="mailto:adam@opscode.com" data-bare-link="true">adam@opscode.com</a> with many
|
262
262
|
contributions from the community. Shef was written by Daniel DeLeo.</p>
|
263
263
|
|
264
264
|
<h2 id="DOCUMENTATION">DOCUMENTATION</h2>
|
265
265
|
|
266
|
-
<p> This manual page was written by Daniel DeLeo <a href="m&#
|
266
|
+
<p> This manual page was written by Daniel DeLeo <a href="mailto:dan@opscode.com" data-bare-link="true">dan@opscode.com</a>.
|
267
267
|
Permission is granted to copy, distribute and / or modify this
|
268
268
|
document under the terms of the Apache 2.0 License.</p>
|
269
269
|
|
@@ -273,7 +273,7 @@ and may become out of sync with the behavior of those libraries.</p>
|
|
273
273
|
|
274
274
|
|
275
275
|
<ol class='man-decor man-foot man foot'>
|
276
|
-
<li class='tl'>Chef 0.10.
|
276
|
+
<li class='tl'>Chef 0.10.8</li>
|
277
277
|
<li class='tc'>December 2011</li>
|
278
278
|
<li class='tr'>shef(1)</li>
|
279
279
|
</ol>
|
@@ -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\-BOOTSTRAP" "1" "December 2011" "Chef 0.10.
|
4
|
+
.TH "KNIFE\-BOOTSTRAP" "1" "December 2011" "Chef 0.10.8" "Chef Manual"
|
5
5
|
.
|
6
6
|
.SH "NAME"
|
7
7
|
\fBknife\-bootstrap\fR \- Install Chef Client on a remote host
|
@@ -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\-CLIENT" "1" "December 2011" "Chef 0.10.
|
4
|
+
.TH "KNIFE\-CLIENT" "1" "December 2011" "Chef 0.10.8" "Chef Manual"
|
5
5
|
.
|
6
6
|
.SH "NAME"
|
7
7
|
\fBknife\-client\fR \- Manage Chef API Clients
|
@@ -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\-CONFIGURE" "1" "December 2011" "Chef 0.10.
|
4
|
+
.TH "KNIFE\-CONFIGURE" "1" "December 2011" "Chef 0.10.8" "Chef Manual"
|
5
5
|
.
|
6
6
|
.SH "NAME"
|
7
7
|
\fBknife\-configure\fR \- Generate configuration files for knife or Chef Client
|
@@ -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\-COOKBOOK\-SITE" "1" "December 2011" "Chef 0.10.
|
4
|
+
.TH "KNIFE\-COOKBOOK\-SITE" "1" "December 2011" "Chef 0.10.8" "Chef Manual"
|
5
5
|
.
|
6
6
|
.SH "NAME"
|
7
7
|
\fBknife\-cookbook\-site\fR \- Install and update open source cookbooks
|
@@ -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\-COOKBOOK" "1" "December 2011" "Chef 0.10.
|
4
|
+
.TH "KNIFE\-COOKBOOK" "1" "December 2011" "Chef 0.10.8" "Chef Manual"
|
5
5
|
.
|
6
6
|
.SH "NAME"
|
7
7
|
\fBknife\-cookbook\fR \- upload and manage chef cookbooks
|
@@ -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\-DATA\-BAG" "1" "December 2011" "Chef 0.10.
|
4
|
+
.TH "KNIFE\-DATA\-BAG" "1" "December 2011" "Chef 0.10.8" "Chef Manual"
|
5
5
|
.
|
6
6
|
.SH "NAME"
|
7
7
|
\fBknife\-data\-bag\fR \- Store arbitrary data on 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 "KNIFE\-ENVIRONMENT" "1" "December 2011" "Chef 0.10.
|
4
|
+
.TH "KNIFE\-ENVIRONMENT" "1" "December 2011" "Chef 0.10.8" "Chef Manual"
|
5
5
|
.
|
6
6
|
.SH "NAME"
|
7
7
|
\fBknife\-environment\fR \- Define cookbook policies for the environments in your infrastructure
|
@@ -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\-EXEC" "1" "December 2011" "Chef 0.10.
|
4
|
+
.TH "KNIFE\-EXEC" "1" "December 2011" "Chef 0.10.8" "Chef Manual"
|
5
5
|
.
|
6
6
|
.SH "NAME"
|
7
7
|
\fBknife\-exec\fR \- Run user scripts using the Chef API DSL
|
@@ -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\-INDEX" "1" "December 2011" "Chef 0.10.
|
4
|
+
.TH "KNIFE\-INDEX" "1" "December 2011" "Chef 0.10.8" "Chef Manual"
|
5
5
|
.
|
6
6
|
.SH "NAME"
|
7
7
|
\fBknife\-index\fR \- Rebuild the search index on 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 "KNIFE\-NODE" "1" "December 2011" "Chef 0.10.
|
4
|
+
.TH "KNIFE\-NODE" "1" "December 2011" "Chef 0.10.8" "Chef Manual"
|
5
5
|
.
|
6
6
|
.SH "NAME"
|
7
7
|
\fBknife\-node\fR \- Manage the hosts in your infrastructure
|
@@ -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\-ROLE" "1" "December 2011" "Chef 0.10.
|
4
|
+
.TH "KNIFE\-ROLE" "1" "December 2011" "Chef 0.10.8" "Chef Manual"
|
5
5
|
.
|
6
6
|
.SH "NAME"
|
7
7
|
\fBknife\-role\fR \- Group common configuration settings
|
@@ -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\-SEARCH" "1" "December 2011" "Chef 0.10.
|
4
|
+
.TH "KNIFE\-SEARCH" "1" "December 2011" "Chef 0.10.8" "Chef Manual"
|
5
5
|
.
|
6
6
|
.SH "NAME"
|
7
7
|
\fBknife\-search\fR \- Find objects on a Chef Server by query
|
@@ -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\-SSH" "1" "December 2011" "Chef 0.10.
|
4
|
+
.TH "KNIFE\-SSH" "1" "December 2011" "Chef 0.10.8" "Chef Manual"
|
5
5
|
.
|
6
6
|
.SH "NAME"
|
7
7
|
\fBknife\-ssh\fR \- Run a command or interactive session on multiple remote hosts
|
@@ -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\-STATUS" "1" "December 2011" "Chef 0.10.
|
4
|
+
.TH "KNIFE\-STATUS" "1" "December 2011" "Chef 0.10.8" "Chef Manual"
|
5
5
|
.
|
6
6
|
.SH "NAME"
|
7
7
|
\fBknife\-status\fR \- Display status information for the nodes in your infrastructure
|
@@ -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\-TAG" "1" "December 2011" "Chef 0.10.
|
4
|
+
.TH "KNIFE\-TAG" "1" "December 2011" "Chef 0.10.8" "Chef Manual"
|
5
5
|
.
|
6
6
|
.SH "NAME"
|
7
7
|
\fBknife\-tag\fR \- Apply tags to nodes on 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 "KNIFE" "1" "December 2011" "Chef 0.10.
|
4
|
+
.TH "KNIFE" "1" "December 2011" "Chef 0.10.8" "Chef Manual"
|
5
5
|
.
|
6
6
|
.SH "NAME"
|
7
7
|
\fBknife\fR \- Chef Server API client utility
|
@@ -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.
|
4
|
+
.TH "CHEF\-CLIENT" "8" "December 2011" "Chef 0.10.8" "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.
|
4
|
+
.TH "CHEF\-EXPANDER" "8" "December 2011" "Chef 0.10.8" "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.
|
4
|
+
.TH "CHEF\-EXPANDERCTL" "8" "December 2011" "Chef 0.10.8" "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.
|
4
|
+
.TH "CHEF\-SERVER\-WEBUI" "8" "December 2011" "Chef 0.10.8" "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.
|
4
|
+
.TH "CHEF\-SERVER" "8" "December 2011" "Chef 0.10.8" "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.
|
4
|
+
.TH "CHEF\-SOLO" "8" "December 2011" "Chef 0.10.8" "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.
|
4
|
+
.TH "CHEF\-SOLR" "8" "December 2011" "Chef 0.10.8" "Chef Manual"
|
5
5
|
.
|
6
6
|
.SH "NAME"
|
7
7
|
\fBchef\-solr\fR \- Runs as Chef\'s search server
|
@@ -42,6 +42,7 @@ class Chef
|
|
42
42
|
#
|
43
43
|
stdout_read, stdout_write = IO.pipe
|
44
44
|
stderr_read, stderr_write = IO.pipe
|
45
|
+
stdin_read, stdin_write = IO.pipe
|
45
46
|
open_streams = [ stdout_read, stderr_read ]
|
46
47
|
|
47
48
|
begin
|
@@ -55,7 +56,8 @@ class Chef
|
|
55
56
|
:command_line => command_line,
|
56
57
|
:startup_info => {
|
57
58
|
:stdout => stdout_write,
|
58
|
-
:stderr => stderr_write
|
59
|
+
:stderr => stderr_write,
|
60
|
+
:stdin => stdin_read
|
59
61
|
},
|
60
62
|
:environment => inherit_environment.map { |k,v| "#{k}=#{v}" },
|
61
63
|
:close_handles => false
|
@@ -152,13 +154,33 @@ class Chef
|
|
152
154
|
return true
|
153
155
|
end
|
154
156
|
|
155
|
-
|
157
|
+
IS_BATCH_FILE = /\.bat|\.cmd$/i
|
156
158
|
|
157
159
|
def command_to_run
|
158
|
-
if command =~
|
160
|
+
if command =~ /^\s*"(.*)"/
|
161
|
+
# If we have quotes, do an exact match
|
162
|
+
candidate = $1
|
163
|
+
else
|
164
|
+
# Otherwise check everything up to the first space
|
165
|
+
candidate = command[0,command.index(/\s/) || command.length].strip
|
166
|
+
end
|
167
|
+
|
168
|
+
# Don't do searching for empty commands. Let it fail when it runs.
|
169
|
+
if candidate.length == 0
|
170
|
+
return [ nil, command ]
|
171
|
+
end
|
172
|
+
|
173
|
+
# Check if the exe exists directly. Otherwise, search PATH.
|
174
|
+
exe = find_exe_at_location(candidate)
|
175
|
+
if exe.nil? && exe !~ /[\\\/]/
|
176
|
+
exe = which(command[0,command.index(/\s/) || command.length])
|
177
|
+
end
|
178
|
+
|
179
|
+
if exe.nil? || exe =~ IS_BATCH_FILE
|
180
|
+
# Batch files MUST use cmd; and if we couldn't find the command we're looking for, we assume it must be a cmd builtin.
|
159
181
|
[ ENV['COMSPEC'], "cmd /c #{command}" ]
|
160
182
|
else
|
161
|
-
[
|
183
|
+
[ exe, command ]
|
162
184
|
end
|
163
185
|
end
|
164
186
|
|
@@ -178,14 +200,23 @@ class Chef
|
|
178
200
|
result
|
179
201
|
end
|
180
202
|
|
203
|
+
def pathext
|
204
|
+
@pathext ||= ENV['PATHEXT'] ? ENV['PATHEXT'].split(';') + [''] : ['']
|
205
|
+
end
|
206
|
+
|
181
207
|
def which(cmd)
|
182
|
-
return cmd if File.executable? cmd
|
183
|
-
exts = ENV['PATHEXT'] ? ENV['PATHEXT'].split(';') + [''] : ['']
|
184
208
|
ENV['PATH'].split(File::PATH_SEPARATOR).each do |path|
|
185
|
-
|
186
|
-
|
187
|
-
|
188
|
-
|
209
|
+
exe = find_exe_at_location("#{path}/${cmd}")
|
210
|
+
return exe if exe
|
211
|
+
end
|
212
|
+
return nil
|
213
|
+
end
|
214
|
+
|
215
|
+
def find_exe_at_location(path)
|
216
|
+
return path if File.executable? path
|
217
|
+
pathext.each do |ext|
|
218
|
+
exe = "#{path}#{ext}"
|
219
|
+
return exe if File.executable? exe
|
189
220
|
end
|
190
221
|
return nil
|
191
222
|
end
|
@@ -213,7 +244,7 @@ module Process
|
|
213
244
|
unless args.kind_of?(Hash)
|
214
245
|
raise TypeError, 'Expecting hash-style keyword arguments'
|
215
246
|
end
|
216
|
-
|
247
|
+
|
217
248
|
valid_keys = %w/
|
218
249
|
app_name command_line inherit creation_flags cwd environment
|
219
250
|
startup_info thread_inherit process_inherit close_handles with_logon
|
@@ -231,8 +262,8 @@ module Process
|
|
231
262
|
'creation_flags' => 0,
|
232
263
|
'close_handles' => true
|
233
264
|
}
|
234
|
-
|
235
|
-
# Validate the keys, and convert symbols and case to lowercase strings.
|
265
|
+
|
266
|
+
# Validate the keys, and convert symbols and case to lowercase strings.
|
236
267
|
args.each{ |key, val|
|
237
268
|
key = key.to_s.downcase
|
238
269
|
unless valid_keys.include?(key)
|
@@ -240,9 +271,9 @@ module Process
|
|
240
271
|
end
|
241
272
|
hash[key] = val
|
242
273
|
}
|
243
|
-
|
274
|
+
|
244
275
|
si_hash = {}
|
245
|
-
|
276
|
+
|
246
277
|
# If the startup_info key is present, validate its subkeys
|
247
278
|
if hash['startup_info']
|
248
279
|
hash['startup_info'].each{ |key, val|
|
@@ -264,7 +295,7 @@ module Process
|
|
264
295
|
raise ArgumentError, 'command_line or app_name must be specified'
|
265
296
|
end
|
266
297
|
end
|
267
|
-
|
298
|
+
|
268
299
|
# The environment string should be passed as an array of A=B paths, or
|
269
300
|
# as a string of ';' separated paths.
|
270
301
|
if hash['environment']
|
@@ -312,7 +343,7 @@ module Process
|
|
312
343
|
else
|
313
344
|
handle = get_osfhandle(si_hash[io])
|
314
345
|
end
|
315
|
-
|
346
|
+
|
316
347
|
if handle == INVALID_HANDLE_VALUE
|
317
348
|
raise Error, get_last_error
|
318
349
|
end
|
@@ -326,14 +357,14 @@ module Process
|
|
326
357
|
)
|
327
358
|
|
328
359
|
raise Error, get_last_error unless bool
|
329
|
-
|
360
|
+
|
330
361
|
si_hash[io] = handle
|
331
362
|
si_hash['startf_flags'] ||= 0
|
332
363
|
si_hash['startf_flags'] |= STARTF_USESTDHANDLES
|
333
364
|
hash['inherit'] = true
|
334
365
|
end
|
335
366
|
}
|
336
|
-
|
367
|
+
|
337
368
|
# The bytes not covered here are reserved (null)
|
338
369
|
unless si_hash.empty?
|
339
370
|
startinfo[0,4] = [startinfo.size].pack('L')
|
@@ -350,7 +381,7 @@ module Process
|
|
350
381
|
startinfo[48,2] = [si_hash['sw_flags']].pack('S') if si_hash['sw_flags']
|
351
382
|
startinfo[56,4] = [si_hash['stdin']].pack('L') if si_hash['stdin']
|
352
383
|
startinfo[60,4] = [si_hash['stdout']].pack('L') if si_hash['stdout']
|
353
|
-
startinfo[64,4] = [si_hash['stderr']].pack('L') if si_hash['stderr']
|
384
|
+
startinfo[64,4] = [si_hash['stderr']].pack('L') if si_hash['stderr']
|
354
385
|
end
|
355
386
|
|
356
387
|
if hash['with_logon']
|
@@ -360,7 +391,7 @@ module Process
|
|
360
391
|
cmd = hash['command_line'].nil? ? nil : multi_to_wide(hash['command_line'])
|
361
392
|
cwd = multi_to_wide(hash['cwd'])
|
362
393
|
passwd = multi_to_wide(hash['password'])
|
363
|
-
|
394
|
+
|
364
395
|
hash['creation_flags'] |= CREATE_UNICODE_ENVIRONMENT
|
365
396
|
|
366
397
|
process_ran = CreateProcessWithLogonW(
|
@@ -376,7 +407,7 @@ module Process
|
|
376
407
|
startinfo, # Startup Info
|
377
408
|
procinfo # Process Info
|
378
409
|
)
|
379
|
-
else
|
410
|
+
else
|
380
411
|
process_ran = CreateProcess(
|
381
412
|
hash['app_name'], # App name
|
382
413
|
hash['command_line'], # Command line
|
@@ -389,21 +420,21 @@ module Process
|
|
389
420
|
startinfo, # Startup Info
|
390
421
|
procinfo # Process Info
|
391
422
|
)
|
392
|
-
end
|
423
|
+
end
|
393
424
|
|
394
425
|
# TODO: Close stdin, stdout and stderr handles in the si_hash unless
|
395
426
|
# they're pointing to one of the standard handles already. [Maybe]
|
396
427
|
if !process_ran
|
397
428
|
raise_last_error("CreateProcess()")
|
398
429
|
end
|
399
|
-
|
430
|
+
|
400
431
|
# Automatically close the process and thread handles in the
|
401
432
|
# PROCESS_INFORMATION struct unless explicitly told not to.
|
402
433
|
if hash['close_handles']
|
403
434
|
CloseHandle(procinfo[0,4].unpack('L').first)
|
404
435
|
CloseHandle(procinfo[4,4].unpack('L').first)
|
405
|
-
end
|
406
|
-
|
436
|
+
end
|
437
|
+
|
407
438
|
ProcessInfo.new(
|
408
439
|
procinfo[0,4].unpack('L').first, # hProcess
|
409
440
|
procinfo[4,4].unpack('L').first, # hThread
|
@@ -554,4 +585,4 @@ module Process
|
|
554
585
|
}
|
555
586
|
|
556
587
|
module_function :create
|
557
|
-
end
|
588
|
+
end
|