summaryrefslogtreecommitdiff
path: root/lib/chef/knife
diff options
context:
space:
mode:
authorLamont Granquist <lamont@scriptkiddie.org>2018-07-02 10:25:16 -0700
committerLamont Granquist <lamont@scriptkiddie.org>2018-07-02 10:25:16 -0700
commit35603c7ce1bd3ccf35334ed65152140f0ecaf080 (patch)
tree452c84ce196ce00d672c71a8fa65f86c5a074fac /lib/chef/knife
parenteda2808dce8146bfdb308dd658b1dd565df3562b (diff)
downloadchef-35603c7ce1bd3ccf35334ed65152140f0ecaf080.tar.gz
fix Style/HashSyntax
Signed-off-by: Lamont Granquist <lamont@scriptkiddie.org>
Diffstat (limited to 'lib/chef/knife')
-rw-r--r--lib/chef/knife/bootstrap.rb232
-rw-r--r--lib/chef/knife/bootstrap/client_builder.rb2
-rw-r--r--lib/chef/knife/client_bulk_delete.rb6
-rw-r--r--lib/chef/knife/client_create.rb34
-rw-r--r--lib/chef/knife/client_delete.rb6
-rw-r--r--lib/chef/knife/client_list.rb6
-rw-r--r--lib/chef/knife/client_reregister.rb6
-rw-r--r--lib/chef/knife/configure.rb40
-rw-r--r--lib/chef/knife/cookbook_bulk_delete.rb2
-rw-r--r--lib/chef/knife/cookbook_delete.rb4
-rw-r--r--lib/chef/knife/cookbook_download.rb22
-rw-r--r--lib/chef/knife/cookbook_list.rb12
-rw-r--r--lib/chef/knife/cookbook_metadata.rb14
-rw-r--r--lib/chef/knife/cookbook_show.rb24
-rw-r--r--lib/chef/knife/cookbook_site_download.rb20
-rw-r--r--lib/chef/knife/cookbook_site_install.rb46
-rw-r--r--lib/chef/knife/cookbook_site_list.rb16
-rw-r--r--lib/chef/knife/cookbook_site_search.rb10
-rw-r--r--lib/chef/knife/cookbook_site_share.rb36
-rw-r--r--lib/chef/knife/cookbook_site_show.rb10
-rw-r--r--lib/chef/knife/cookbook_site_unshare.rb10
-rw-r--r--lib/chef/knife/cookbook_test.rb14
-rw-r--r--lib/chef/knife/cookbook_upload.rb50
-rw-r--r--lib/chef/knife/core/bootstrap_context.rb2
-rw-r--r--lib/chef/knife/core/cookbook_scm_repo.rb2
-rw-r--r--lib/chef/knife/core/generic_presenter.rb14
-rw-r--r--lib/chef/knife/core/node_presenter.rb20
-rw-r--r--lib/chef/knife/core/status_presenter.rb20
-rw-r--r--lib/chef/knife/data_bag_from_file.rb6
-rw-r--r--lib/chef/knife/data_bag_list.rb6
-rw-r--r--lib/chef/knife/data_bag_secret_options.rb22
-rw-r--r--lib/chef/knife/delete.rb26
-rw-r--r--lib/chef/knife/deps.rb18
-rw-r--r--lib/chef/knife/diff.rb28
-rw-r--r--lib/chef/knife/download.rb46
-rw-r--r--lib/chef/knife/edit.rb6
-rw-r--r--lib/chef/knife/environment_compare.rb16
-rw-r--r--lib/chef/knife/environment_create.rb6
-rw-r--r--lib/chef/knife/environment_from_file.rb6
-rw-r--r--lib/chef/knife/environment_list.rb6
-rw-r--r--lib/chef/knife/exec.rb14
-rw-r--r--lib/chef/knife/key_create_base.rb24
-rw-r--r--lib/chef/knife/key_edit_base.rb30
-rw-r--r--lib/chef/knife/key_list_base.rb18
-rw-r--r--lib/chef/knife/list.rb38
-rw-r--r--lib/chef/knife/node_edit.rb8
-rw-r--r--lib/chef/knife/node_list.rb6
-rw-r--r--lib/chef/knife/node_run_list_add.rb12
-rw-r--r--lib/chef/knife/node_show.rb12
-rw-r--r--lib/chef/knife/osc_user_create.rb26
-rw-r--r--lib/chef/knife/osc_user_list.rb6
-rw-r--r--lib/chef/knife/osc_user_reregister.rb6
-rw-r--r--lib/chef/knife/raw.rb32
-rw-r--r--lib/chef/knife/role_create.rb6
-rw-r--r--lib/chef/knife/role_env_run_list_add.rb6
-rw-r--r--lib/chef/knife/role_list.rb6
-rw-r--r--lib/chef/knife/role_run_list_add.rb6
-rw-r--r--lib/chef/knife/search.rb46
-rw-r--r--lib/chef/knife/serve.rb12
-rw-r--r--lib/chef/knife/show.rb6
-rw-r--r--lib/chef/knife/ssh.rb130
-rw-r--r--lib/chef/knife/status.rb22
-rw-r--r--lib/chef/knife/upload.rb50
-rw-r--r--lib/chef/knife/user_create.rb34
-rw-r--r--lib/chef/knife/user_list.rb6
-rw-r--r--lib/chef/knife/user_reregister.rb6
-rw-r--r--lib/chef/knife/xargs.rb72
67 files changed, 756 insertions, 756 deletions
diff --git a/lib/chef/knife/bootstrap.rb b/lib/chef/knife/bootstrap.rb
index 15d0f1be18..797080abe3 100644
--- a/lib/chef/knife/bootstrap.rb
+++ b/lib/chef/knife/bootstrap.rb
@@ -45,180 +45,180 @@ class Chef
banner "knife bootstrap [SSH_USER@]FQDN (options)"
option :ssh_user,
- :short => "-x USERNAME",
- :long => "--ssh-user USERNAME",
- :description => "The ssh username",
- :default => "root"
+ short: "-x USERNAME",
+ long: "--ssh-user USERNAME",
+ description: "The ssh username",
+ default: "root"
option :ssh_password,
- :short => "-P PASSWORD",
- :long => "--ssh-password PASSWORD",
- :description => "The ssh password"
+ short: "-P PASSWORD",
+ long: "--ssh-password PASSWORD",
+ description: "The ssh password"
option :ssh_port,
- :short => "-p PORT",
- :long => "--ssh-port PORT",
- :description => "The ssh port",
- :proc => Proc.new { |key| Chef::Config[:knife][:ssh_port] = key }
+ short: "-p PORT",
+ long: "--ssh-port PORT",
+ description: "The ssh port",
+ proc: Proc.new { |key| Chef::Config[:knife][:ssh_port] = key }
option :ssh_gateway,
- :short => "-G GATEWAY",
- :long => "--ssh-gateway GATEWAY",
- :description => "The ssh gateway",
- :proc => Proc.new { |key| Chef::Config[:knife][:ssh_gateway] = key }
+ short: "-G GATEWAY",
+ long: "--ssh-gateway GATEWAY",
+ description: "The ssh gateway",
+ proc: Proc.new { |key| Chef::Config[:knife][:ssh_gateway] = key }
option :ssh_gateway_identity,
- :long => "--ssh-gateway-identity SSH_GATEWAY_IDENTITY",
- :description => "The SSH identity file used for gateway authentication",
- :proc => Proc.new { |key| Chef::Config[:knife][:ssh_gateway_identity] = key }
+ long: "--ssh-gateway-identity SSH_GATEWAY_IDENTITY",
+ description: "The SSH identity file used for gateway authentication",
+ proc: Proc.new { |key| Chef::Config[:knife][:ssh_gateway_identity] = key }
option :forward_agent,
- :short => "-A",
- :long => "--forward-agent",
- :description => "Enable SSH agent forwarding",
- :boolean => true
+ short: "-A",
+ long: "--forward-agent",
+ description: "Enable SSH agent forwarding",
+ boolean: true
option :identity_file,
- :long => "--identity-file IDENTITY_FILE",
- :description => "The SSH identity file used for authentication. [DEPRECATED] Use --ssh-identity-file instead."
+ long: "--identity-file IDENTITY_FILE",
+ description: "The SSH identity file used for authentication. [DEPRECATED] Use --ssh-identity-file instead."
option :ssh_identity_file,
- :short => "-i IDENTITY_FILE",
- :long => "--ssh-identity-file IDENTITY_FILE",
- :description => "The SSH identity file used for authentication"
+ short: "-i IDENTITY_FILE",
+ long: "--ssh-identity-file IDENTITY_FILE",
+ description: "The SSH identity file used for authentication"
option :chef_node_name,
- :short => "-N NAME",
- :long => "--node-name NAME",
- :description => "The Chef node name for your new node"
+ short: "-N NAME",
+ long: "--node-name NAME",
+ description: "The Chef node name for your new node"
option :prerelease,
- :long => "--prerelease",
- :description => "Install the pre-release chef gems"
+ long: "--prerelease",
+ description: "Install the pre-release chef gems"
option :bootstrap_version,
- :long => "--bootstrap-version VERSION",
- :description => "The version of Chef to install",
- :proc => lambda { |v| Chef::Config[:knife][:bootstrap_version] = v }
+ long: "--bootstrap-version VERSION",
+ description: "The version of Chef to install",
+ proc: lambda { |v| Chef::Config[:knife][:bootstrap_version] = v }
option :bootstrap_proxy,
- :long => "--bootstrap-proxy PROXY_URL",
- :description => "The proxy server for the node being bootstrapped",
- :proc => Proc.new { |p| Chef::Config[:knife][:bootstrap_proxy] = p }
+ long: "--bootstrap-proxy PROXY_URL",
+ description: "The proxy server for the node being bootstrapped",
+ proc: Proc.new { |p| Chef::Config[:knife][:bootstrap_proxy] = p }
option :bootstrap_proxy_user,
- :long => "--bootstrap-proxy-user PROXY_USER",
- :description => "The proxy authentication username for the node being bootstrapped"
+ long: "--bootstrap-proxy-user PROXY_USER",
+ description: "The proxy authentication username for the node being bootstrapped"
option :bootstrap_proxy_pass,
- :long => "--bootstrap-proxy-pass PROXY_PASS",
- :description => "The proxy authentication password for the node being bootstrapped"
+ long: "--bootstrap-proxy-pass PROXY_PASS",
+ description: "The proxy authentication password for the node being bootstrapped"
option :bootstrap_no_proxy,
- :long => "--bootstrap-no-proxy [NO_PROXY_URL|NO_PROXY_IP]",
- :description => "Do not proxy locations for the node being bootstrapped; this option is used internally by Opscode",
- :proc => Proc.new { |np| Chef::Config[:knife][:bootstrap_no_proxy] = np }
+ long: "--bootstrap-no-proxy [NO_PROXY_URL|NO_PROXY_IP]",
+ description: "Do not proxy locations for the node being bootstrapped; this option is used internally by Opscode",
+ proc: Proc.new { |np| Chef::Config[:knife][:bootstrap_no_proxy] = np }
option :bootstrap_template,
- :short => "-t TEMPLATE",
- :long => "--bootstrap-template TEMPLATE",
- :description => "Bootstrap Chef using a built-in or custom template. Set to the full path of an erb template or use one of the built-in templates."
+ short: "-t TEMPLATE",
+ long: "--bootstrap-template TEMPLATE",
+ description: "Bootstrap Chef using a built-in or custom template. Set to the full path of an erb template or use one of the built-in templates."
option :use_sudo,
- :long => "--sudo",
- :description => "Execute the bootstrap via sudo",
- :boolean => true
+ long: "--sudo",
+ description: "Execute the bootstrap via sudo",
+ boolean: true
option :preserve_home,
- :long => "--sudo-preserve-home",
- :description => "Preserve non-root user HOME environment variable with sudo",
- :boolean => true
+ long: "--sudo-preserve-home",
+ description: "Preserve non-root user HOME environment variable with sudo",
+ boolean: true
option :use_sudo_password,
- :long => "--use-sudo-password",
- :description => "Execute the bootstrap via sudo with password",
- :boolean => false
+ long: "--use-sudo-password",
+ description: "Execute the bootstrap via sudo with password",
+ boolean: false
option :run_list,
- :short => "-r RUN_LIST",
- :long => "--run-list RUN_LIST",
- :description => "Comma separated list of roles/recipes to apply",
- :proc => lambda { |o| o.split(/[\s,]+/) },
- :default => []
+ short: "-r RUN_LIST",
+ long: "--run-list RUN_LIST",
+ description: "Comma separated list of roles/recipes to apply",
+ proc: lambda { |o| o.split(/[\s,]+/) },
+ default: []
option :policy_name,
- :long => "--policy-name POLICY_NAME",
- :description => "Policyfile name to use (--policy-group must also be given)",
- :default => nil
+ long: "--policy-name POLICY_NAME",
+ description: "Policyfile name to use (--policy-group must also be given)",
+ default: nil
option :policy_group,
- :long => "--policy-group POLICY_GROUP",
- :description => "Policy group name to use (--policy-name must also be given)",
- :default => nil
+ long: "--policy-group POLICY_GROUP",
+ description: "Policy group name to use (--policy-name must also be given)",
+ default: nil
option :tags,
- :long => "--tags TAGS",
- :description => "Comma separated list of tags to apply to the node",
- :proc => lambda { |o| o.split(/[\s,]+/) },
- :default => []
+ long: "--tags TAGS",
+ description: "Comma separated list of tags to apply to the node",
+ proc: lambda { |o| o.split(/[\s,]+/) },
+ default: []
option :first_boot_attributes,
- :short => "-j JSON_ATTRIBS",
- :long => "--json-attributes",
- :description => "A JSON string to be added to the first run of chef-client",
- :proc => lambda { |o| Chef::JSONCompat.parse(o) },
- :default => nil
+ short: "-j JSON_ATTRIBS",
+ long: "--json-attributes",
+ description: "A JSON string to be added to the first run of chef-client",
+ proc: lambda { |o| Chef::JSONCompat.parse(o) },
+ default: nil
option :first_boot_attributes_from_file,
- :long => "--json-attribute-file FILE",
- :description => "A JSON file to be used to the first run of chef-client",
- :proc => lambda { |o| Chef::JSONCompat.parse(File.read(o)) },
- :default => nil
+ long: "--json-attribute-file FILE",
+ description: "A JSON file to be used to the first run of chef-client",
+ proc: lambda { |o| Chef::JSONCompat.parse(File.read(o)) },
+ default: nil
option :host_key_verify,
- :long => "--[no-]host-key-verify",
- :description => "Verify host key, enabled by default.",
- :boolean => true,
- :default => true
+ long: "--[no-]host-key-verify",
+ description: "Verify host key, enabled by default.",
+ boolean: true,
+ default: true
option :hint,
- :long => "--hint HINT_NAME[=HINT_FILE]",
- :description => "Specify Ohai Hint to be set on the bootstrap target. Use multiple --hint options to specify multiple hints.",
- :proc => Proc.new { |h|
+ long: "--hint HINT_NAME[=HINT_FILE]",
+ description: "Specify Ohai Hint to be set on the bootstrap target. Use multiple --hint options to specify multiple hints.",
+ proc: Proc.new { |h|
Chef::Config[:knife][:hints] ||= Hash.new
name, path = h.split("=")
Chef::Config[:knife][:hints][name] = path ? Chef::JSONCompat.parse(::File.read(path)) : Hash.new
}
option :bootstrap_url,
- :long => "--bootstrap-url URL",
- :description => "URL to a custom installation script",
- :proc => Proc.new { |u| Chef::Config[:knife][:bootstrap_url] = u }
+ long: "--bootstrap-url URL",
+ description: "URL to a custom installation script",
+ proc: Proc.new { |u| Chef::Config[:knife][:bootstrap_url] = u }
option :bootstrap_install_command,
- :long => "--bootstrap-install-command COMMANDS",
- :description => "Custom command to install chef-client",
- :proc => Proc.new { |ic| Chef::Config[:knife][:bootstrap_install_command] = ic }
+ long: "--bootstrap-install-command COMMANDS",
+ description: "Custom command to install chef-client",
+ proc: Proc.new { |ic| Chef::Config[:knife][:bootstrap_install_command] = ic }
option :bootstrap_preinstall_command,
- :long => "--bootstrap-preinstall-command COMMANDS",
- :description => "Custom commands to run before installing chef-client",
- :proc => Proc.new { |preic| Chef::Config[:knife][:bootstrap_preinstall_command] = preic }
+ long: "--bootstrap-preinstall-command COMMANDS",
+ description: "Custom commands to run before installing chef-client",
+ proc: Proc.new { |preic| Chef::Config[:knife][:bootstrap_preinstall_command] = preic }
option :bootstrap_wget_options,
- :long => "--bootstrap-wget-options OPTIONS",
- :description => "Add options to wget when installing chef-client",
- :proc => Proc.new { |wo| Chef::Config[:knife][:bootstrap_wget_options] = wo }
+ long: "--bootstrap-wget-options OPTIONS",
+ description: "Add options to wget when installing chef-client",
+ proc: Proc.new { |wo| Chef::Config[:knife][:bootstrap_wget_options] = wo }
option :bootstrap_curl_options,
- :long => "--bootstrap-curl-options OPTIONS",
- :description => "Add options to curl when install chef-client",
- :proc => Proc.new { |co| Chef::Config[:knife][:bootstrap_curl_options] = co }
+ long: "--bootstrap-curl-options OPTIONS",
+ description: "Add options to curl when install chef-client",
+ proc: Proc.new { |co| Chef::Config[:knife][:bootstrap_curl_options] = co }
option :node_ssl_verify_mode,
- :long => "--node-ssl-verify-mode [peer|none]",
- :description => "Whether or not to verify the SSL cert for all HTTPS requests.",
- :proc => Proc.new { |v|
+ long: "--node-ssl-verify-mode [peer|none]",
+ description: "Whether or not to verify the SSL cert for all HTTPS requests.",
+ proc: Proc.new { |v|
valid_values = %w{none peer}
unless valid_values.include?(v)
raise "Invalid value '#{v}' for --node-ssl-verify-mode. Valid values are: #{valid_values.join(", ")}"
@@ -227,22 +227,22 @@ class Chef
}
option :node_verify_api_cert,
- :long => "--[no-]node-verify-api-cert",
- :description => "Verify the SSL cert for HTTPS requests to the Chef server API.",
- :boolean => true
+ long: "--[no-]node-verify-api-cert",
+ description: "Verify the SSL cert for HTTPS requests to the Chef server API.",
+ boolean: true
option :bootstrap_vault_file,
- :long => "--bootstrap-vault-file VAULT_FILE",
- :description => "A JSON file with a list of vault(s) and item(s) to be updated"
+ long: "--bootstrap-vault-file VAULT_FILE",
+ description: "A JSON file with a list of vault(s) and item(s) to be updated"
option :bootstrap_vault_json,
- :long => "--bootstrap-vault-json VAULT_JSON",
- :description => "A JSON string with the vault(s) and item(s) to be updated"
+ long: "--bootstrap-vault-json VAULT_JSON",
+ description: "A JSON string with the vault(s) and item(s) to be updated"
option :bootstrap_vault_item,
- :long => "--bootstrap-vault-item VAULT_ITEM",
- :description => 'A single vault and item to update as "vault:item"',
- :proc => Proc.new { |i|
+ long: "--bootstrap-vault-item VAULT_ITEM",
+ description: 'A single vault and item to update as "vault:item"',
+ proc: Proc.new { |i|
(vault, item) = i.split(/:/)
Chef::Config[:knife][:bootstrap_vault_item] ||= {}
Chef::Config[:knife][:bootstrap_vault_item][vault] ||= []
diff --git a/lib/chef/knife/bootstrap/client_builder.rb b/lib/chef/knife/bootstrap/client_builder.rb
index cab33cd811..f5c49ab620 100644
--- a/lib/chef/knife/bootstrap/client_builder.rb
+++ b/lib/chef/knife/bootstrap/client_builder.rb
@@ -194,7 +194,7 @@ class Chef
# @return [Chef::ServerAPI] REST client using the client credentials
def client_rest
- @client_rest ||= Chef::ServerAPI.new(chef_server_url, :client_name => node_name, :signing_key_filename => client_path)
+ @client_rest ||= Chef::ServerAPI.new(chef_server_url, client_name: node_name, signing_key_filename: client_path)
end
# @return [Chef::ServerAPI] REST client using the cli user's knife credentials
diff --git a/lib/chef/knife/client_bulk_delete.rb b/lib/chef/knife/client_bulk_delete.rb
index a7fa7142c8..a5fe94681d 100644
--- a/lib/chef/knife/client_bulk_delete.rb
+++ b/lib/chef/knife/client_bulk_delete.rb
@@ -28,9 +28,9 @@ class Chef
end
option :delete_validators,
- :short => "-D",
- :long => "--delete-validators",
- :description => "Force deletion of clients if they're validators"
+ short: "-D",
+ long: "--delete-validators",
+ description: "Force deletion of clients if they're validators"
banner "knife client bulk delete REGEX (options)"
diff --git a/lib/chef/knife/client_create.rb b/lib/chef/knife/client_create.rb
index e28378cd4a..b821a8a56b 100644
--- a/lib/chef/knife/client_create.rb
+++ b/lib/chef/knife/client_create.rb
@@ -28,31 +28,31 @@ class Chef
end
option :file,
- :short => "-f FILE",
- :long => "--file FILE",
- :description => "Write the private key to a file if the server generated one."
+ short: "-f FILE",
+ long: "--file FILE",
+ description: "Write the private key to a file if the server generated one."
option :admin,
- :short => "-a",
- :long => "--admin",
- :description => "Open Source Chef Server 11 only. Create the client as an admin.",
- :boolean => true
+ short: "-a",
+ long: "--admin",
+ description: "Open Source Chef Server 11 only. Create the client as an admin.",
+ boolean: true
option :validator,
- :long => "--validator",
- :description => "Create the client as a validator.",
- :boolean => true
+ long: "--validator",
+ description: "Create the client as a validator.",
+ boolean: true
option :public_key,
- :short => "-p FILE",
- :long => "--public-key",
- :description => "Set the initial default key for the client from a file on disk (cannot pass with --prevent-keygen)."
+ short: "-p FILE",
+ long: "--public-key",
+ description: "Set the initial default key for the client from a file on disk (cannot pass with --prevent-keygen)."
option :prevent_keygen,
- :short => "-k",
- :long => "--prevent-keygen",
- :description => "API V1 (Chef Server 12.1+) only. Prevent server from generating a default key pair for you. Cannot be passed with --public-key.",
- :boolean => true
+ short: "-k",
+ long: "--prevent-keygen",
+ description: "API V1 (Chef Server 12.1+) only. Prevent server from generating a default key pair for you. Cannot be passed with --public-key.",
+ boolean: true
banner "knife client create CLIENTNAME (options)"
diff --git a/lib/chef/knife/client_delete.rb b/lib/chef/knife/client_delete.rb
index 82b521c7d1..a043b6f731 100644
--- a/lib/chef/knife/client_delete.rb
+++ b/lib/chef/knife/client_delete.rb
@@ -28,9 +28,9 @@ class Chef
end
option :delete_validators,
- :short => "-D",
- :long => "--delete-validators",
- :description => "Force deletion of client if it's a validator"
+ short: "-D",
+ long: "--delete-validators",
+ description: "Force deletion of client if it's a validator"
banner "knife client delete [CLIENT [CLIENT]] (options)"
diff --git a/lib/chef/knife/client_list.rb b/lib/chef/knife/client_list.rb
index b17de0f3ad..794d8c9411 100644
--- a/lib/chef/knife/client_list.rb
+++ b/lib/chef/knife/client_list.rb
@@ -30,9 +30,9 @@ class Chef
banner "knife client list (options)"
option :with_uri,
- :short => "-w",
- :long => "--with-uri",
- :description => "Show corresponding URIs"
+ short: "-w",
+ long: "--with-uri",
+ description: "Show corresponding URIs"
def run
output(format_list_for_display(Chef::ApiClientV1.list))
diff --git a/lib/chef/knife/client_reregister.rb b/lib/chef/knife/client_reregister.rb
index cc2b218e87..ce34884803 100644
--- a/lib/chef/knife/client_reregister.rb
+++ b/lib/chef/knife/client_reregister.rb
@@ -30,9 +30,9 @@ class Chef
banner "knife client reregister CLIENT (options)"
option :file,
- :short => "-f FILE",
- :long => "--file FILE",
- :description => "Write the key to a file"
+ short: "-f FILE",
+ long: "--file FILE",
+ description: "Write the key to a file"
def run
@client_name = @name_args[0]
diff --git a/lib/chef/knife/configure.rb b/lib/chef/knife/configure.rb
index df021826ae..fb2954c982 100644
--- a/lib/chef/knife/configure.rb
+++ b/lib/chef/knife/configure.rb
@@ -34,31 +34,31 @@ class Chef
banner "knife configure (options)"
option :repository,
- :short => "-r REPO",
- :long => "--repository REPO",
- :description => "The path to the chef-repo"
+ short: "-r REPO",
+ long: "--repository REPO",
+ description: "The path to the chef-repo"
option :initial,
- :short => "-i",
- :long => "--initial",
- :boolean => true,
- :description => "Use to create a API client, typically an administrator client on a freshly-installed server"
+ short: "-i",
+ long: "--initial",
+ boolean: true,
+ description: "Use to create a API client, typically an administrator client on a freshly-installed server"
option :admin_client_name,
- :long => "--admin-client-name NAME",
- :description => "The name of the client, typically the name of the admin client"
+ long: "--admin-client-name NAME",
+ description: "The name of the client, typically the name of the admin client"
option :admin_client_key,
- :long => "--admin-client-key PATH",
- :description => "The path to the private key used by the client, typically a file named admin.pem"
+ long: "--admin-client-key PATH",
+ description: "The path to the private key used by the client, typically a file named admin.pem"
option :validation_client_name,
- :long => "--validation-client-name NAME",
- :description => "The name of the validation client, typically a client named chef-validator"
+ long: "--validation-client-name NAME",
+ description: "The name of the validation client, typically a client named chef-validator"
option :validation_key,
- :long => "--validation-key PATH",
- :description => "The path to the validation key used by the client, typically a file named validation.pem"
+ long: "--validation-key PATH",
+ description: "The path to the validation key used by the client, typically a file named validation.pem"
def configure_chef
# We are just faking out the system so that you can do this without a key specified
@@ -112,14 +112,14 @@ EOH
def ask_user_for_config
server_name = guess_servername
- @chef_server = config[:chef_server_url] || ask_question("Please enter the chef server URL: ", :default => "https://#{server_name}/organizations/myorg")
+ @chef_server = config[:chef_server_url] || ask_question("Please enter the chef server URL: ", default: "https://#{server_name}/organizations/myorg")
if config[:initial]
- @new_client_name = config[:node_name] || ask_question("Please enter a name for the new user: ", :default => Etc.getlogin)
- @admin_client_name = config[:admin_client_name] || ask_question("Please enter the existing admin name: ", :default => "admin")
- @admin_client_key = config[:admin_client_key] || ask_question("Please enter the location of the existing admin's private key: ", :default => "/etc/chef-server/admin.pem")
+ @new_client_name = config[:node_name] || ask_question("Please enter a name for the new user: ", default: Etc.getlogin)
+ @admin_client_name = config[:admin_client_name] || ask_question("Please enter the existing admin name: ", default: "admin")
+ @admin_client_key = config[:admin_client_key] || ask_question("Please enter the location of the existing admin's private key: ", default: "/etc/chef-server/admin.pem")
@admin_client_key = File.expand_path(@admin_client_key)
else
- @new_client_name = config[:node_name] || ask_question("Please enter an existing username or clientname for the API: ", :default => Etc.getlogin)
+ @new_client_name = config[:node_name] || ask_question("Please enter an existing username or clientname for the API: ", default: Etc.getlogin)
end
@new_client_key = config[:client_key] || File.join(chef_config_path, "#{@new_client_name}.pem")
diff --git a/lib/chef/knife/cookbook_bulk_delete.rb b/lib/chef/knife/cookbook_bulk_delete.rb
index cdd1584e36..a68e8f00f4 100644
--- a/lib/chef/knife/cookbook_bulk_delete.rb
+++ b/lib/chef/knife/cookbook_bulk_delete.rb
@@ -28,7 +28,7 @@ class Chef
require "chef/cookbook_version"
end
- option :purge, :short => "-p", :long => "--purge", :boolean => true, :description => "Permanently remove files from backing data store"
+ option :purge, short: "-p", long: "--purge", boolean: true, description: "Permanently remove files from backing data store"
banner "knife cookbook bulk delete REGEX (options)"
diff --git a/lib/chef/knife/cookbook_delete.rb b/lib/chef/knife/cookbook_delete.rb
index b1bb88b388..4f2ada53cb 100644
--- a/lib/chef/knife/cookbook_delete.rb
+++ b/lib/chef/knife/cookbook_delete.rb
@@ -28,9 +28,9 @@ class Chef
require "chef/cookbook_version"
end
- option :all, :short => "-a", :long => "--all", :boolean => true, :description => "delete all versions"
+ option :all, short: "-a", long: "--all", boolean: true, description: "delete all versions"
- option :purge, :short => "-p", :long => "--purge", :boolean => true, :description => "Permanently remove files from backing data store"
+ option :purge, short: "-p", long: "--purge", boolean: true, description: "Permanently remove files from backing data store"
banner "knife cookbook delete COOKBOOK VERSION (options)"
diff --git a/lib/chef/knife/cookbook_download.rb b/lib/chef/knife/cookbook_download.rb
index 77e7aa0d09..a321d217db 100644
--- a/lib/chef/knife/cookbook_download.rb
+++ b/lib/chef/knife/cookbook_download.rb
@@ -33,21 +33,21 @@ class Chef
banner "knife cookbook download COOKBOOK [VERSION] (options)"
option :latest,
- :short => "-N",
- :long => "--latest",
- :description => "The version of the cookbook to download",
- :boolean => true
+ short: "-N",
+ long: "--latest",
+ description: "The version of the cookbook to download",
+ boolean: true
option :download_directory,
- :short => "-d DOWNLOAD_DIRECTORY",
- :long => "--dir DOWNLOAD_DIRECTORY",
- :description => "The directory to download the cookbook into",
- :default => Dir.pwd
+ short: "-d DOWNLOAD_DIRECTORY",
+ long: "--dir DOWNLOAD_DIRECTORY",
+ description: "The directory to download the cookbook into",
+ default: Dir.pwd
option :force,
- :short => "-f",
- :long => "--force",
- :description => "Force download over the download directory if it exists"
+ short: "-f",
+ long: "--force",
+ description: "Force download over the download directory if it exists"
# TODO: tim/cw: 5-23-2010: need to implement knife-side
# specificity for downloads - need to implement --platform and
diff --git a/lib/chef/knife/cookbook_list.rb b/lib/chef/knife/cookbook_list.rb
index ea81f5d286..deb36baef4 100644
--- a/lib/chef/knife/cookbook_list.rb
+++ b/lib/chef/knife/cookbook_list.rb
@@ -26,14 +26,14 @@ class Chef
banner "knife cookbook list (options)"
option :with_uri,
- :short => "-w",
- :long => "--with-uri",
- :description => "Show corresponding URIs"
+ short: "-w",
+ long: "--with-uri",
+ description: "Show corresponding URIs"
option :all_versions,
- :short => "-a",
- :long => "--all",
- :description => "Show all available versions."
+ short: "-a",
+ long: "--all",
+ description: "Show all available versions."
def run
env = config[:environment]
diff --git a/lib/chef/knife/cookbook_metadata.rb b/lib/chef/knife/cookbook_metadata.rb
index babb4ac4d1..8a9c57f1c3 100644
--- a/lib/chef/knife/cookbook_metadata.rb
+++ b/lib/chef/knife/cookbook_metadata.rb
@@ -30,15 +30,15 @@ class Chef
banner "knife cookbook metadata COOKBOOK (options)"
option :cookbook_path,
- :short => "-o PATH:PATH",
- :long => "--cookbook-path PATH:PATH",
- :description => "A colon-separated path to look for cookbooks in",
- :proc => lambda { |o| o.split(":") }
+ short: "-o PATH:PATH",
+ long: "--cookbook-path PATH:PATH",
+ description: "A colon-separated path to look for cookbooks in",
+ proc: lambda { |o| o.split(":") }
option :all,
- :short => "-a",
- :long => "--all",
- :description => "Generate metadata for all cookbooks, rather than just a single cookbook"
+ short: "-a",
+ long: "--all",
+ description: "Generate metadata for all cookbooks, rather than just a single cookbook"
def run
config[:cookbook_path] ||= Chef::Config[:cookbook_path]
diff --git a/lib/chef/knife/cookbook_show.rb b/lib/chef/knife/cookbook_show.rb
index 1d9983632d..78951d00c7 100644
--- a/lib/chef/knife/cookbook_show.rb
+++ b/lib/chef/knife/cookbook_show.rb
@@ -31,24 +31,24 @@ class Chef
banner "knife cookbook show COOKBOOK [VERSION] [PART] [FILENAME] (options)"
option :fqdn,
- :short => "-f FQDN",
- :long => "--fqdn FQDN",
- :description => "The FQDN of the host to see the file for"
+ short: "-f FQDN",
+ long: "--fqdn FQDN",
+ description: "The FQDN of the host to see the file for"
option :platform,
- :short => "-p PLATFORM",
- :long => "--platform PLATFORM",
- :description => "The platform to see the file for"
+ short: "-p PLATFORM",
+ long: "--platform PLATFORM",
+ description: "The platform to see the file for"
option :platform_version,
- :short => "-V VERSION",
- :long => "--platform-version VERSION",
- :description => "The platform version to see the file for"
+ short: "-V VERSION",
+ long: "--platform-version VERSION",
+ description: "The platform version to see the file for"
option :with_uri,
- :short => "-w",
- :long => "--with-uri",
- :description => "Show corresponding URIs"
+ short: "-w",
+ long: "--with-uri",
+ description: "Show corresponding URIs"
def run
cookbook_name, cookbook_version, segment, filename = @name_args
diff --git a/lib/chef/knife/cookbook_site_download.rb b/lib/chef/knife/cookbook_site_download.rb
index b957b0a362..ad4a2a83a2 100644
--- a/lib/chef/knife/cookbook_site_download.rb
+++ b/lib/chef/knife/cookbook_site_download.rb
@@ -30,20 +30,20 @@ class Chef
category "cookbook site"
option :file,
- :short => "-f FILE",
- :long => "--file FILE",
- :description => "The filename to write to"
+ short: "-f FILE",
+ long: "--file FILE",
+ description: "The filename to write to"
option :force,
- :long => "--force",
- :description => "Force download deprecated version"
+ long: "--force",
+ description: "Force download deprecated version"
option :supermarket_site,
- :short => "-m SUPERMARKET_SITE",
- :long => "--supermarket-site SUPERMARKET_SITE",
- :description => "Supermarket Site",
- :default => "https://supermarket.chef.io",
- :proc => Proc.new { |supermarket| Chef::Config[:knife][:supermarket_site] = supermarket }
+ short: "-m SUPERMARKET_SITE",
+ long: "--supermarket-site SUPERMARKET_SITE",
+ description: "Supermarket Site",
+ default: "https://supermarket.chef.io",
+ proc: Proc.new { |supermarket| Chef::Config[:knife][:supermarket_site] = supermarket }
def run
if current_cookbook_deprecated?
diff --git a/lib/chef/knife/cookbook_site_install.rb b/lib/chef/knife/cookbook_site_install.rb
index f4d692e13c..faa8c54c4b 100644
--- a/lib/chef/knife/cookbook_site_install.rb
+++ b/lib/chef/knife/cookbook_site_install.rb
@@ -35,37 +35,37 @@ class Chef
category "cookbook site"
option :no_deps,
- :short => "-D",
- :long => "--skip-dependencies",
- :boolean => true,
- :default => false,
- :description => "Skips automatic dependency installation."
+ short: "-D",
+ long: "--skip-dependencies",
+ boolean: true,
+ default: false,
+ description: "Skips automatic dependency installation."
option :cookbook_path,
- :short => "-o PATH:PATH",
- :long => "--cookbook-path PATH:PATH",
- :description => "A colon-separated path to look for cookbooks in",
- :proc => lambda { |o| o.split(":") }
+ short: "-o PATH:PATH",
+ long: "--cookbook-path PATH:PATH",
+ description: "A colon-separated path to look for cookbooks in",
+ proc: lambda { |o| o.split(":") }
option :default_branch,
- :short => "-B BRANCH",
- :long => "--branch BRANCH",
- :description => "Default branch to work with",
- :default => "master"
+ short: "-B BRANCH",
+ long: "--branch BRANCH",
+ description: "Default branch to work with",
+ default: "master"
option :use_current_branch,
- :short => "-b",
- :long => "--use-current-branch",
- :description => "Use the current branch",
- :boolean => true,
- :default => false
+ short: "-b",
+ long: "--use-current-branch",
+ description: "Use the current branch",
+ boolean: true,
+ default: false
option :supermarket_site,
- :short => "-m SUPERMARKET_SITE",
- :long => "--supermarket-site SUPERMARKET_SITE",
- :description => "Supermarket Site",
- :default => "https://supermarket.chef.io",
- :proc => Proc.new { |supermarket| Chef::Config[:knife][:supermarket_site] = supermarket }
+ short: "-m SUPERMARKET_SITE",
+ long: "--supermarket-site SUPERMARKET_SITE",
+ description: "Supermarket Site",
+ default: "https://supermarket.chef.io",
+ proc: Proc.new { |supermarket| Chef::Config[:knife][:supermarket_site] = supermarket }
attr_reader :cookbook_name
attr_reader :vendor_path
diff --git a/lib/chef/knife/cookbook_site_list.rb b/lib/chef/knife/cookbook_site_list.rb
index 3bdef8abe5..3b0b20a4df 100644
--- a/lib/chef/knife/cookbook_site_list.rb
+++ b/lib/chef/knife/cookbook_site_list.rb
@@ -26,16 +26,16 @@ class Chef
category "cookbook site"
option :with_uri,
- :short => "-w",
- :long => "--with-uri",
- :description => "Show corresponding URIs"
+ short: "-w",
+ long: "--with-uri",
+ description: "Show corresponding URIs"
option :supermarket_site,
- :short => "-m SUPERMARKET_SITE",
- :long => "--supermarket-site SUPERMARKET_SITE",
- :description => "Supermarket Site",
- :default => "https://supermarket.chef.io",
- :proc => Proc.new { |supermarket| Chef::Config[:knife][:supermarket_site] = supermarket }
+ short: "-m SUPERMARKET_SITE",
+ long: "--supermarket-site SUPERMARKET_SITE",
+ description: "Supermarket Site",
+ default: "https://supermarket.chef.io",
+ proc: Proc.new { |supermarket| Chef::Config[:knife][:supermarket_site] = supermarket }
def run
if config[:with_uri]
diff --git a/lib/chef/knife/cookbook_site_search.rb b/lib/chef/knife/cookbook_site_search.rb
index 0fee993f30..6a598bd22b 100644
--- a/lib/chef/knife/cookbook_site_search.rb
+++ b/lib/chef/knife/cookbook_site_search.rb
@@ -26,11 +26,11 @@ class Chef
category "cookbook site"
option :supermarket_site,
- :short => "-m SUPERMARKET_SITE",
- :long => "--supermarket-site SUPERMARKET_SITE",
- :description => "Supermarket Site",
- :default => "https://supermarket.chef.io",
- :proc => Proc.new { |supermarket| Chef::Config[:knife][:supermarket_site] = supermarket }
+ short: "-m SUPERMARKET_SITE",
+ long: "--supermarket-site SUPERMARKET_SITE",
+ description: "Supermarket Site",
+ default: "https://supermarket.chef.io",
+ proc: Proc.new { |supermarket| Chef::Config[:knife][:supermarket_site] = supermarket }
def run
output(search_cookbook(name_args[0]))
diff --git a/lib/chef/knife/cookbook_site_share.rb b/lib/chef/knife/cookbook_site_share.rb
index 5d5b3ddcc4..144085c2a2 100644
--- a/lib/chef/knife/cookbook_site_share.rb
+++ b/lib/chef/knife/cookbook_site_share.rb
@@ -39,24 +39,24 @@ class Chef
category "cookbook site"
option :cookbook_path,
- :short => "-o PATH:PATH",
- :long => "--cookbook-path PATH:PATH",
- :description => "A colon-separated path to look for cookbooks in",
- :proc => lambda { |o| Chef::Config.cookbook_path = o.split(":") }
+ short: "-o PATH:PATH",
+ long: "--cookbook-path PATH:PATH",
+ description: "A colon-separated path to look for cookbooks in",
+ proc: lambda { |o| Chef::Config.cookbook_path = o.split(":") }
option :dry_run,
- :long => "--dry-run",
- :short => "-n",
- :boolean => true,
- :default => false,
- :description => "Don't take action, only print what files will be uploaded to Supermarket."
+ long: "--dry-run",
+ short: "-n",
+ boolean: true,
+ default: false,
+ description: "Don't take action, only print what files will be uploaded to Supermarket."
option :supermarket_site,
- :short => "-m SUPERMARKET_SITE",
- :long => "--supermarket-site SUPERMARKET_SITE",
- :description => "Supermarket Site",
- :default => "https://supermarket.chef.io",
- :proc => Proc.new { |supermarket| Chef::Config[:knife][:supermarket_site] = supermarket }
+ short: "-m SUPERMARKET_SITE",
+ long: "--supermarket-site SUPERMARKET_SITE",
+ description: "Supermarket Site",
+ default: "https://supermarket.chef.io",
+ proc: Proc.new { |supermarket| Chef::Config[:knife][:supermarket_site] = supermarket }
def run
config[:cookbook_path] ||= Chef::Config[:cookbook_path]
@@ -81,7 +81,7 @@ class Chef
begin
Chef::Log.trace("Temp cookbook directory is #{tmp_cookbook_dir.inspect}")
ui.info("Making tarball #{cookbook_name}.tgz")
- shell_out!("#{tar_cmd} -czf #{cookbook_name}.tgz #{cookbook_name}", :cwd => tmp_cookbook_dir)
+ shell_out!("#{tar_cmd} -czf #{cookbook_name}.tgz #{cookbook_name}", cwd: tmp_cookbook_dir)
rescue => e
ui.error("Error making tarball #{cookbook_name}.tgz: #{e.message}. Increase log verbosity (-VV) for more information.")
Chef::Log.trace("\n#{e.backtrace.join("\n")}")
@@ -90,7 +90,7 @@ class Chef
if config[:dry_run]
ui.info("Not uploading #{cookbook_name}.tgz due to --dry-run flag.")
- result = shell_out!("#{tar_cmd} -tzf #{cookbook_name}.tgz", :cwd => tmp_cookbook_dir)
+ result = shell_out!("#{tar_cmd} -tzf #{cookbook_name}.tgz", cwd: tmp_cookbook_dir)
ui.info(result.stdout)
FileUtils.rm_rf tmp_cookbook_dir
return
@@ -129,8 +129,8 @@ class Chef
category_string = Chef::JSONCompat.to_json({ "category" => cookbook_category })
http_resp = Chef::CookbookSiteStreamingUploader.post(uri, user_id, user_secret_filename, {
- :tarball => File.open(cookbook_filename),
- :cookbook => category_string,
+ tarball: File.open(cookbook_filename),
+ cookbook: category_string,
})
res = Chef::JSONCompat.from_json(http_resp.body)
diff --git a/lib/chef/knife/cookbook_site_show.rb b/lib/chef/knife/cookbook_site_show.rb
index 397d0067ad..1ae242d051 100644
--- a/lib/chef/knife/cookbook_site_show.rb
+++ b/lib/chef/knife/cookbook_site_show.rb
@@ -26,11 +26,11 @@ class Chef
category "cookbook site"
option :supermarket_site,
- :short => "-m SUPERMARKET_SITE",
- :long => "--supermarket-site SUPERMARKET_SITE",
- :description => "Supermarket Site",
- :default => "https://supermarket.chef.io",
- :proc => Proc.new { |supermarket| Chef::Config[:knife][:supermarket_site] = supermarket }
+ short: "-m SUPERMARKET_SITE",
+ long: "--supermarket-site SUPERMARKET_SITE",
+ description: "Supermarket Site",
+ default: "https://supermarket.chef.io",
+ proc: Proc.new { |supermarket| Chef::Config[:knife][:supermarket_site] = supermarket }
def run
output(format_for_display(get_cookbook_data))
diff --git a/lib/chef/knife/cookbook_site_unshare.rb b/lib/chef/knife/cookbook_site_unshare.rb
index bdabff0b94..5f24781f38 100644
--- a/lib/chef/knife/cookbook_site_unshare.rb
+++ b/lib/chef/knife/cookbook_site_unshare.rb
@@ -31,11 +31,11 @@ class Chef
category "cookbook site"
option :supermarket_site,
- :short => "-m SUPERMARKET_SITE",
- :long => "--supermarket-site SUPERMARKET_SITE",
- :description => "Supermarket Site",
- :default => "https://supermarket.chef.io",
- :proc => Proc.new { |supermarket| Chef::Config[:knife][:supermarket_site] = supermarket }
+ short: "-m SUPERMARKET_SITE",
+ long: "--supermarket-site SUPERMARKET_SITE",
+ description: "Supermarket Site",
+ default: "https://supermarket.chef.io",
+ proc: Proc.new { |supermarket| Chef::Config[:knife][:supermarket_site] = supermarket }
def run
@cookbook_name = @name_args[0]
diff --git a/lib/chef/knife/cookbook_test.rb b/lib/chef/knife/cookbook_test.rb
index b4adf6c84f..2f600bf964 100644
--- a/lib/chef/knife/cookbook_test.rb
+++ b/lib/chef/knife/cookbook_test.rb
@@ -32,15 +32,15 @@ class Chef
banner "knife cookbook test [COOKBOOKS...] (options)"
option :cookbook_path,
- :short => "-o PATH:PATH",
- :long => "--cookbook-path PATH:PATH",
- :description => "A colon-separated path to look for cookbooks in",
- :proc => lambda { |o| o.split(":") }
+ short: "-o PATH:PATH",
+ long: "--cookbook-path PATH:PATH",
+ description: "A colon-separated path to look for cookbooks in",
+ proc: lambda { |o| o.split(":") }
option :all,
- :short => "-a",
- :long => "--all",
- :description => "Test all cookbooks, rather than just a single cookbook"
+ short: "-a",
+ long: "--all",
+ description: "Test all cookbooks, rather than just a single cookbook"
def run
ui.warn("DEPRECATED: Please use ChefSpec or Cookstyle to syntax-check cookbooks.")
diff --git a/lib/chef/knife/cookbook_upload.rb b/lib/chef/knife/cookbook_upload.rb
index f67a26dc9a..241eb03862 100644
--- a/lib/chef/knife/cookbook_upload.rb
+++ b/lib/chef/knife/cookbook_upload.rb
@@ -37,42 +37,42 @@ class Chef
banner "knife cookbook upload [COOKBOOKS...] (options)"
option :cookbook_path,
- :short => "-o PATH:PATH",
- :long => "--cookbook-path PATH:PATH",
- :description => "A colon-separated path to look for cookbooks in",
- :proc => lambda { |o| o.split(":") }
+ short: "-o PATH:PATH",
+ long: "--cookbook-path PATH:PATH",
+ description: "A colon-separated path to look for cookbooks in",
+ proc: lambda { |o| o.split(":") }
option :freeze,
- :long => "--freeze",
- :description => "Freeze this version of the cookbook so that it cannot be overwritten",
- :boolean => true
+ long: "--freeze",
+ description: "Freeze this version of the cookbook so that it cannot be overwritten",
+ boolean: true
option :all,
- :short => "-a",
- :long => "--all",
- :description => "Upload all cookbooks, rather than just a single cookbook"
+ short: "-a",
+ long: "--all",
+ description: "Upload all cookbooks, rather than just a single cookbook"
option :force,
- :long => "--force",
- :boolean => true,
- :description => "Update cookbook versions even if they have been frozen"
+ long: "--force",
+ boolean: true,
+ description: "Update cookbook versions even if they have been frozen"
option :concurrency,
- :long => "--concurrency NUMBER_OF_THREADS",
- :description => "How many concurrent threads will be used",
- :default => 10,
- :proc => lambda { |o| o.to_i }
+ long: "--concurrency NUMBER_OF_THREADS",
+ description: "How many concurrent threads will be used",
+ default: 10,
+ proc: lambda { |o| o.to_i }
option :environment,
- :short => "-E",
- :long => "--environment ENVIRONMENT",
- :description => "Set ENVIRONMENT's version dependency match the version you're uploading.",
- :default => nil
+ short: "-E",
+ long: "--environment ENVIRONMENT",
+ description: "Set ENVIRONMENT's version dependency match the version you're uploading.",
+ default: nil
option :depends,
- :short => "-d",
- :long => "--include-dependencies",
- :description => "Also upload cookbook dependencies"
+ short: "-d",
+ long: "--include-dependencies",
+ description: "Also upload cookbook dependencies"
def run
# Sanity check before we load anything from the server
@@ -242,7 +242,7 @@ WARNING
check_for_broken_links!(cb)
check_for_dependencies!(cb)
end
- Chef::CookbookUploader.new(cookbooks, :force => config[:force], :concurrency => config[:concurrency]).upload_cookbooks
+ Chef::CookbookUploader.new(cookbooks, force: config[:force], concurrency: config[:concurrency]).upload_cookbooks
rescue Chef::Exceptions::CookbookFrozen => e
ui.error e
raise
diff --git a/lib/chef/knife/core/bootstrap_context.rb b/lib/chef/knife/core/bootstrap_context.rb
index deb7f8a3b4..17d62f597f 100644
--- a/lib/chef/knife/core/bootstrap_context.rb
+++ b/lib/chef/knife/core/bootstrap_context.rb
@@ -228,7 +228,7 @@ validation_client_name "#{@chef_config[:validation_client_name]}"
end
attributes.delete(:run_list) if attributes[:policy_name] && !attributes[:policy_name].empty?
- attributes.merge!(:tags => @config[:tags]) if @config[:tags] && !@config[:tags].empty?
+ attributes.merge!(tags: @config[:tags]) if @config[:tags] && !@config[:tags].empty?
end
end
diff --git a/lib/chef/knife/core/cookbook_scm_repo.rb b/lib/chef/knife/core/cookbook_scm_repo.rb
index 38f432e5bb..f583f0bd8e 100644
--- a/lib/chef/knife/core/cookbook_scm_repo.rb
+++ b/lib/chef/knife/core/cookbook_scm_repo.rb
@@ -151,7 +151,7 @@ class Chef
end
def git(command)
- shell_out!("git #{command}", :cwd => repo_path)
+ shell_out!("git #{command}", cwd: repo_path)
end
end
diff --git a/lib/chef/knife/core/generic_presenter.rb b/lib/chef/knife/core/generic_presenter.rb
index 861bf1510d..7b3fee00b5 100644
--- a/lib/chef/knife/core/generic_presenter.rb
+++ b/lib/chef/knife/core/generic_presenter.rb
@@ -29,15 +29,15 @@ class Chef
def self.included(includer)
includer.class_eval do
option :field_separator,
- :short => "-S SEPARATOR",
- :long => "--field-separator SEPARATOR",
- :description => "Character separator used to delineate nesting in --attribute filters (default \".\")"
+ short: "-S SEPARATOR",
+ long: "--field-separator SEPARATOR",
+ description: "Character separator used to delineate nesting in --attribute filters (default \".\")"
option :attribute,
- :short => "-a ATTR1 [-a ATTR2]",
- :long => "--attribute ATTR1 [--attribute ATTR2] ",
- :description => "Show one or more attributes",
- :proc => Proc.new { |a|
+ short: "-a ATTR1 [-a ATTR2]",
+ long: "--attribute ATTR1 [--attribute ATTR2] ",
+ description: "Show one or more attributes",
+ proc: Proc.new { |a|
Chef::Config[:knife][:attribute] ||= []
Chef::Config[:knife][:attribute].push(a)
}
diff --git a/lib/chef/knife/core/node_presenter.rb b/lib/chef/knife/core/node_presenter.rb
index cdb664ec33..0c00601981 100644
--- a/lib/chef/knife/core/node_presenter.rb
+++ b/lib/chef/knife/core/node_presenter.rb
@@ -32,18 +32,18 @@ class Chef
def self.included(includer)
includer.class_eval do
option :medium_output,
- :short => "-m",
- :long => "--medium",
- :boolean => true,
- :default => false,
- :description => "Include normal attributes in the output"
+ short: "-m",
+ long: "--medium",
+ boolean: true,
+ default: false,
+ description: "Include normal attributes in the output"
option :long_output,
- :short => "-l",
- :long => "--long",
- :boolean => true,
- :default => false,
- :description => "Include all attributes in the output"
+ short: "-l",
+ long: "--long",
+ boolean: true,
+ default: false,
+ description: "Include all attributes in the output"
end
end
end
diff --git a/lib/chef/knife/core/status_presenter.rb b/lib/chef/knife/core/status_presenter.rb
index 1e2d9b41b6..4bb27d1277 100644
--- a/lib/chef/knife/core/status_presenter.rb
+++ b/lib/chef/knife/core/status_presenter.rb
@@ -32,18 +32,18 @@ class Chef
def self.included(includer)
includer.class_eval do
option :medium_output,
- :short => "-m",
- :long => "--medium",
- :boolean => true,
- :default => false,
- :description => "Include normal attributes in the output"
+ short: "-m",
+ long: "--medium",
+ boolean: true,
+ default: false,
+ description: "Include normal attributes in the output"
option :long_output,
- :short => "-l",
- :long => "--long",
- :boolean => true,
- :default => false,
- :description => "Include all attributes in the output"
+ short: "-l",
+ long: "--long",
+ boolean: true,
+ default: false,
+ description: "Include all attributes in the output"
end
end
end
diff --git a/lib/chef/knife/data_bag_from_file.rb b/lib/chef/knife/data_bag_from_file.rb
index 30b9de3386..3e8d3b6f59 100644
--- a/lib/chef/knife/data_bag_from_file.rb
+++ b/lib/chef/knife/data_bag_from_file.rb
@@ -38,9 +38,9 @@ class Chef
category "data bag"
option :all,
- :short => "-a",
- :long => "--all",
- :description => "Upload all data bags or all items for specified data bags"
+ short: "-a",
+ long: "--all",
+ description: "Upload all data bags or all items for specified data bags"
def loader
@loader ||= Knife::Core::ObjectLoader.new(DataBagItem, ui)
diff --git a/lib/chef/knife/data_bag_list.rb b/lib/chef/knife/data_bag_list.rb
index d507925ec8..454b0a4908 100644
--- a/lib/chef/knife/data_bag_list.rb
+++ b/lib/chef/knife/data_bag_list.rb
@@ -30,9 +30,9 @@ class Chef
category "data bag"
option :with_uri,
- :short => "-w",
- :long => "--with-uri",
- :description => "Show corresponding URIs"
+ short: "-w",
+ long: "--with-uri",
+ description: "Show corresponding URIs"
def run
output(format_list_for_display(Chef::DataBag.list))
diff --git a/lib/chef/knife/data_bag_secret_options.rb b/lib/chef/knife/data_bag_secret_options.rb
index a612004e15..62a3e71ec5 100644
--- a/lib/chef/knife/data_bag_secret_options.rb
+++ b/lib/chef/knife/data_bag_secret_options.rb
@@ -35,23 +35,23 @@ class Chef
def self.included(base)
base.option :secret,
- :short => "-s SECRET",
- :long => "--secret ",
- :description => "The secret key to use to encrypt data bag item values. Can also be defaulted in your config with the key 'secret'",
+ short: "-s SECRET",
+ long: "--secret ",
+ description: "The secret key to use to encrypt data bag item values. Can also be defaulted in your config with the key 'secret'",
# Need to store value from command line in separate variable - knife#merge_configs populates same keys
# on config object from
- :proc => Proc.new { |s| set_cl_secret(s) }
+ proc: Proc.new { |s| set_cl_secret(s) }
base.option :secret_file,
- :long => "--secret-file SECRET_FILE",
- :description => "A file containing the secret key to use to encrypt data bag item values. Can also be defaulted in your config with the key 'secret_file'",
- :proc => Proc.new { |sf| set_cl_secret_file(sf) }
+ long: "--secret-file SECRET_FILE",
+ description: "A file containing the secret key to use to encrypt data bag item values. Can also be defaulted in your config with the key 'secret_file'",
+ proc: Proc.new { |sf| set_cl_secret_file(sf) }
base.option :encrypt,
- :long => "--encrypt",
- :description => "If 'secret' or 'secret_file' is present in your config, then encrypt data bags using it",
- :boolean => true,
- :default => false
+ long: "--encrypt",
+ description: "If 'secret' or 'secret_file' is present in your config, then encrypt data bags using it",
+ boolean: true,
+ default: false
end
def encryption_secret_provided?
diff --git a/lib/chef/knife/delete.rb b/lib/chef/knife/delete.rb
index 19f75df012..1c05fba3cf 100644
--- a/lib/chef/knife/delete.rb
+++ b/lib/chef/knife/delete.rb
@@ -28,21 +28,21 @@ class Chef
end
option :recurse,
- :short => "-r",
- :long => "--[no-]recurse",
- :boolean => true,
- :default => false,
- :description => "Delete directories recursively."
+ short: "-r",
+ long: "--[no-]recurse",
+ boolean: true,
+ default: false,
+ description: "Delete directories recursively."
option :both,
- :long => "--both",
- :boolean => true,
- :default => false,
- :description => "Delete both the local and remote copies."
+ long: "--both",
+ boolean: true,
+ default: false,
+ description: "Delete both the local and remote copies."
option :local,
- :long => "--local",
- :boolean => true,
- :default => false,
- :description => "Delete the local copy (leave the remote copy)."
+ long: "--local",
+ boolean: true,
+ default: false,
+ description: "Delete the local copy (leave the remote copy)."
def run
if name_args.length == 0
diff --git a/lib/chef/knife/deps.rb b/lib/chef/knife/deps.rb
index fb2a8bb40f..4cb77eea46 100644
--- a/lib/chef/knife/deps.rb
+++ b/lib/chef/knife/deps.rb
@@ -29,17 +29,17 @@ class Chef
end
option :recurse,
- :long => "--[no-]recurse",
- :boolean => true,
- :description => "List dependencies recursively (default: true). Only works with --tree."
+ long: "--[no-]recurse",
+ boolean: true,
+ description: "List dependencies recursively (default: true). Only works with --tree."
option :tree,
- :long => "--tree",
- :boolean => true,
- :description => "Show dependencies in a visual tree. May show duplicates."
+ long: "--tree",
+ boolean: true,
+ description: "Show dependencies in a visual tree. May show duplicates."
option :remote,
- :long => "--remote",
- :boolean => true,
- :description => "List dependencies on the server instead of the local filesystem"
+ long: "--remote",
+ boolean: true,
+ description: "List dependencies on the server instead of the local filesystem"
attr_accessor :exit_code
diff --git a/lib/chef/knife/diff.rb b/lib/chef/knife/diff.rb
index a14335c296..aac42ed5c5 100644
--- a/lib/chef/knife/diff.rb
+++ b/lib/chef/knife/diff.rb
@@ -28,29 +28,29 @@ class Chef
end
option :recurse,
- :long => "--[no-]recurse",
- :boolean => true,
- :default => true,
- :description => "List directories recursively."
+ long: "--[no-]recurse",
+ boolean: true,
+ default: true,
+ description: "List directories recursively."
option :name_only,
- :long => "--name-only",
- :boolean => true,
- :description => "Only show names of modified files."
+ long: "--name-only",
+ boolean: true,
+ description: "Only show names of modified files."
option :name_status,
- :long => "--name-status",
- :boolean => true,
- :description => "Only show names and statuses of modified files: Added, Deleted, Modified, and Type Changed."
+ long: "--name-status",
+ boolean: true,
+ description: "Only show names and statuses of modified files: Added, Deleted, Modified, and Type Changed."
option :diff_filter,
- :long => "--diff-filter=[(A|D|M|T)...[*]]",
- :description => "Select only files that are Added (A), Deleted (D), Modified (M), or have their type (i.e. regular file, directory) changed (T). Any combination of the filter characters (including none) can be used. When * (All-or-none) is added to the combination, all paths are selected if
+ long: "--diff-filter=[(A|D|M|T)...[*]]",
+ description: "Select only files that are Added (A), Deleted (D), Modified (M), or have their type (i.e. regular file, directory) changed (T). Any combination of the filter characters (including none) can be used. When * (All-or-none) is added to the combination, all paths are selected if
there is any file that matches other criteria in the comparison; if there is no file that matches other criteria, nothing is selected."
option :cookbook_version,
- :long => "--cookbook-version VERSION",
- :description => "Version of cookbook to download (if there are multiple versions and cookbook_versions is false)"
+ long: "--cookbook-version VERSION",
+ description: "Version of cookbook to download (if there are multiple versions and cookbook_versions is false)"
def run
if config[:name_only]
diff --git a/lib/chef/knife/download.rb b/lib/chef/knife/download.rb
index 942d17d330..f1dfd13326 100644
--- a/lib/chef/knife/download.rb
+++ b/lib/chef/knife/download.rb
@@ -28,39 +28,39 @@ class Chef
end
option :recurse,
- :long => "--[no-]recurse",
- :boolean => true,
- :default => true,
- :description => "List directories recursively."
+ long: "--[no-]recurse",
+ boolean: true,
+ default: true,
+ description: "List directories recursively."
option :purge,
- :long => "--[no-]purge",
- :boolean => true,
- :default => false,
- :description => "Delete matching local files and directories that do not exist remotely."
+ long: "--[no-]purge",
+ boolean: true,
+ default: false,
+ description: "Delete matching local files and directories that do not exist remotely."
option :force,
- :long => "--[no-]force",
- :boolean => true,
- :default => false,
- :description => "Force upload of files even if they match (quicker and harmless, but doesn't print out what it changed)"
+ long: "--[no-]force",
+ boolean: true,
+ default: false,
+ description: "Force upload of files even if they match (quicker and harmless, but doesn't print out what it changed)"
option :dry_run,
- :long => "--dry-run",
- :short => "-n",
- :boolean => true,
- :default => false,
- :description => "Don't take action, only print what would happen"
+ long: "--dry-run",
+ short: "-n",
+ boolean: true,
+ default: false,
+ description: "Don't take action, only print what would happen"
option :diff,
- :long => "--[no-]diff",
- :boolean => true,
- :default => true,
- :description => "Turn off to avoid uploading existing files; only new (and possibly deleted) files with --no-diff"
+ long: "--[no-]diff",
+ boolean: true,
+ default: true,
+ description: "Turn off to avoid uploading existing files; only new (and possibly deleted) files with --no-diff"
option :cookbook_version,
- :long => "--cookbook-version VERSION",
- :description => "Version of cookbook to download (if there are multiple versions and cookbook_versions is false)"
+ long: "--cookbook-version VERSION",
+ description: "Version of cookbook to download (if there are multiple versions and cookbook_versions is false)"
def run
if name_args.length == 0
diff --git a/lib/chef/knife/edit.rb b/lib/chef/knife/edit.rb
index 597b284356..e150babc31 100644
--- a/lib/chef/knife/edit.rb
+++ b/lib/chef/knife/edit.rb
@@ -29,9 +29,9 @@ class Chef
end
option :local,
- :long => "--local",
- :boolean => true,
- :description => "Show local files instead of remote"
+ long: "--local",
+ boolean: true,
+ description: "Show local files instead of remote"
def run
# Get the matches (recursively)
diff --git a/lib/chef/knife/environment_compare.rb b/lib/chef/knife/environment_compare.rb
index 9131f06068..1395db3f34 100644
--- a/lib/chef/knife/environment_compare.rb
+++ b/lib/chef/knife/environment_compare.rb
@@ -29,16 +29,16 @@ class Chef
banner "knife environment compare [ENVIRONMENT..] (options)"
option :all,
- :short => "-a",
- :long => "--all",
- :description => "Show all cookbooks",
- :boolean => true
+ short: "-a",
+ long: "--all",
+ description: "Show all cookbooks",
+ boolean: true
option :mismatch,
- :short => "-m",
- :long => "--mismatch",
- :description => "Only show mismatching versions",
- :boolean => true
+ short: "-m",
+ long: "--mismatch",
+ description: "Only show mismatching versions",
+ boolean: true
def run
# Get the commandline environments or all if none are provided.
diff --git a/lib/chef/knife/environment_create.rb b/lib/chef/knife/environment_create.rb
index cfc1bc268c..e533a70172 100644
--- a/lib/chef/knife/environment_create.rb
+++ b/lib/chef/knife/environment_create.rb
@@ -30,9 +30,9 @@ class Chef
banner "knife environment create ENVIRONMENT (options)"
option :description,
- :short => "-d DESCRIPTION",
- :long => "--description DESCRIPTION",
- :description => "The environment description"
+ short: "-d DESCRIPTION",
+ long: "--description DESCRIPTION",
+ description: "The environment description"
def run
env_name = @name_args[0]
diff --git a/lib/chef/knife/environment_from_file.rb b/lib/chef/knife/environment_from_file.rb
index b16c3331bd..6e22e8b0f6 100644
--- a/lib/chef/knife/environment_from_file.rb
+++ b/lib/chef/knife/environment_from_file.rb
@@ -30,9 +30,9 @@ class Chef
banner "knife environment from file FILE [FILE..] (options)"
option :all,
- :short => "-a",
- :long => "--all",
- :description => "Upload all environments"
+ short: "-a",
+ long: "--all",
+ description: "Upload all environments"
def loader
@loader ||= Knife::Core::ObjectLoader.new(Chef::Environment, ui)
diff --git a/lib/chef/knife/environment_list.rb b/lib/chef/knife/environment_list.rb
index f278046bf9..c3f2ef2e39 100644
--- a/lib/chef/knife/environment_list.rb
+++ b/lib/chef/knife/environment_list.rb
@@ -30,9 +30,9 @@ class Chef
banner "knife environment list (options)"
option :with_uri,
- :short => "-w",
- :long => "--with-uri",
- :description => "Show corresponding URIs"
+ short: "-w",
+ long: "--with-uri",
+ description: "Show corresponding URIs"
def run
output(format_list_for_display(Chef::Environment.list))
diff --git a/lib/chef/knife/exec.rb b/lib/chef/knife/exec.rb
index 7b27a51b85..ed7101c0cc 100644
--- a/lib/chef/knife/exec.rb
+++ b/lib/chef/knife/exec.rb
@@ -24,15 +24,15 @@ class Chef::Knife::Exec < Chef::Knife
banner "knife exec [SCRIPT] (options)"
option :exec,
- :short => "-E CODE",
- :long => "--exec CODE",
- :description => "a string of Chef code to execute"
+ short: "-E CODE",
+ long: "--exec CODE",
+ description: "a string of Chef code to execute"
option :script_path,
- :short => "-p PATH:PATH",
- :long => "--script-path PATH:PATH",
- :description => "A colon-separated path to look for scripts in",
- :proc => lambda { |o| o.split(":") }
+ short: "-p PATH:PATH",
+ long: "--script-path PATH:PATH",
+ description: "A colon-separated path to look for scripts in",
+ proc: lambda { |o| o.split(":") }
deps do
require "chef/shell/ext"
diff --git a/lib/chef/knife/key_create_base.rb b/lib/chef/knife/key_create_base.rb
index d02d5ee180..d69f442e71 100644
--- a/lib/chef/knife/key_create_base.rb
+++ b/lib/chef/knife/key_create_base.rb
@@ -25,24 +25,24 @@ class Chef
def self.included(includer)
includer.class_eval do
option :public_key,
- :short => "-p FILENAME",
- :long => "--public-key FILENAME",
- :description => "Public key for newly created key. If not passed, the server will create a key pair for you, but you must pass --key-name NAME in that case."
+ short: "-p FILENAME",
+ long: "--public-key FILENAME",
+ description: "Public key for newly created key. If not passed, the server will create a key pair for you, but you must pass --key-name NAME in that case."
option :file,
- :short => "-f FILE",
- :long => "--file FILE",
- :description => "Write the private key to a file, if you requested the server to create one."
+ short: "-f FILE",
+ long: "--file FILE",
+ description: "Write the private key to a file, if you requested the server to create one."
option :key_name,
- :short => "-k NAME",
- :long => "--key-name NAME",
- :description => "The name for your key. If you do not pass a name, you must pass --public-key, and the name will default to the fingerprint of the public key passed."
+ short: "-k NAME",
+ long: "--key-name NAME",
+ description: "The name for your key. If you do not pass a name, you must pass --public-key, and the name will default to the fingerprint of the public key passed."
option :expiration_date,
- :short => "-e DATE",
- :long => "--expiration-date DATE",
- :description => "Optionally pass the expiration date for the key in ISO 8601 fomatted string: YYYY-MM-DDTHH:MM:SSZ e.g. 2013-12-24T21:00:00Z. Defaults to infinity if not passed. UTC timezone assumed."
+ short: "-e DATE",
+ long: "--expiration-date DATE",
+ description: "Optionally pass the expiration date for the key in ISO 8601 fomatted string: YYYY-MM-DDTHH:MM:SSZ e.g. 2013-12-24T21:00:00Z. Defaults to infinity if not passed. UTC timezone assumed."
end
end
end
diff --git a/lib/chef/knife/key_edit_base.rb b/lib/chef/knife/key_edit_base.rb
index 1a613ef1bc..ecdb4b0038 100644
--- a/lib/chef/knife/key_edit_base.rb
+++ b/lib/chef/knife/key_edit_base.rb
@@ -25,29 +25,29 @@ class Chef
def self.included(includer)
includer.class_eval do
option :public_key,
- :short => "-p FILENAME",
- :long => "--public-key FILENAME",
- :description => "Replace the public_key field from a file on disk. If not passed, the public_key field will not change."
+ short: "-p FILENAME",
+ long: "--public-key FILENAME",
+ description: "Replace the public_key field from a file on disk. If not passed, the public_key field will not change."
option :create_key,
- :short => "-c",
- :long => "--create-key",
- :description => "Replace the public_key field with a key generated by the server. The private key will be returned."
+ short: "-c",
+ long: "--create-key",
+ description: "Replace the public_key field with a key generated by the server. The private key will be returned."
option :file,
- :short => "-f FILE",
- :long => "--file FILE",
- :description => "Write the private key to a file, if you requested the server to create one via --create-key."
+ short: "-f FILE",
+ long: "--file FILE",
+ description: "Write the private key to a file, if you requested the server to create one via --create-key."
option :key_name,
- :short => "-k NAME",
- :long => "--key-name NAME",
- :description => "The new name for your key. Pass if you wish to update the name field of your key."
+ short: "-k NAME",
+ long: "--key-name NAME",
+ description: "The new name for your key. Pass if you wish to update the name field of your key."
option :expiration_date,
- :short => "-e DATE",
- :long => "--expiration-date DATE",
- :description => "Updates the expiration_date field of your key if passed. Pass in ISO 8601 fomatted string: YYYY-MM-DDTHH:MM:SSZ e.g. 2013-12-24T21:00:00Z or infinity. UTC timezone assumed."
+ short: "-e DATE",
+ long: "--expiration-date DATE",
+ description: "Updates the expiration_date field of your key if passed. Pass in ISO 8601 fomatted string: YYYY-MM-DDTHH:MM:SSZ e.g. 2013-12-24T21:00:00Z or infinity. UTC timezone assumed."
end
end
end
diff --git a/lib/chef/knife/key_list_base.rb b/lib/chef/knife/key_list_base.rb
index 95858e9ba1..6470bf78ad 100644
--- a/lib/chef/knife/key_list_base.rb
+++ b/lib/chef/knife/key_list_base.rb
@@ -25,19 +25,19 @@ class Chef
def self.included(includer)
includer.class_eval do
option :with_details,
- :short => "-w",
- :long => "--with-details",
- :description => "Show corresponding URIs and whether the key has expired or not."
+ short: "-w",
+ long: "--with-details",
+ description: "Show corresponding URIs and whether the key has expired or not."
option :only_expired,
- :short => "-e",
- :long => "--only-expired",
- :description => "Only show expired keys."
+ short: "-e",
+ long: "--only-expired",
+ description: "Only show expired keys."
option :only_non_expired,
- :short => "-n",
- :long => "--only-non-expired",
- :description => "Only show non-expired keys."
+ short: "-n",
+ long: "--only-non-expired",
+ description: "Only show non-expired keys."
end
end
end
diff --git a/lib/chef/knife/list.rb b/lib/chef/knife/list.rb
index 7dc91d7266..9452478ddb 100644
--- a/lib/chef/knife/list.rb
+++ b/lib/chef/knife/list.rb
@@ -29,30 +29,30 @@ class Chef
end
option :recursive,
- :short => "-R",
- :boolean => true,
- :description => "List directories recursively"
+ short: "-R",
+ boolean: true,
+ description: "List directories recursively"
option :bare_directories,
- :short => "-d",
- :boolean => true,
- :description => "When directories match the pattern, do not show the directories' children"
+ short: "-d",
+ boolean: true,
+ description: "When directories match the pattern, do not show the directories' children"
option :local,
- :long => "--local",
- :boolean => true,
- :description => "List local directory instead of remote"
+ long: "--local",
+ boolean: true,
+ description: "List local directory instead of remote"
option :flat,
- :short => "-f",
- :long => "--flat",
- :boolean => true,
- :description => "Show a list of filenames rather than the prettified ls-like output normally produced"
+ short: "-f",
+ long: "--flat",
+ boolean: true,
+ description: "Show a list of filenames rather than the prettified ls-like output normally produced"
option :one_column,
- :short => "-1",
- :boolean => true,
- :description => "Show only one column of results"
+ short: "-1",
+ boolean: true,
+ description: "Show only one column of results"
option :trailing_slashes,
- :short => "-p",
- :boolean => true,
- :description => "Show trailing slashes after directories"
+ short: "-p",
+ boolean: true,
+ description: "Show trailing slashes after directories"
attr_accessor :exit_code
diff --git a/lib/chef/knife/node_edit.rb b/lib/chef/knife/node_edit.rb
index 4632c0a5b4..7551a8a7da 100644
--- a/lib/chef/knife/node_edit.rb
+++ b/lib/chef/knife/node_edit.rb
@@ -32,10 +32,10 @@ class Chef
banner "knife node edit NODE (options)"
option :all_attributes,
- :short => "-a",
- :long => "--all",
- :boolean => true,
- :description => "Display all attributes when editing"
+ short: "-a",
+ long: "--all",
+ boolean: true,
+ description: "Display all attributes when editing"
def run
if node_name.nil?
diff --git a/lib/chef/knife/node_list.rb b/lib/chef/knife/node_list.rb
index 4885208136..4bc2c34508 100644
--- a/lib/chef/knife/node_list.rb
+++ b/lib/chef/knife/node_list.rb
@@ -30,9 +30,9 @@ class Chef
banner "knife node list (options)"
option :with_uri,
- :short => "-w",
- :long => "--with-uri",
- :description => "Show corresponding URIs"
+ short: "-w",
+ long: "--with-uri",
+ description: "Show corresponding URIs"
def run
env = Chef::Config[:environment]
diff --git a/lib/chef/knife/node_run_list_add.rb b/lib/chef/knife/node_run_list_add.rb
index fb4ce3bc12..3fc28c041d 100644
--- a/lib/chef/knife/node_run_list_add.rb
+++ b/lib/chef/knife/node_run_list_add.rb
@@ -30,14 +30,14 @@ class Chef
banner "knife node run_list add [NODE] [ENTRY [ENTRY]] (options)"
option :after,
- :short => "-a ITEM",
- :long => "--after ITEM",
- :description => "Place the ENTRY in the run list after ITEM"
+ short: "-a ITEM",
+ long: "--after ITEM",
+ description: "Place the ENTRY in the run list after ITEM"
option :before,
- :short => "-b ITEM",
- :long => "--before ITEM",
- :description => "Place the ENTRY in the run list before ITEM"
+ short: "-b ITEM",
+ long: "--before ITEM",
+ description: "Place the ENTRY in the run list before ITEM"
def run
node = Chef::Node.load(@name_args[0])
diff --git a/lib/chef/knife/node_show.rb b/lib/chef/knife/node_show.rb
index 3092b3fc27..43e7e9dbee 100644
--- a/lib/chef/knife/node_show.rb
+++ b/lib/chef/knife/node_show.rb
@@ -34,14 +34,14 @@ class Chef
banner "knife node show NODE (options)"
option :run_list,
- :short => "-r",
- :long => "--run-list",
- :description => "Show only the run list"
+ short: "-r",
+ long: "--run-list",
+ description: "Show only the run list"
option :environment,
- :short => "-E",
- :long => "--environment",
- :description => "Show only the Chef environment"
+ short: "-E",
+ long: "--environment",
+ description: "Show only the Chef environment"
def run
ui.use_presenter Knife::Core::NodePresenter
diff --git a/lib/chef/knife/osc_user_create.rb b/lib/chef/knife/osc_user_create.rb
index 74b50a4ef4..9ebf268110 100644
--- a/lib/chef/knife/osc_user_create.rb
+++ b/lib/chef/knife/osc_user_create.rb
@@ -32,25 +32,25 @@ class Chef
end
option :file,
- :short => "-f FILE",
- :long => "--file FILE",
- :description => "Write the private key to a file"
+ short: "-f FILE",
+ long: "--file FILE",
+ description: "Write the private key to a file"
option :admin,
- :short => "-a",
- :long => "--admin",
- :description => "Create the user as an admin",
- :boolean => true
+ short: "-a",
+ long: "--admin",
+ description: "Create the user as an admin",
+ boolean: true
option :user_password,
- :short => "-p PASSWORD",
- :long => "--password PASSWORD",
- :description => "Password for newly created user",
- :default => ""
+ short: "-p PASSWORD",
+ long: "--password PASSWORD",
+ description: "Password for newly created user",
+ default: ""
option :user_key,
- :long => "--user-key FILENAME",
- :description => "Public key for newly created user. By default a key will be created for you."
+ long: "--user-key FILENAME",
+ description: "Public key for newly created user. By default a key will be created for you."
banner "knife osc_user create USER (options)"
diff --git a/lib/chef/knife/osc_user_list.rb b/lib/chef/knife/osc_user_list.rb
index f1002c4f54..17a7a781d9 100644
--- a/lib/chef/knife/osc_user_list.rb
+++ b/lib/chef/knife/osc_user_list.rb
@@ -35,9 +35,9 @@ class Chef
banner "knife osc_user list (options)"
option :with_uri,
- :short => "-w",
- :long => "--with-uri",
- :description => "Show corresponding URIs"
+ short: "-w",
+ long: "--with-uri",
+ description: "Show corresponding URIs"
def run
output(format_list_for_display(Chef::User.list))
diff --git a/lib/chef/knife/osc_user_reregister.rb b/lib/chef/knife/osc_user_reregister.rb
index dee1cf41b1..5f5d3fb246 100644
--- a/lib/chef/knife/osc_user_reregister.rb
+++ b/lib/chef/knife/osc_user_reregister.rb
@@ -35,9 +35,9 @@ class Chef
banner "knife osc_user reregister USER (options)"
option :file,
- :short => "-f FILE",
- :long => "--file FILE",
- :description => "Write the private key to a file"
+ short: "-f FILE",
+ long: "--file FILE",
+ description: "Write the private key to a file"
def run
@user_name = @name_args[0]
diff --git a/lib/chef/knife/raw.rb b/lib/chef/knife/raw.rb
index dfbf423e92..2d49c457fc 100644
--- a/lib/chef/knife/raw.rb
+++ b/lib/chef/knife/raw.rb
@@ -33,27 +33,27 @@ class Chef
end
option :method,
- :long => "--method METHOD",
- :short => "-m METHOD",
- :default => "GET",
- :description => "Request method (GET, POST, PUT or DELETE). Default: GET"
+ long: "--method METHOD",
+ short: "-m METHOD",
+ default: "GET",
+ description: "Request method (GET, POST, PUT or DELETE). Default: GET"
option :pretty,
- :long => "--[no-]pretty",
- :boolean => true,
- :default => true,
- :description => "Pretty-print JSON output. Default: true"
+ long: "--[no-]pretty",
+ boolean: true,
+ default: true,
+ description: "Pretty-print JSON output. Default: true"
option :input,
- :long => "--input FILE",
- :short => "-i FILE",
- :description => "Name of file to use for PUT or POST"
+ long: "--input FILE",
+ short: "-i FILE",
+ description: "Name of file to use for PUT or POST"
option :proxy_auth,
- :long => "--proxy-auth",
- :boolean => true,
- :default => false,
- :description => "Use webui proxy authentication. Client key must be the webui key."
+ long: "--proxy-auth",
+ boolean: true,
+ default: false,
+ description: "Use webui proxy authentication. Client key must be the webui key."
# We need a custom HTTP client class here because we don't want to even
# try to decode the body, in case we get back corrupted JSON or whatnot.
@@ -105,7 +105,7 @@ class Chef
result = Chef::JSONCompat.to_json_pretty(result)
end
else
- chef_rest = RawInputServerAPI.new(:raw_output => true)
+ chef_rest = RawInputServerAPI.new(raw_output: true)
result = chef_rest.request(method, name_args[0], headers, data)
end
output result
diff --git a/lib/chef/knife/role_create.rb b/lib/chef/knife/role_create.rb
index a389d849f7..6b953f31c8 100644
--- a/lib/chef/knife/role_create.rb
+++ b/lib/chef/knife/role_create.rb
@@ -30,9 +30,9 @@ class Chef
banner "knife role create ROLE (options)"
option :description,
- :short => "-d DESC",
- :long => "--description DESC",
- :description => "The role description"
+ short: "-d DESC",
+ long: "--description DESC",
+ description: "The role description"
def run
@role_name = @name_args[0]
diff --git a/lib/chef/knife/role_env_run_list_add.rb b/lib/chef/knife/role_env_run_list_add.rb
index c24ae3d331..0f4bee9dbf 100644
--- a/lib/chef/knife/role_env_run_list_add.rb
+++ b/lib/chef/knife/role_env_run_list_add.rb
@@ -31,9 +31,9 @@ class Chef
banner "knife role env_run_list add [ROLE] [ENVIRONMENT] [ENTRY [ENTRY]] (options)"
option :after,
- :short => "-a ITEM",
- :long => "--after ITEM",
- :description => "Place the ENTRY in the run list after ITEM"
+ short: "-a ITEM",
+ long: "--after ITEM",
+ description: "Place the ENTRY in the run list after ITEM"
def add_to_env_run_list(role, environment, entries, after = nil)
if after
diff --git a/lib/chef/knife/role_list.rb b/lib/chef/knife/role_list.rb
index 1247478ef5..3d6c3b4574 100644
--- a/lib/chef/knife/role_list.rb
+++ b/lib/chef/knife/role_list.rb
@@ -30,9 +30,9 @@ class Chef
banner "knife role list (options)"
option :with_uri,
- :short => "-w",
- :long => "--with-uri",
- :description => "Show corresponding URIs"
+ short: "-w",
+ long: "--with-uri",
+ description: "Show corresponding URIs"
def run
output(format_list_for_display(Chef::Role.list))
diff --git a/lib/chef/knife/role_run_list_add.rb b/lib/chef/knife/role_run_list_add.rb
index df06d91725..c6564f9d04 100644
--- a/lib/chef/knife/role_run_list_add.rb
+++ b/lib/chef/knife/role_run_list_add.rb
@@ -31,9 +31,9 @@ class Chef
banner "knife role run_list add [ROLE] [ENTRY [ENTRY]] (options)"
option :after,
- :short => "-a ITEM",
- :long => "--after ITEM",
- :description => "Place the ENTRY in the run list after ITEM"
+ short: "-a ITEM",
+ long: "--after ITEM",
+ description: "Place the ENTRY in the run list after ITEM"
def add_to_env_run_list(role, environment, entries, after = nil)
if after
diff --git a/lib/chef/knife/search.rb b/lib/chef/knife/search.rb
index 94c33aa594..1bc9ce9f7e 100644
--- a/lib/chef/knife/search.rb
+++ b/lib/chef/knife/search.rb
@@ -38,38 +38,38 @@ class Chef
banner "knife search INDEX QUERY (options)"
option :start,
- :short => "-b ROW",
- :long => "--start ROW",
- :description => "The row to start returning results at",
- :default => 0,
- :proc => lambda { |i| i.to_i }
+ short: "-b ROW",
+ long: "--start ROW",
+ description: "The row to start returning results at",
+ default: 0,
+ proc: lambda { |i| i.to_i }
option :rows,
- :short => "-R INT",
- :long => "--rows INT",
- :description => "The number of rows to return",
- :default => nil,
- :proc => lambda { |i| i.to_i }
+ short: "-R INT",
+ long: "--rows INT",
+ description: "The number of rows to return",
+ default: nil,
+ proc: lambda { |i| i.to_i }
option :run_list,
- :short => "-r",
- :long => "--run-list",
- :description => "Show only the run list"
+ short: "-r",
+ long: "--run-list",
+ description: "Show only the run list"
option :id_only,
- :short => "-i",
- :long => "--id-only",
- :description => "Show only the ID of matching objects"
+ short: "-i",
+ long: "--id-only",
+ description: "Show only the ID of matching objects"
option :query,
- :short => "-q QUERY",
- :long => "--query QUERY",
- :description => "The search query; useful to protect queries starting with -"
+ short: "-q QUERY",
+ long: "--query QUERY",
+ description: "The search query; useful to protect queries starting with -"
option :filter_result,
- :short => "-f FILTER",
- :long => "--filter-result FILTER",
- :description => "Only return specific attributes of the matching objects; for example: \"ServerName=name, Kernel=kernel.version\""
+ short: "-f FILTER",
+ long: "--filter-result FILTER",
+ description: "Only return specific attributes of the matching objects; for example: \"ServerName=name, Kernel=kernel.version\""
def run
read_cli_args
@@ -116,7 +116,7 @@ class Chef
end
if ui.interchange?
- output({ :results => result_count, :rows => result_items })
+ output({ results: result_count, rows: result_items })
else
ui.log "#{result_count} items found"
ui.log("\n")
diff --git a/lib/chef/knife/serve.rb b/lib/chef/knife/serve.rb
index cac7fe8884..eb5c98963c 100644
--- a/lib/chef/knife/serve.rb
+++ b/lib/chef/knife/serve.rb
@@ -24,16 +24,16 @@ class Chef
banner "knife serve (options)"
option :repo_mode,
- :long => "--repo-mode MODE",
- :description => "Specifies the local repository layout. Values: static (only environments/roles/data_bags/cookbooks), everything (includes nodes/clients/users), hosted_everything (includes acls/groups/etc. for Enterprise/Hosted Chef). Default: everything/hosted_everything"
+ long: "--repo-mode MODE",
+ description: "Specifies the local repository layout. Values: static (only environments/roles/data_bags/cookbooks), everything (includes nodes/clients/users), hosted_everything (includes acls/groups/etc. for Enterprise/Hosted Chef). Default: everything/hosted_everything"
option :chef_repo_path,
- :long => "--chef-repo-path PATH",
- :description => "Overrides the location of chef repo. Default is specified by chef_repo_path in the config"
+ long: "--chef-repo-path PATH",
+ description: "Overrides the location of chef repo. Default is specified by chef_repo_path in the config"
option :chef_zero_host,
- :long => "--chef-zero-host IP",
- :description => "Overrides the host upon which chef-zero listens. Default is 127.0.0.1."
+ long: "--chef-zero-host IP",
+ description: "Overrides the host upon which chef-zero listens. Default is 127.0.0.1."
def configure_chef
super
diff --git a/lib/chef/knife/show.rb b/lib/chef/knife/show.rb
index 92b7ce1483..4511a86004 100644
--- a/lib/chef/knife/show.rb
+++ b/lib/chef/knife/show.rb
@@ -29,9 +29,9 @@ class Chef
end
option :local,
- :long => "--local",
- :boolean => true,
- :description => "Show local files instead of remote"
+ long: "--local",
+ boolean: true,
+ description: "Show local files instead of remote"
def run
# Get the matches (recursively)
diff --git a/lib/chef/knife/ssh.rb b/lib/chef/knife/ssh.rb
index c38dc43e74..5bdbfd5498 100644
--- a/lib/chef/knife/ssh.rb
+++ b/lib/chef/knife/ssh.rb
@@ -40,100 +40,100 @@ class Chef
banner "knife ssh QUERY COMMAND (options)"
option :concurrency,
- :short => "-C NUM",
- :long => "--concurrency NUM",
- :description => "The number of concurrent connections",
- :default => nil,
- :proc => lambda { |o| o.to_i }
+ short: "-C NUM",
+ long: "--concurrency NUM",
+ description: "The number of concurrent connections",
+ default: nil,
+ proc: lambda { |o| o.to_i }
option :ssh_attribute,
- :short => "-a ATTR",
- :long => "--attribute ATTR",
- :description => "The attribute to use for opening the connection - default depends on the context"
+ short: "-a ATTR",
+ long: "--attribute ATTR",
+ description: "The attribute to use for opening the connection - default depends on the context"
option :manual,
- :short => "-m",
- :long => "--manual-list",
- :boolean => true,
- :description => "QUERY is a space separated list of servers",
- :default => false
+ short: "-m",
+ long: "--manual-list",
+ boolean: true,
+ description: "QUERY is a space separated list of servers",
+ default: false
option :prefix_attribute,
- :long => "--prefix-attribute ATTR",
- :description => "The attribute to use for prefixing the ouput - default depends on the context"
+ long: "--prefix-attribute ATTR",
+ description: "The attribute to use for prefixing the ouput - default depends on the context"
option :ssh_user,
- :short => "-x USERNAME",
- :long => "--ssh-user USERNAME",
- :description => "The ssh username"
+ short: "-x USERNAME",
+ long: "--ssh-user USERNAME",
+ description: "The ssh username"
option :ssh_password_ng,
- :short => "-P [PASSWORD]",
- :long => "--ssh-password [PASSWORD]",
- :description => "The ssh password - will prompt if flag is specified but no password is given",
+ short: "-P [PASSWORD]",
+ long: "--ssh-password [PASSWORD]",
+ description: "The ssh password - will prompt if flag is specified but no password is given",
# default to a value that can not be a password (boolean)
# so we can effectively test if this parameter was specified
# without a value
- :default => false
+ default: false
option :ssh_port,
- :short => "-p PORT",
- :long => "--ssh-port PORT",
- :description => "The ssh port",
- :proc => Proc.new { |key| Chef::Config[:knife][:ssh_port] = key.strip }
+ short: "-p PORT",
+ long: "--ssh-port PORT",
+ description: "The ssh port",
+ proc: Proc.new { |key| Chef::Config[:knife][:ssh_port] = key.strip }
option :ssh_timeout,
- :short => "-t SECONDS",
- :long => "--ssh-timeout SECONDS",
- :description => "The ssh connection timeout",
- :proc => Proc.new { |key| Chef::Config[:knife][:ssh_timeout] = key.strip.to_i },
- :default => 120
+ short: "-t SECONDS",
+ long: "--ssh-timeout SECONDS",
+ description: "The ssh connection timeout",
+ proc: Proc.new { |key| Chef::Config[:knife][:ssh_timeout] = key.strip.to_i },
+ default: 120
option :ssh_gateway,
- :short => "-G GATEWAY",
- :long => "--ssh-gateway GATEWAY",
- :description => "The ssh gateway",
- :proc => Proc.new { |key| Chef::Config[:knife][:ssh_gateway] = key.strip }
+ short: "-G GATEWAY",
+ long: "--ssh-gateway GATEWAY",
+ description: "The ssh gateway",
+ proc: Proc.new { |key| Chef::Config[:knife][:ssh_gateway] = key.strip }
option :ssh_gateway_identity,
- :long => "--ssh-gateway-identity SSH_GATEWAY_IDENTITY",
- :description => "The SSH identity file used for gateway authentication"
+ long: "--ssh-gateway-identity SSH_GATEWAY_IDENTITY",
+ description: "The SSH identity file used for gateway authentication"
option :forward_agent,
- :short => "-A",
- :long => "--forward-agent",
- :description => "Enable SSH agent forwarding",
- :boolean => true
+ short: "-A",
+ long: "--forward-agent",
+ description: "Enable SSH agent forwarding",
+ boolean: true
option :ssh_identity_file,
- :short => "-i IDENTITY_FILE",
- :long => "--ssh-identity-file IDENTITY_FILE",
- :description => "The SSH identity file used for authentication"
+ short: "-i IDENTITY_FILE",
+ long: "--ssh-identity-file IDENTITY_FILE",
+ description: "The SSH identity file used for authentication"
option :host_key_verify,
- :long => "--[no-]host-key-verify",
- :description => "Verify host key, enabled by default.",
- :boolean => true,
- :default => true
+ long: "--[no-]host-key-verify",
+ description: "Verify host key, enabled by default.",
+ boolean: true,
+ default: true
option :on_error,
- :short => "-e",
- :long => "--exit-on-error",
- :description => "Immediately exit if an error is encountered",
- :boolean => true,
- :default => false
+ short: "-e",
+ long: "--exit-on-error",
+ description: "Immediately exit if an error is encountered",
+ boolean: true,
+ default: false
option :duplicated_fqdns,
- :long => "--duplicated-fqdns",
- :description => "Behavior if FQDNs are duplicated, ignored by default",
- :proc => Proc.new { |key| Chef::Config[:knife][:duplicated_fqdns] = key.strip.to_sym },
- :default => :ignore
+ long: "--duplicated-fqdns",
+ description: "Behavior if FQDNs are duplicated, ignored by default",
+ proc: Proc.new { |key| Chef::Config[:knife][:duplicated_fqdns] = key.strip.to_sym },
+ default: :ignore
option :tmux_split,
- :long => "--tmux-split",
- :description => "Split tmux window.",
- :boolean => true,
- :default => false
+ long: "--tmux-split",
+ description: "Split tmux window.",
+ boolean: true,
+ default: false
def session
ssh_error_handler = Proc.new do |server|
@@ -146,7 +146,7 @@ class Chef
end
end
- @session ||= Net::SSH::Multi.start(:concurrent_connections => config[:concurrency], :on_error => ssh_error_handler)
+ @session ||= Net::SSH::Multi.start(concurrent_connections: config[:concurrency], on_error: ssh_error_handler)
end
def configure_gateway
@@ -505,18 +505,18 @@ class Chef
end
Appscript.app("/Applications/Utilities/Terminal.app").windows.first.activate
- Appscript.app("System Events").application_processes["Terminal.app"].keystroke("n", :using => :command_down)
+ Appscript.app("System Events").application_processes["Terminal.app"].keystroke("n", using: :command_down)
term = Appscript.app("Terminal")
window = term.windows.first.get
(session.servers_for.size - 1).times do |i|
window.activate
- Appscript.app("System Events").application_processes["Terminal.app"].keystroke("t", :using => :command_down)
+ Appscript.app("System Events").application_processes["Terminal.app"].keystroke("t", using: :command_down)
end
session.servers_for.each_with_index do |server, tab_number|
cmd = "unset PROMPT_COMMAND; echo -e \"\\033]0;#{server.host}\\007\"; ssh #{server.user ? "#{server.user}@#{server.host}" : server.host}"
- Appscript.app("Terminal").do_script(cmd, :in => window.tabs[tab_number + 1].get)
+ Appscript.app("Terminal").do_script(cmd, in: window.tabs[tab_number + 1].get)
end
end
diff --git a/lib/chef/knife/status.rb b/lib/chef/knife/status.rb
index 0e3cd7e7d6..413bff4f66 100644
--- a/lib/chef/knife/status.rb
+++ b/lib/chef/knife/status.rb
@@ -32,23 +32,23 @@ class Chef
banner "knife status QUERY (options)"
option :run_list,
- :short => "-r",
- :long => "--run-list",
- :description => "Show the run list"
+ short: "-r",
+ long: "--run-list",
+ description: "Show the run list"
option :sort_reverse,
- :short => "-s",
- :long => "--sort-reverse",
- :description => "Sort the status list by last run time descending"
+ short: "-s",
+ long: "--sort-reverse",
+ description: "Sort the status list by last run time descending"
option :hide_healthy,
- :short => "-H",
- :long => "--hide-healthy",
- :description => "Hide nodes that have run chef in the last hour. [DEPRECATED] Use --hide-by-mins MINS instead"
+ short: "-H",
+ long: "--hide-healthy",
+ description: "Hide nodes that have run chef in the last hour. [DEPRECATED] Use --hide-by-mins MINS instead"
option :hide_by_mins,
- :long => "--hide-by-mins MINS",
- :description => "Hide nodes that have run chef in the last MINS minutes"
+ long: "--hide-by-mins MINS",
+ description: "Hide nodes that have run chef in the last MINS minutes"
def append_to_query(term)
@query << " AND " unless @query.empty?
diff --git a/lib/chef/knife/upload.rb b/lib/chef/knife/upload.rb
index 063ed26892..e4e0a74b28 100644
--- a/lib/chef/knife/upload.rb
+++ b/lib/chef/knife/upload.rb
@@ -28,41 +28,41 @@ class Chef
end
option :recurse,
- :long => "--[no-]recurse",
- :boolean => true,
- :default => true,
- :description => "List directories recursively."
+ long: "--[no-]recurse",
+ boolean: true,
+ default: true,
+ description: "List directories recursively."
option :purge,
- :long => "--[no-]purge",
- :boolean => true,
- :default => false,
- :description => "Delete matching local files and directories that do not exist remotely."
+ long: "--[no-]purge",
+ boolean: true,
+ default: false,
+ description: "Delete matching local files and directories that do not exist remotely."
option :force,
- :long => "--[no-]force",
- :boolean => true,
- :default => false,
- :description => "Force upload of files even if they match (quicker for many files). Will overwrite frozen cookbooks."
+ long: "--[no-]force",
+ boolean: true,
+ default: false,
+ description: "Force upload of files even if they match (quicker for many files). Will overwrite frozen cookbooks."
option :freeze,
- :long => "--[no-]freeze",
- :boolean => true,
- :default => false,
- :description => "Freeze cookbooks that get uploaded."
+ long: "--[no-]freeze",
+ boolean: true,
+ default: false,
+ description: "Freeze cookbooks that get uploaded."
option :dry_run,
- :long => "--dry-run",
- :short => "-n",
- :boolean => true,
- :default => false,
- :description => "Don't take action, only print what would happen"
+ long: "--dry-run",
+ short: "-n",
+ boolean: true,
+ default: false,
+ description: "Don't take action, only print what would happen"
option :diff,
- :long => "--[no-]diff",
- :boolean => true,
- :default => true,
- :description => "Turn off to avoid uploading existing files; only new (and possibly deleted) files with --no-diff"
+ long: "--[no-]diff",
+ boolean: true,
+ default: true,
+ description: "Turn off to avoid uploading existing files; only new (and possibly deleted) files with --no-diff"
def run
if name_args.length == 0
diff --git a/lib/chef/knife/user_create.rb b/lib/chef/knife/user_create.rb
index c4a89f3707..9273f0344d 100644
--- a/lib/chef/knife/user_create.rb
+++ b/lib/chef/knife/user_create.rb
@@ -32,31 +32,31 @@ class Chef
end
option :file,
- :short => "-f FILE",
- :long => "--file FILE",
- :description => "Write the private key to a file if the server generated one."
+ short: "-f FILE",
+ long: "--file FILE",
+ description: "Write the private key to a file if the server generated one."
option :user_key,
- :long => "--user-key FILENAME",
- :description => "Set the initial default key for the user from a file on disk (cannot pass with --prevent-keygen)."
+ long: "--user-key FILENAME",
+ description: "Set the initial default key for the user from a file on disk (cannot pass with --prevent-keygen)."
option :prevent_keygen,
- :short => "-k",
- :long => "--prevent-keygen",
- :description => "API V1 (Chef Server 12.1+) only. Prevent server from generating a default key pair for you. Cannot be passed with --user-key.",
- :boolean => true
+ short: "-k",
+ long: "--prevent-keygen",
+ description: "API V1 (Chef Server 12.1+) only. Prevent server from generating a default key pair for you. Cannot be passed with --user-key.",
+ boolean: true
option :admin,
- :short => "-a",
- :long => "--admin",
- :description => "DEPRECATED: Open Source Chef 11 only. Create the user as an admin.",
- :boolean => true
+ short: "-a",
+ long: "--admin",
+ description: "DEPRECATED: Open Source Chef 11 only. Create the user as an admin.",
+ boolean: true
option :user_password,
- :short => "-p PASSWORD",
- :long => "--password PASSWORD",
- :description => "DEPRECATED: Open Source Chef 11 only. Password for newly created user.",
- :default => ""
+ short: "-p PASSWORD",
+ long: "--password PASSWORD",
+ description: "DEPRECATED: Open Source Chef 11 only. Password for newly created user.",
+ default: ""
banner "knife user create USERNAME DISPLAY_NAME FIRST_NAME LAST_NAME EMAIL PASSWORD (options)"
diff --git a/lib/chef/knife/user_list.rb b/lib/chef/knife/user_list.rb
index 88e834025d..eccb8d15a4 100644
--- a/lib/chef/knife/user_list.rb
+++ b/lib/chef/knife/user_list.rb
@@ -32,9 +32,9 @@ class Chef
banner "knife user list (options)"
option :with_uri,
- :short => "-w",
- :long => "--with-uri",
- :description => "Show corresponding URIs"
+ short: "-w",
+ long: "--with-uri",
+ description: "Show corresponding URIs"
def run
output(format_list_for_display(Chef::UserV1.list))
diff --git a/lib/chef/knife/user_reregister.rb b/lib/chef/knife/user_reregister.rb
index fec6792134..b993dfc636 100644
--- a/lib/chef/knife/user_reregister.rb
+++ b/lib/chef/knife/user_reregister.rb
@@ -50,9 +50,9 @@ EOF
end
option :file,
- :short => "-f FILE",
- :long => "--file FILE",
- :description => "Write the private key to a file"
+ short: "-f FILE",
+ long: "--file FILE",
+ description: "Write the private key to a file"
def run
@user_name = @name_args[0]
diff --git a/lib/chef/knife/xargs.rb b/lib/chef/knife/xargs.rb
index f663b480e8..bb3ce39717 100644
--- a/lib/chef/knife/xargs.rb
+++ b/lib/chef/knife/xargs.rb
@@ -30,61 +30,61 @@ class Chef
# TODO modify to remote-only / local-only pattern (more like delete)
option :local,
- :long => "--local",
- :boolean => true,
- :description => "Xargs local files instead of remote"
+ long: "--local",
+ boolean: true,
+ description: "Xargs local files instead of remote"
option :patterns,
- :long => "--pattern [PATTERN]",
- :short => "-p [PATTERN]",
- :description => "Pattern on command line (if these are not specified, a list of patterns is expected on standard input). Multiple patterns may be passed in this way.",
- :arg_arity => [1, -1]
+ long: "--pattern [PATTERN]",
+ short: "-p [PATTERN]",
+ description: "Pattern on command line (if these are not specified, a list of patterns is expected on standard input). Multiple patterns may be passed in this way.",
+ arg_arity: [1, -1]
option :diff,
- :long => "--[no-]diff",
- :default => true,
- :boolean => true,
- :description => "Whether to show a diff when files change (default: true)"
+ long: "--[no-]diff",
+ default: true,
+ boolean: true,
+ description: "Whether to show a diff when files change (default: true)"
option :dry_run,
- :long => "--dry-run",
- :boolean => true,
- :description => "Prevents changes from actually being uploaded to the server."
+ long: "--dry-run",
+ boolean: true,
+ description: "Prevents changes from actually being uploaded to the server."
option :force,
- :long => "--[no-]force",
- :boolean => true,
- :default => false,
- :description => "Force upload of files even if they are not changed (quicker and harmless, but doesn't print out what it changed)"
+ long: "--[no-]force",
+ boolean: true,
+ default: false,
+ description: "Force upload of files even if they are not changed (quicker and harmless, but doesn't print out what it changed)"
option :replace_first,
- :long => "--replace-first REPLACESTR",
- :short => "-J REPLACESTR",
- :description => "String to replace with filenames. -J will only replace the FIRST occurrence of the replacement string."
+ long: "--replace-first REPLACESTR",
+ short: "-J REPLACESTR",
+ description: "String to replace with filenames. -J will only replace the FIRST occurrence of the replacement string."
option :replace_all,
- :long => "--replace REPLACESTR",
- :short => "-I REPLACESTR",
- :description => "String to replace with filenames. -I will replace ALL occurrence of the replacement string."
+ long: "--replace REPLACESTR",
+ short: "-I REPLACESTR",
+ description: "String to replace with filenames. -I will replace ALL occurrence of the replacement string."
option :max_arguments_per_command,
- :long => "--max-args MAXARGS",
- :short => "-n MAXARGS",
- :description => "Maximum number of arguments per command line."
+ long: "--max-args MAXARGS",
+ short: "-n MAXARGS",
+ description: "Maximum number of arguments per command line."
option :max_command_line,
- :long => "--max-chars LENGTH",
- :short => "-s LENGTH",
- :description => "Maximum size of command line, in characters"
+ long: "--max-chars LENGTH",
+ short: "-s LENGTH",
+ description: "Maximum size of command line, in characters"
option :verbose_commands,
- :short => "-t",
- :description => "Print command to be run on the command line"
+ short: "-t",
+ description: "Print command to be run on the command line"
option :null_separator,
- :short => "-0",
- :boolean => true,
- :description => "Use the NULL character (\0) as a separator, instead of whitespace"
+ short: "-0",
+ boolean: true,
+ description: "Use the NULL character (\0) as a separator, instead of whitespace"
def run
error = false
@@ -175,7 +175,7 @@ class Chef
# Create the temporary files
files.each do |file|
tempfile = Tempfile.new(file.name)
- tempfiles[tempfile] = { :file => file }
+ tempfiles[tempfile] = { file: file }
end
rescue
destroy_tempfiles(files)