summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/chef/resource/homebrew_package.rb3
-rw-r--r--lib/chef/resource/http_request.rb7
-rw-r--r--lib/chef/resource/ifconfig.rb74
-rw-r--r--lib/chef/resource/ips_package.rb4
-rw-r--r--lib/chef/resource/launchd.rb303
-rw-r--r--lib/chef/resource/log.rb9
-rw-r--r--lib/chef/resource/mdadm.rb37
7 files changed, 308 insertions, 129 deletions
diff --git a/lib/chef/resource/homebrew_package.rb b/lib/chef/resource/homebrew_package.rb
index dee132a1b4..9d8c7b2596 100644
--- a/lib/chef/resource/homebrew_package.rb
+++ b/lib/chef/resource/homebrew_package.rb
@@ -30,7 +30,8 @@ class Chef
description "Use the homebrew_package resource to manage packages for the macOS platform."
introduced "12.0"
- property :homebrew_user, [ String, Integer ]
+ property :homebrew_user, [ String, Integer ],
+ description: "The name of the Homebrew owner to be used by the chef-client when executing a command."
end
end
diff --git a/lib/chef/resource/http_request.rb b/lib/chef/resource/http_request.rb
index f209e419dd..3493cec9db 100644
--- a/lib/chef/resource/http_request.rb
+++ b/lib/chef/resource/http_request.rb
@@ -32,8 +32,11 @@ class Chef
default_action :get
allowed_actions :get, :patch, :put, :post, :delete, :head, :options
- property :url, String, identity: true
- property :headers, Hash, default: lazy { Hash.new }
+ property :url, String, identity: true,
+ description: "The URL to which an HTTP request is sent."
+
+ property :headers, Hash, default: lazy { Hash.new },
+ description: "A Hash of custom headers."
def initialize(name, run_context = nil)
super
diff --git a/lib/chef/resource/ifconfig.rb b/lib/chef/resource/ifconfig.rb
index 579a4eeedb..386a655c91 100644
--- a/lib/chef/resource/ifconfig.rb
+++ b/lib/chef/resource/ifconfig.rb
@@ -35,23 +35,63 @@ class Chef
default_action :add
allowed_actions :add, :delete, :enable, :disable
- property :target, String, name_property: true
- property :hwaddr, String
- property :mask, String
- property :family, String, default: "inet"
- property :inet_addr, String
- property :bcast, String
- property :mtu, String
- property :metric, String
- property :device, String, identity: true
- property :onboot, String
- property :network, String
- property :bootproto, String
- property :onparent, String
- property :ethtool_opts, String
- property :bonding_opts, String
- property :master, String
- property :slave, String
+ property :target, String,
+ name_property: true,
+ description: "The IP address that is to be assigned to the network interface. If not specified we'll use the resource's name."
+
+ property :hwaddr, String,
+ description: "The hardware address for the network interface."
+
+ property :mask, String,
+ description: "The decimal representation of the network mask. For example: 255.255.255.0."
+
+ property :family, String,
+ default: "inet", introduced: "14.0",
+ description: "Networking family option for Debian-based systems; for example: inet or inet6."
+
+ property :inet_addr, String,
+ description: "The Internet host address for the network interface."
+
+ property :bcast, String,
+ description: "The broadcast address for a network interface. On some platforms this property is not set using ifconfig, but instead is added to the startup configuration file for the network interface."
+
+ property :mtu, String,
+ description: "The maximum transmission unit (MTU) for the network interface."
+
+ property :metric, String,
+ description: "The routing metric for the interface."
+
+ property :device, String,
+ identity: true,
+ description: "The network interface to be configured."
+
+ property :onboot, String,
+ description: "Bring up the network interface on boot."
+
+ property :network, String,
+ description: "The address for the network interface."
+
+ property :bootproto, String,
+ description: "The boot protocol used by a network interface."
+
+ property :onparent, String,
+ description: "Bring up the network interface when its parent interface is brought up."
+
+ property :ethtool_opts, String,
+ introduced: "13.4",
+ description: "Options to be passed to ethtool(8). For example: -A eth0 autoneg off rx off tx off"
+
+ property :bonding_opts, String,
+ introduced: "13.4",
+ description: "Bonding options to pass via BONDING_OPTS on RHEL and CentOS. For example: mode=active-backup miimon=100"
+
+ property :master, String,
+ introduced: "13.4",
+ description: "Specifies the channel bonding interface to which the Ethernet interface is linked."
+
+ property :slave, String,
+ introduced: "13.4",
+ description: "When set to yes, this device is controlled by the channel bonding interface that is specified via the master property."
end
end
end
diff --git a/lib/chef/resource/ips_package.rb b/lib/chef/resource/ips_package.rb
index 70e3bfee81..ff154e8bd8 100644
--- a/lib/chef/resource/ips_package.rb
+++ b/lib/chef/resource/ips_package.rb
@@ -30,7 +30,9 @@ class Chef
allowed_actions :install, :remove, :upgrade
- property :accept_license, [TrueClass, FalseClass], default: false, desired_state: false
+ property :accept_license, [TrueClass, FalseClass],
+ default: false, desired_state: false,
+ description: "Accept an end-user license agreement, automatically."
end
end
end
diff --git a/lib/chef/resource/launchd.rb b/lib/chef/resource/launchd.rb
index 9161efa6ea..530820c82d 100644
--- a/lib/chef/resource/launchd.rb
+++ b/lib/chef/resource/launchd.rb
@@ -30,16 +30,39 @@ class Chef
default_action :create
allowed_actions :create, :create_if_missing, :delete, :enable, :disable, :restart
- property :label, String, identity: true, name_property: true
- property :backup, [Integer, FalseClass], desired_state: false
- property :cookbook, String, desired_state: false
- property :group, [String, Integer]
- property :plist_hash, Hash
- property :mode, [String, Integer]
- property :owner, [String, Integer]
- property :path, String
- property :source, String
- property :session_type, String
+ property :label, String,
+ identity: true, name_property: true,
+ description: "The unique identifier for the job."
+
+ property :backup, [Integer, FalseClass],
+ desired_state: false,
+ description: "The number of backups to be kept in /var/chef/backup. Set to false to prevent backups from being kept."
+
+ property :cookbook, String,
+ desired_state: false,
+ description: "The name of the cookbook in which the source files are located."
+
+ property :group, [String, Integer],
+ description: "When launchd is run as the root user, the group to run the job as. If the username property is specified and this property is not, this value is set to the default group for the user."
+
+ property :plist_hash, Hash,
+ introduced: "12.19",
+ description: "A Hash of key value pairs used to create the launchd property list."
+
+ property :mode, [String, Integer],
+ description: "A quoted 3-5 character string that defines the octal mode. For example: '755', '0755', or 00755."
+
+ property :owner, [String, Integer],
+ description: "A string or ID that identifies the group owner by user name, including fully qualified user names such as domain_user or user@domain. If this value is not specified, existing owners remain unchanged and new owner assignments use the current user (when necessary)."
+
+ property :path, String,
+ description: "The path to the directory. Using a fully qualified path is recommended, but is not always required."
+
+ property :source, String,
+ description: "The path to the launchd property list."
+
+ property :session_type, String,
+ description: "The type of launchd plist to be created. Possible values: system (default) or user."
# StartCalendarInterval has some gotchas so we coerce it to help sanity
# check. According to `man 5 launchd.plist`:
@@ -50,96 +73,180 @@ class Chef
# this means that an entry like:
# { "Hour"=>0, "Weekday"=>"6-7"}
# will not just run on midnight of Sat and Sun, rather it will run _every_ midnight.
- property :start_calendar_interval, [Hash, Array], coerce: proc { |type|
- # Coerce into an array of hashes to make validation easier
- array = if type.is_a?(Array)
- type
- else
- [type]
- end
-
- # Check to make sure that our array only has hashes
- unless array.all? { |obj| obj.is_a?(Hash) }
- error_msg = "start_calendar_interval must be a single hash or an array of hashes!"
- raise Chef::Exceptions::ValidationFailed, error_msg
- end
-
- # Make sure the hashes don't have any incorrect keys/values
- array.each do |entry|
- allowed_keys = %w{Minute Hour Day Weekday Month}
- unless entry.keys.all? { |key| allowed_keys.include?(key) }
- failed_keys = entry.keys.reject { |k| allowed_keys.include?(k) }.join(", ")
- error_msg = "The following key(s): #{failed_keys} are invalid for start_calendar_interval, must be one of: #{allowed_keys.join(", ")}"
- raise Chef::Exceptions::ValidationFailed, error_msg
- end
-
- unless entry.values.all? { |val| val.is_a?(Integer) }
- failed_values = entry.values.reject { |val| val.is_a?(Integer) }.join(", ")
- error_msg = "Invalid value(s) (#{failed_values}) for start_calendar_interval item. Values must be integers!"
- raise Chef::Exceptions::ValidationFailed, error_msg
- end
- end
-
- # Don't return array if we only have one entry
- if array.size == 1
- array.first
- else
- array
- end
- }
-
- property :type, String, default: "daemon", coerce: proc { |type|
- type = type ? type.downcase : "daemon"
- types = %w{daemon agent}
-
- unless types.include?(type)
- error_msg = "type must be daemon or agent"
- raise Chef::Exceptions::ValidationFailed, error_msg
- end
- type
- }
+ property :start_calendar_interval, [Hash, Array],
+ description: "A Hash (similar to crontab) that defines the calendar frequency at which a job is started.",
+ coerce: proc { |type|
+ # Coerce into an array of hashes to make validation easier
+ array = if type.is_a?(Array)
+ type
+ else
+ [type]
+ end
+
+ # Check to make sure that our array only has hashes
+ unless array.all? { |obj| obj.is_a?(Hash) }
+ error_msg = "start_calendar_interval must be a single hash or an array of hashes!"
+ raise Chef::Exceptions::ValidationFailed, error_msg
+ end
+
+ # Make sure the hashes don't have any incorrect keys/values
+ array.each do |entry|
+ allowed_keys = %w{Minute Hour Day Weekday Month}
+ unless entry.keys.all? { |key| allowed_keys.include?(key) }
+ failed_keys = entry.keys.reject { |k| allowed_keys.include?(k) }.join(", ")
+ error_msg = "The following key(s): #{failed_keys} are invalid for start_calendar_interval, must be one of: #{allowed_keys.join(", ")}"
+ raise Chef::Exceptions::ValidationFailed, error_msg
+ end
+
+ unless entry.values.all? { |val| val.is_a?(Integer) }
+ failed_values = entry.values.reject { |val| val.is_a?(Integer) }.join(", ")
+ error_msg = "Invalid value(s) (#{failed_values}) for start_calendar_interval item. Values must be integers!"
+ raise Chef::Exceptions::ValidationFailed, error_msg
+ end
+ end
+
+ # Don't return array if we only have one entry
+ if array.size == 1
+ array.first
+ else
+ array
+ end
+ }
+
+ property :type, String,
+ description: "The type of resource. Possible values: daemon (default), agent.",
+ default: "daemon", coerce: proc { |type|
+ type = type ? type.downcase : "daemon"
+ types = %w{daemon agent}
+
+ unless types.include?(type)
+ error_msg = "type must be daemon or agent"
+ raise Chef::Exceptions::ValidationFailed, error_msg
+ end
+ type
+ }
# Apple LaunchD Keys
- property :abandon_process_group, [ TrueClass, FalseClass ]
- property :debug, [ TrueClass, FalseClass ]
- property :disabled, [ TrueClass, FalseClass ], default: false
- property :enable_globbing, [ TrueClass, FalseClass ]
- property :enable_transactions, [ TrueClass, FalseClass ]
- property :environment_variables, Hash
- property :exit_timeout, Integer
- property :hard_resource_limits, Hash
- property :inetd_compatibility, Hash
- property :init_groups, [ TrueClass, FalseClass ]
- property :keep_alive, [ TrueClass, FalseClass, Hash ]
- property :launch_only_once, [ TrueClass, FalseClass ]
- property :ld_group, String
- property :limit_load_from_hosts, Array
- property :limit_load_to_hosts, Array
- property :limit_load_to_session_type, [ Array, String ]
- property :low_priority_io, [ TrueClass, FalseClass ]
- property :mach_services, Hash
- property :nice, Integer
- property :on_demand, [ TrueClass, FalseClass ]
- property :process_type, String
- property :program, String
- property :program_arguments, Array
- property :queue_directories, Array
- property :root_directory, String
- property :run_at_load, [ TrueClass, FalseClass ]
- property :sockets, Hash
- property :soft_resource_limits, Array
- property :standard_error_path, String
- property :standard_in_path, String
- property :standard_out_path, String
- property :start_interval, Integer
- property :start_on_mount, [ TrueClass, FalseClass ]
- property :throttle_interval, Integer
- property :time_out, Integer
- property :umask, Integer
- property :username, String
- property :wait_for_debugger, [ TrueClass, FalseClass ]
- property :watch_paths, Array
- property :working_directory, String
+ property :abandon_process_group, [ TrueClass, FalseClass ],
+ description: "If a job dies, all remaining processes with the same process ID may be kept running. Set to true to kill all remaining processes."
+
+ property :debug, [ TrueClass, FalseClass ],
+ description: "Sets the log mask to LOG_DEBUG for this job."
+
+ property :disabled, [ TrueClass, FalseClass ], default: false,
+ description: "Hints to launchctl to not submit this job to launchd."
+
+ property :enable_globbing, [ TrueClass, FalseClass ],
+ description: "Update program arguments before invocation."
+
+ property :enable_transactions, [ TrueClass, FalseClass ],
+ description: "Track in-progress transactions; if none, then send the SIGKILL signal."
+
+ property :environment_variables, Hash,
+ description: "Additional environment variables to set before running a job."
+
+ property :exit_timeout, Integer,
+ description: "The amount of time (in seconds) launchd waits before sending a SIGKILL signal."
+
+ property :hard_resource_limits, Hash,
+ description: "A Hash of resource limits to be imposed on a job."
+
+ property :inetd_compatibility, Hash,
+ description: "Specifies if a daemon expects to be run as if it were launched from inetd. Set to wait => true to pass standard input, output, and error file descriptors. Set to wait => false to call the accept system call on behalf of the job, and then pass standard input, output, and error file descriptors."
+
+ property :init_groups, [ TrueClass, FalseClass ],
+ description: "Specify if initgroups is called before running a job."
+
+ property :keep_alive, [ TrueClass, FalseClass, Hash ],
+ introduced: "12.14",
+ description: "Keep a job running continuously (true) or allow demand and conditions on the node to determine if the job keeps running (false)."
+
+ property :launch_only_once, [ TrueClass, FalseClass ],
+ description: "Specify if a job can be run only one time. Set this value to true if a job cannot be restarted without a full machine reboot."
+
+ property :ld_group, String,
+ description: "The group name."
+
+ property :limit_load_from_hosts, Array,
+ description: "An array of hosts to which this configuration file does not apply, i.e. 'apply this configuration file to all hosts not specified in this array'."
+
+ property :limit_load_to_hosts, Array,
+ description: "An array of hosts to which this configuration file applies."
+
+ property :limit_load_to_session_type, [ Array, String ],
+ description: "The session type(s) to which this configuration file applies."
+
+ property :low_priority_io, [ TrueClass, FalseClass ],
+ description: "Specify if the kernel on the node should consider this daemon to be low priority during file system I/O."
+
+ property :mach_services, Hash,
+ description: "Specify services to be registered with the bootstrap subsystem."
+
+ property :nice, Integer,
+ description: "The program scheduling priority value in the range -20 to 20."
+
+ property :on_demand, [ TrueClass, FalseClass ],
+ description: "Keep a job alive. Only applies to macOS version 10.4 (and earlier); use keep_alive instead for newer versions."
+
+ property :process_type, String,
+ description: "The intended purpose of the job: Adaptive, Background, Interactive, or Standard."
+
+ property :program, String,
+ description: "The first argument of execvp, typically the file name associated with the file to be executed. This value must be specified if program_arguments is not specified, and vice-versa."
+
+ property :program_arguments, Array,
+ description: "The second argument of execvp. If program is not specified, this property must be specified and will be handled as if it were the first argument."
+
+ property :queue_directories, Array,
+ description: "An array of non-empty directories which, if any are modified, will cause a job to be started."
+
+ property :root_directory, String,
+ description: "chroot to this directory, and then run the job."
+
+ property :run_at_load, [ TrueClass, FalseClass ],
+ description: "Launch a job once (at the time it is loaded)."
+
+ property :sockets, Hash,
+ description: "A Hash of on-demand sockets that notify launchd when a job should be run."
+
+ property :soft_resource_limits, Array,
+ description: "A Hash of resource limits to be imposed on a job."
+
+ property :standard_error_path, String,
+ description: "The file to which standard error (stderr) is sent."
+
+ property :standard_in_path, String,
+ description: "The file to which standard input (stdin) is sent."
+
+ property :standard_out_path, String,
+ description: "The file to which standard output (stdout) is sent."
+
+ property :start_interval, Integer,
+ description: "The frequency (in seconds) at which a job is started."
+
+ property :start_on_mount, [ TrueClass, FalseClass ],
+ description: "Start a job every time a file system is mounted."
+
+ property :throttle_interval, Integer,
+ description: "The frequency (in seconds) at which jobs are allowed to spawn."
+
+ property :time_out, Integer,
+ description: "The amount of time (in seconds) a job may be idle before it times out. If no value is specified, the default timeout value for launchd will be used."
+
+ property :umask, Integer,
+ description: "A decimal value to pass to umask before running a job."
+
+ property :username, String,
+ description: "When launchd is run as the root user, the user to run the job as."
+
+ property :wait_for_debugger, [ TrueClass, FalseClass ],
+ description: "Specify if launchd has a job wait for a debugger to attach before executing code."
+
+ property :watch_paths, Array,
+ description: "An array of paths which, if any are modified, will cause a job to be started."
+
+ property :working_directory, String,
+ description: "chdir to this directory, and then run the job."
end
end
end
diff --git a/lib/chef/resource/log.rb b/lib/chef/resource/log.rb
index a9dea6b104..0f0f0df082 100644
--- a/lib/chef/resource/log.rb
+++ b/lib/chef/resource/log.rb
@@ -37,8 +37,13 @@ class Chef
" entry that is not built into the resource collection, use Chef::Log instead"\
" of the log resource.)"
- property :message, String, name_property: true, identity: true
- property :level, Symbol, equal_to: [ :debug, :info, :warn, :error, :fatal ], default: :info
+ property :message, String,
+ name_property: true, identity: true,
+ description: "The message to be added to a log file. If not specified we'll use the resource's name instead."
+
+ property :level, Symbol,
+ equal_to: [ :debug, :info, :warn, :error, :fatal ], default: :info,
+ description: "The level of logging that is to be displayed by the Chef Client."
allowed_actions :write
default_action :write
diff --git a/lib/chef/resource/mdadm.rb b/lib/chef/resource/mdadm.rb
index 3b54a53e98..aa36311e2a 100644
--- a/lib/chef/resource/mdadm.rb
+++ b/lib/chef/resource/mdadm.rb
@@ -32,14 +32,35 @@ class Chef
default_action :create
allowed_actions :create, :assemble, :stop
- property :chunk, Integer, default: 16
- property :devices, Array, default: lazy { [] }
- property :exists, [ TrueClass, FalseClass ], default: false
- property :level, Integer, default: 1
- property :metadata, String, default: "0.90"
- property :bitmap, String
- property :raid_device, String, identity: true, name_property: true
- property :layout, String
+ property :chunk, Integer,
+ default: 16,
+ description: "The chunk size. This property should not be used for a RAID 1 mirrored pair (i.e. when the level property is set to 1)."
+
+ property :devices, Array,
+ default: lazy { [] },
+ description: "A comma-separated list of devices to be part of a RAID array"
+
+ property :exists, [ TrueClass, FalseClass ],
+ default: false,
+ description: "Indicates whether the RAID array exists."
+
+ property :level, Integer,
+ default: 1,
+ description: "The RAID level."
+
+ property :metadata, String,
+ default: "0.90",
+ description: "The superblock type for RAID metadata"
+
+ property :bitmap, String,
+ description: "The path to a file in which a write-intent bitmap is stored."
+
+ property :raid_device, String,
+ identity: true, name_property: true,
+ description: "The name of the RAID device. We'll use the resource's name if this isn't specified."
+
+ property :layout, String,
+ description: "The RAID5 parity algorithm. Possible values: left-asymmetric (or la), left-symmetric (or ls), right-asymmetric (or ra), or right-symmetric (or rs)."
end
end
end