summaryrefslogtreecommitdiff
path: root/lib/chef/resource
diff options
context:
space:
mode:
authorTim Smith <tsmith@chef.io>2018-03-04 20:15:36 -0800
committerTim Smith <tsmith@chef.io>2018-03-04 20:19:03 -0800
commita96e2311e2bfb59b750ac11cb290cd17d02fef71 (patch)
treeb682d37033587c76ed645c829b3f6c861914cb1a /lib/chef/resource
parente0a14935df0c0dd34fdaa8d3228d5d83e4a7cfbd (diff)
downloadchef-a96e2311e2bfb59b750ac11cb290cd17d02fef71.tar.gz
Updates from the reviewmisc_resource
Signed-off-by: Tim Smith <tsmith@chef.io>
Diffstat (limited to 'lib/chef/resource')
-rw-r--r--lib/chef/resource/build_essential.rb2
-rw-r--r--lib/chef/resource/chef_gem.rb2
-rw-r--r--lib/chef/resource/file.rb6
-rw-r--r--lib/chef/resource/gem_package.rb2
-rw-r--r--lib/chef/resource/ips_package.rb2
-rw-r--r--lib/chef/resource/macos_userdefaults.rb24
-rw-r--r--lib/chef/resource/openssl_rsa_private_key.rb2
-rw-r--r--lib/chef/resource/windows_feature.rb4
-rw-r--r--lib/chef/resource/windows_feature_dism.rb2
-rw-r--r--lib/chef/resource/windows_feature_powershell.rb4
-rw-r--r--lib/chef/resource/windows_pagefile.rb4
-rw-r--r--lib/chef/resource/windows_printer.rb7
-rw-r--r--lib/chef/resource/windows_printer_port.rb4
-rw-r--r--lib/chef/resource/zypper_package.rb2
-rw-r--r--lib/chef/resource/zypper_repository.rb12
15 files changed, 36 insertions, 43 deletions
diff --git a/lib/chef/resource/build_essential.rb b/lib/chef/resource/build_essential.rb
index 1885471cb8..8977444692 100644
--- a/lib/chef/resource/build_essential.rb
+++ b/lib/chef/resource/build_essential.rb
@@ -25,7 +25,7 @@ class Chef
description "Use the build_essential resource to install packages required for compiling C software from source"
introduced "14.0"
- property :compile_time, [true, false],
+ property :compile_time, [TrueClass, FalseClass],
description: "Install build essential packages at compile time.",
default: false
diff --git a/lib/chef/resource/chef_gem.rb b/lib/chef/resource/chef_gem.rb
index b6bbd0e209..3304690901 100644
--- a/lib/chef/resource/chef_gem.rb
+++ b/lib/chef/resource/chef_gem.rb
@@ -40,7 +40,7 @@ class Chef
callbacks: {
"The chef_gem resource is restricted to the current gem environment, use gem_package to install to other environments." => proc { |v| v == "#{RbConfig::CONFIG['bindir']}/gem" },
}
- property :compile_time, [ true, false ], default: false, desired_state: false
+ property :compile_time, [TrueClass, FalseClass], default: false, desired_state: false
# force the resource to compile time if the compile time property has been set
def after_created
diff --git a/lib/chef/resource/file.rb b/lib/chef/resource/file.rb
index 98341ff940..341b106720 100644
--- a/lib/chef/resource/file.rb
+++ b/lib/chef/resource/file.rb
@@ -52,13 +52,13 @@ class Chef
allowed_actions :create, :delete, :touch, :create_if_missing
property :path, String, name_property: true, identity: true
- property :atomic_update, [ true, false ], desired_state: false, default: lazy { |r| r.docker? && r.special_docker_files?(r.path) ? false : Chef::Config[:file_atomic_update] }
+ property :atomic_update, [ TrueClass, FalseClass ], desired_state: false, default: lazy { |r| r.docker? && r.special_docker_files?(r.path) ? false : Chef::Config[:file_atomic_update] }
property :backup, [ Integer, false ], desired_state: false, default: 5
property :checksum, [ /^[a-zA-Z0-9]{64}$/, nil ]
property :content, [ String, nil ], desired_state: false
property :diff, [ String, nil ], desired_state: false
- property :force_unlink, [ true, false ], desired_state: false, default: false
- property :manage_symlink_source, [ true, false ], desired_state: false
+ property :force_unlink, [ TrueClass, FalseClass ], desired_state: false, default: false
+ property :manage_symlink_source, [ TrueClass, FalseClass ], desired_state: false
property :verifications, Array, default: lazy { [] }
def verify(command = nil, opts = {}, &block)
diff --git a/lib/chef/resource/gem_package.rb b/lib/chef/resource/gem_package.rb
index 1f9bae614d..ee1262cb47 100644
--- a/lib/chef/resource/gem_package.rb
+++ b/lib/chef/resource/gem_package.rb
@@ -40,7 +40,7 @@ class Chef
# FIXME? the array form of installing paths most likely does not work?
#
property :source, [ String, Array ]
- property :clear_sources, [ true, false ], default: false, desired_state: false
+ property :clear_sources, [ TrueClass, FalseClass ], default: false, desired_state: false
# Sets a custom gem_binary to run for gem commands.
property :gem_binary, String, desired_state: false
diff --git a/lib/chef/resource/ips_package.rb b/lib/chef/resource/ips_package.rb
index 88a9f182d4..079cc27231 100644
--- a/lib/chef/resource/ips_package.rb
+++ b/lib/chef/resource/ips_package.rb
@@ -30,7 +30,7 @@ class Chef
allowed_actions :install, :remove, :upgrade
- property :accept_license, [ true, false ], default: false, desired_state: false
+ property :accept_license, [TrueClass, FalseClass], default: false, desired_state: false
end
end
end
diff --git a/lib/chef/resource/macos_userdefaults.rb b/lib/chef/resource/macos_userdefaults.rb
index 08badc4c84..45be356d1b 100644
--- a/lib/chef/resource/macos_userdefaults.rb
+++ b/lib/chef/resource/macos_userdefaults.rb
@@ -31,43 +31,35 @@ class Chef
" man page for details on how the tool works."
introduced "14.0"
- property :domain,
- String,
+ property :domain, String,
description: "The domain the defaults belong to.",
required: true
- property :global,
- [true, false],
+ property :global, [TrueClass, FalseClass],
description: "Whether the domain is global.",
default: false
- property :key,
- String,
+ property :key, String,
description: "The preference key."
- property :value,
- [Integer, Float, String, true, false, Hash, Array],
+ property :value, [Integer, Float, String, TrueClass, FalseClass, Hash, Array],
description: "The value of the key.",
coerce: proc { |v| coerce_booleans(v) },
required: true
- property :type,
- String,
+ property :type, String,
description: "Value type of the preference key.",
default: ""
- property :user,
- String,
+ property :user, String,
description: "User for which to set the default."
- property :sudo,
- [true, false],
+ property :sudo, [TrueClass, FalseClass],
description: "Set to true if the setting requires privileged access to modify.",
default: false,
desired_state: false
- property :is_set,
- [true, false],
+ property :is_set, [TrueClass, FalseClass],
description: "",
default: false,
desired_state: false
diff --git a/lib/chef/resource/openssl_rsa_private_key.rb b/lib/chef/resource/openssl_rsa_private_key.rb
index d08e9783fa..352d802175 100644
--- a/lib/chef/resource/openssl_rsa_private_key.rb
+++ b/lib/chef/resource/openssl_rsa_private_key.rb
@@ -63,7 +63,7 @@ class Chef
description: "The permission mode of all files created by the resource.",
default: "0600"
- property :force, [true, false],
+ property :force, [TrueClass, FalseClass],
description: "Force creating the key even if the existing key exists.",
default: false
diff --git a/lib/chef/resource/windows_feature.rb b/lib/chef/resource/windows_feature.rb
index 91c19dbc29..84778e2bcb 100644
--- a/lib/chef/resource/windows_feature.rb
+++ b/lib/chef/resource/windows_feature.rb
@@ -36,11 +36,11 @@ class Chef
property :source, String,
description: "Use a local repository for the feature install."
- property :all, [true, false],
+ property :all, [TrueClass, FalseClass],
description: "Install all sub features.",
default: false
- property :management_tools, [true, false],
+ property :management_tools, [TrueClass, FalseClass],
description: "Install all applicable management tools of the roles, role services, or features (PowerShell only).",
default: false
diff --git a/lib/chef/resource/windows_feature_dism.rb b/lib/chef/resource/windows_feature_dism.rb
index d6f23f49c5..00fc7f71ca 100644
--- a/lib/chef/resource/windows_feature_dism.rb
+++ b/lib/chef/resource/windows_feature_dism.rb
@@ -36,7 +36,7 @@ class Chef
property :source, String,
description: "Use a local repository for the feature install."
- property :all, [true, false],
+ property :all, [TrueClass, FalseClass],
description: "Install all sub features. This is the equivalent of specifying the /All switch to dism.exe",
default: false
diff --git a/lib/chef/resource/windows_feature_powershell.rb b/lib/chef/resource/windows_feature_powershell.rb
index 65fa3cc40b..7e7fb6c160 100644
--- a/lib/chef/resource/windows_feature_powershell.rb
+++ b/lib/chef/resource/windows_feature_powershell.rb
@@ -39,7 +39,7 @@ class Chef
property :source, String,
description: "Use a local repository for the feature install."
- property :all, [true, false],
+ property :all, [TrueClass, FalseClass],
description: "Install all sub features. This is equivalent to using the"\
" -InstallAllSubFeatures switch with Add-WindowsFeature.",
default: false
@@ -48,7 +48,7 @@ class Chef
description: "Specifies a timeout (in seconds) for feature install.",
default: 600
- property :management_tools, [true, false],
+ property :management_tools, [TrueClass, FalseClass],
description: "",
default: false
diff --git a/lib/chef/resource/windows_pagefile.rb b/lib/chef/resource/windows_pagefile.rb
index 849f948a26..b87134171b 100644
--- a/lib/chef/resource/windows_pagefile.rb
+++ b/lib/chef/resource/windows_pagefile.rb
@@ -31,10 +31,10 @@ class Chef
description: "The path to the pagefile if different from the resource name.",
name_property: true
- property :system_managed, [true, false],
+ property :system_managed, [TrueClass, FalseClass],
description: "Configures whether the system manages the pagefile size."
- property :automatic_managed, [true, false],
+ property :automatic_managed, [TrueClass, FalseClass],
description: "Enable automatic management of pagefile initial and maximum size. Setting this to true ignores 'initial_size' and 'maximum_size' properties.",
default: false
diff --git a/lib/chef/resource/windows_printer.rb b/lib/chef/resource/windows_printer.rb
index c134e27bf7..3ad12e35c7 100644
--- a/lib/chef/resource/windows_printer.rb
+++ b/lib/chef/resource/windows_printer.rb
@@ -39,7 +39,7 @@ class Chef
property :comment, String,
description: "Optional descriptor for the printer queue."
- property :default, [true, false],
+ property :default, [TrueClass, FalseClass],
description: "Should this be the system's default printer.",
default: false
@@ -50,7 +50,7 @@ class Chef
property :location, String,
description: "Printer location, e.g. 'Fifth floor copy room'."
- property :shared, [true, false],
+ property :shared, [TrueClass, FalseClass],
description: "Should the printer be shared.",
default: false
@@ -62,7 +62,8 @@ class Chef
validation_message: "The ipv4_address property must be in the IPv4 format of WWW.XXX.YYY.ZZZ",
regex: Resolv::IPv4::Regex
- property :exists, [true, false], desired_state: true
+ property :exists, [TrueClass, FalseClass],
+ desired_state: true
PRINTERS_REG_KEY = 'HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Print\Printers\\'.freeze unless defined?(PRINTERS_REG_KEY)
diff --git a/lib/chef/resource/windows_printer_port.rb b/lib/chef/resource/windows_printer_port.rb
index 9da43948f6..6d2b293e9f 100644
--- a/lib/chef/resource/windows_printer_port.rb
+++ b/lib/chef/resource/windows_printer_port.rb
@@ -46,7 +46,7 @@ class Chef
property :port_description, String,
description: "The description of the port."
- property :snmp_enabled, [true, false],
+ property :snmp_enabled, [TrueClass, FalseClass],
description: "Should SNMP be enabled on the port.",
default: false
@@ -55,7 +55,7 @@ class Chef
validation_message: "port_protocol must be either 1 for RAW or 2 for LPR!",
default: 1, equal_to: [1, 2]
- property :exists, [true, false],
+ property :exists, [TrueClass, FalseClass],
desired_state: true
PORTS_REG_KEY = 'HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Print\Monitors\Standard TCP/IP Port\Ports\\'.freeze unless defined?(PORTS_REG_KEY)
diff --git a/lib/chef/resource/zypper_package.rb b/lib/chef/resource/zypper_package.rb
index 2e48caef55..23b8779f25 100644
--- a/lib/chef/resource/zypper_package.rb
+++ b/lib/chef/resource/zypper_package.rb
@@ -29,7 +29,7 @@ class Chef
" packages with Zypper for the SUSE Enterprise and OpenSUSE platforms."
property :gpg_check, [ TrueClass, FalseClass ], default: lazy { Chef::Config[:zypper_check_gpg] }
- property :allow_downgrade, [ true, false ], default: false
+ property :allow_downgrade, [ TrueClass, FalseClass ], default: false
end
end
end
diff --git a/lib/chef/resource/zypper_repository.rb b/lib/chef/resource/zypper_repository.rb
index 298373b87d..776c7a407f 100644
--- a/lib/chef/resource/zypper_repository.rb
+++ b/lib/chef/resource/zypper_repository.rb
@@ -33,20 +33,20 @@ class Chef
property :repo_name, String, name_property: true
property :description, String
property :type, String, default: "NONE"
- property :enabled, [true, false], default: true
- property :autorefresh, [true, false], default: true
- property :gpgcheck, [true, false], default: true
+ property :enabled, [TrueClass, FalseClass], default: true
+ property :autorefresh, [TrueClass, FalseClass], default: true
+ property :gpgcheck, [TrueClass, FalseClass], default: true
property :gpgkey, String
property :baseurl, String
property :mirrorlist, String
property :path, String
property :priority, Integer, default: 99
- property :keeppackages, [true, false], default: false
+ property :keeppackages, [TrueClass, FalseClass], default: false
property :mode, default: "0644"
- property :refresh_cache, [true, false], default: true
+ property :refresh_cache, [TrueClass, FalseClass], default: true
property :source, String
property :cookbook, String
- property :gpgautoimportkeys, [true, false], default: true
+ property :gpgautoimportkeys, [TrueClass, FalseClass], default: true
default_action :create
allowed_actions :create, :remove, :add, :refresh