diff options
author | Gary Ewan Park <gep13@gep13.co.uk> | 2021-10-11 10:34:01 +0100 |
---|---|---|
committer | Gary Ewan Park <gep13@gep13.co.uk> | 2021-10-11 21:40:40 +0100 |
commit | a457da508900c814ecfefd2af99fe90ab336cb37 (patch) | |
tree | 028f34d88f0f08d1e967854d59085c208667a952 /lib | |
parent | 93f86e8a76b8dc9e0aa971e10bf9bf78d5114d8a (diff) | |
download | chef-a457da508900c814ecfefd2af99fe90ab336cb37.tar.gz |
(#12158) Add new properties to chocolatey_source
These properties allow the creation of authenticated sources using
either a username/password or certificate/password combination.
Signed-off-by: Gary Ewan Park <gep13@gep13.co.uk>
Co-authored-by: AdmiringWorm <kim@chocolatey.io>
Diffstat (limited to 'lib')
-rw-r--r-- | lib/chef/resource/chocolatey_source.rb | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/lib/chef/resource/chocolatey_source.rb b/lib/chef/resource/chocolatey_source.rb index e3b35074e3..a30d92284c 100644 --- a/lib/chef/resource/chocolatey_source.rb +++ b/lib/chef/resource/chocolatey_source.rb @@ -63,6 +63,22 @@ class Chef property :disabled, [TrueClass, FalseClass], default: false, desired_state: false, skip_docs: true + property :username, String, + description: "The username to use when authenticating against the source", + introduced: "17.7" + + property :password, String, sensitive: true, desired_state: false, + description: "The password to use when authenticating against the source", + introduced: "17.7" + + property :cert, String, + description: "The certificate to use when authenticating against the source", + introduced: "17.7" + + property :cert_password, String, sensitive: true, desired_state: false, + description: "The password for the certificate to use when authenticating against the source", + introduced: "17.7" + load_current_value do element = fetch_source_element(source_name) current_value_does_not_exist! if element.nil? @@ -74,6 +90,8 @@ class Chef allow_self_service element["selfService"] == "true" priority element["priority"].to_i disabled element["disabled"] == "true" + username element["user"] + cert element["certificate"] end # @param [String] id the source name @@ -133,6 +151,10 @@ class Chef cmd << " --bypassproxy" if new_resource.bypass_proxy cmd << " --allowselfservice" if new_resource.allow_self_service cmd << " --adminonly" if new_resource.admin_only + cmd << " --user=\"#{new_resource.username}\"" if new_resource.username + cmd << " --password=\"#{new_resource.password}\"" if new_resource.password + cmd << " --cert=\"#{new_resource.cert}\"" if new_resource.cert + cmd << " --certpassword=\"#{new_resource.cert_password}\"" if new_resource.cert_password end cmd end |