mixlib-shellout 2.4.2 → 2.4.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/mixlib/shellout/version.rb +1 -1
- metadata +3 -6
- data/README.md +0 -99
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4a77caa01ee050dc884322465862b5eaa2b197b78ebe07f3ac6a4e3526924ce8
|
4
|
+
data.tar.gz: d09b463bd4e2ce05d35a34df03684c4e033af823f54ab510804c648d018391d0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3f531586506e3461104c21931b216203e8e884549c5f069753bf6633882632b3a0330384d33a1c1b7fb1f628c9b4fefa0ec620ecd6929fec0630bbadc54f0c2c
|
7
|
+
data.tar.gz: ae952774568dc2d26bd382ed40056bc7544353eb70538161449cb7f704811ef09462b992a8cc83b4a8ff72131f6e4d9925f93a90326ed7f3ededa045f5439ca4
|
metadata
CHANGED
@@ -1,25 +1,22 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mixlib-shellout
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.4.
|
4
|
+
version: 2.4.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Chef Software Inc.
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-12-
|
11
|
+
date: 2018-12-12 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: Run external commands on Unix or Windows
|
14
14
|
email: info@chef.io
|
15
15
|
executables: []
|
16
16
|
extensions: []
|
17
|
-
extra_rdoc_files:
|
18
|
-
- README.md
|
19
|
-
- LICENSE
|
17
|
+
extra_rdoc_files: []
|
20
18
|
files:
|
21
19
|
- LICENSE
|
22
|
-
- README.md
|
23
20
|
- lib/mixlib/shellout.rb
|
24
21
|
- lib/mixlib/shellout/exceptions.rb
|
25
22
|
- lib/mixlib/shellout/unix.rb
|
data/README.md
DELETED
@@ -1,99 +0,0 @@
|
|
1
|
-
# Mixlib::ShellOut
|
2
|
-
[![Build Status Master](https://travis-ci.org/chef/mixlib-shellout.svg?branch=master)](https://travis-ci.org/chef/mixlib-shellout) [![Build Status Master](https://ci.appveyor.com/api/projects/status/github/chef/mixlib-shellout?branch=master&svg=true&passingText=master%20-%20Ok&pendingText=master%20-%20Pending&failingText=master%20-%20Failing)](https://ci.appveyor.com/project/Chef/mixlib-shellout/branch/master) [![Gem Version](https://badge.fury.io/rb/mixlib-shellout.svg)](https://badge.fury.io/rb/mixlib-shellout)
|
3
|
-
|
4
|
-
Provides a simplified interface to shelling out while still collecting both standard out and standard error and providing full control over environment, working directory, uid, gid, etc.
|
5
|
-
|
6
|
-
No means for passing input to the subprocess is provided.
|
7
|
-
|
8
|
-
## Example
|
9
|
-
### Simple Shellout
|
10
|
-
Invoke find(1) to search for .rb files:
|
11
|
-
|
12
|
-
```ruby
|
13
|
-
require 'mixlib/shellout'
|
14
|
-
find = Mixlib::ShellOut.new("find . -name '*.rb'")
|
15
|
-
find.run_command
|
16
|
-
```
|
17
|
-
|
18
|
-
If all went well, the results are on `stdout`
|
19
|
-
|
20
|
-
```ruby
|
21
|
-
puts find.stdout
|
22
|
-
```
|
23
|
-
|
24
|
-
`find(1)` prints diagnostic info to STDERR:
|
25
|
-
|
26
|
-
```ruby
|
27
|
-
puts "error messages" + find.stderr
|
28
|
-
```
|
29
|
-
|
30
|
-
Raise an exception if it didn't exit with 0
|
31
|
-
|
32
|
-
```ruby
|
33
|
-
find.error!
|
34
|
-
```
|
35
|
-
|
36
|
-
### Advanced Shellout
|
37
|
-
In addition to the command to run there are other options that can be set to change the shellout behavior. The complete list of options can be found here: https://github.com/chef/mixlib-shellout/blob/master/lib/mixlib/shellout.rb
|
38
|
-
|
39
|
-
Run a command as the `www` user with no extra ENV settings from `/tmp` with a 1s timeout
|
40
|
-
|
41
|
-
```ruby
|
42
|
-
cmd = Mixlib::ShellOut.new("apachectl", "start", :user => 'www', :env => nil, :cwd => '/tmp', :timeout => 1)
|
43
|
-
cmd.run_command # etc.
|
44
|
-
```
|
45
|
-
|
46
|
-
### STDIN Example
|
47
|
-
Invoke crontab to edit user cron:
|
48
|
-
|
49
|
-
```ruby
|
50
|
-
# :input only supports simple strings
|
51
|
-
crontab_lines = [ "* * * * * /bin/true", "* * * * * touch /tmp/here" ]
|
52
|
-
crontab = Mixlib::ShellOut.new("crontab -l -u #{@new_resource.user}", :input => crontab_lines.join("\n"))
|
53
|
-
crontab.run_command
|
54
|
-
```
|
55
|
-
|
56
|
-
### Windows Impersonation Example
|
57
|
-
Invoke "whoami.exe" to demonstrate running a command as another user:
|
58
|
-
|
59
|
-
```ruby
|
60
|
-
whoami = Mixlib::ShellOut.new("whoami.exe", :user => "username", :domain => "DOMAIN", :password => "password")
|
61
|
-
whoami.run_command
|
62
|
-
```
|
63
|
-
|
64
|
-
Invoke "whoami.exe" with elevated privileges:
|
65
|
-
|
66
|
-
```ruby
|
67
|
-
whoami = Mixlib::ShellOut.new("whoami.exe", :user => "username", :domain => "DOMAIN", :password => "password", :elevated => true)
|
68
|
-
whoami.run_command
|
69
|
-
```
|
70
|
-
**NOTE:** The user 'admin' must have the 'Log on as a batch job' permission and the user chef is running as must have the 'Replace a process level token' and 'Adjust Memory Quotas for a process' permissions.
|
71
|
-
|
72
|
-
## Platform Support
|
73
|
-
Mixlib::ShellOut does a standard fork/exec on Unix, and uses the Win32 API on Windows. There is not currently support for JRuby.
|
74
|
-
|
75
|
-
## See Also
|
76
|
-
- `Process.spawn` in Ruby 1.9+
|
77
|
-
- [https://github.com/rtomayko/posix-spawn](https://github.com/rtomayko/posix-spawn)
|
78
|
-
|
79
|
-
## Contributing
|
80
|
-
|
81
|
-
For information on contributing to this project see <https://github.com/chef/chef/blob/master/CONTRIBUTING.md>
|
82
|
-
|
83
|
-
## License
|
84
|
-
- Copyright:: Copyright (c) 2011-2016 Chef Software, Inc.
|
85
|
-
- License:: Apache License, Version 2.0
|
86
|
-
|
87
|
-
```text
|
88
|
-
Licensed under the Apache License, Version 2.0 (the "License");
|
89
|
-
you may not use this file except in compliance with the License.
|
90
|
-
You may obtain a copy of the License at
|
91
|
-
|
92
|
-
http://www.apache.org/licenses/LICENSE-2.0
|
93
|
-
|
94
|
-
Unless required by applicable law or agreed to in writing, software
|
95
|
-
distributed under the License is distributed on an "AS IS" BASIS,
|
96
|
-
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
97
|
-
See the License for the specific language governing permissions and
|
98
|
-
limitations under the License.
|
99
|
-
```
|