diff options
author | Pete Higgins <pete@peterhiggins.org> | 2020-05-22 17:26:56 -0700 |
---|---|---|
committer | Pete Higgins <pete@peterhiggins.org> | 2020-05-26 11:27:07 -0700 |
commit | b357899959c07932e233522968590da9d3b8aa30 (patch) | |
tree | 176088523eef25d856672748174d14c8d5d791ab | |
parent | 82c48299a27b46a8f0d68260cd93adca002cbb01 (diff) | |
download | chef-b357899959c07932e233522968590da9d3b8aa30.tar.gz |
Add an input property to the execute resource for passing input on STDIN.
Signed-off-by: Pete Higgins <pete@peterhiggins.org>
-rw-r--r-- | lib/chef/provider/execute.rb | 3 | ||||
-rw-r--r-- | lib/chef/resource/execute.rb | 4 |
2 files changed, 6 insertions, 1 deletions
diff --git a/lib/chef/provider/execute.rb b/lib/chef/provider/execute.rb index 4ae1e794fc..20b8a40bf1 100644 --- a/lib/chef/provider/execute.rb +++ b/lib/chef/provider/execute.rb @@ -27,7 +27,7 @@ class Chef provides :execute, target_mode: true - def_delegators :new_resource, :command, :returns, :environment, :user, :domain, :password, :group, :cwd, :umask, :creates, :elevated, :default_env, :timeout + def_delegators :new_resource, :command, :returns, :environment, :user, :domain, :password, :group, :cwd, :umask, :creates, :elevated, :default_env, :timeout, :input def load_current_resource current_resource = Chef::Resource::Execute.new(new_resource.name) @@ -91,6 +91,7 @@ class Chef opts[:group] = group if group opts[:cwd] = cwd if cwd opts[:umask] = umask if umask + opts[:input] = input if input opts[:default_env] = default_env opts[:log_level] = :info opts[:log_tag] = new_resource.to_s diff --git a/lib/chef/resource/execute.rb b/lib/chef/resource/execute.rb index 5a6b7ee960..38329a0bb5 100644 --- a/lib/chef/resource/execute.rb +++ b/lib/chef/resource/execute.rb @@ -103,6 +103,10 @@ class Chef description: "Determines whether the script will run with elevated permissions to circumvent User Access Control (UAC) interactively blocking the process.\nThis will cause the process to be run under a batch login instead of an interactive login. The user running #{Chef::Dist::CLIENT} needs the 'Replace a process level token' and 'Adjust Memory Quotas for a process' permissions. The user that is running the command needs the 'Log on as a batch job' permission.\nBecause this requires a login, the user and password properties are required.", introduced: "13.3" + property :input, [String, nil], + introduced: "16.1", + description: "An optional property to set the input sent to the command as STDIN." + alias :env :environment def self.set_guard_inherited_attributes(*inherited_attributes) |