Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Harden codebase and add documentation stubs #974

Merged
merged 2 commits into from
Mar 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions .puppet-lint.rc
Original file line number Diff line number Diff line change
@@ -1,3 +1 @@
--fail-on-warnings
--no-parameter_documentation-check
--no-parameter_types-check
4 changes: 4 additions & 0 deletions .sync.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,7 @@
spec/spec_helper.rb:
spec_overrides: "require 'spec_helper_local'"
mock_with: ':mocha'
.puppet-lint.rc:
enabled_lint_checks:
- parameter_documentation
- parameter_types
80 changes: 43 additions & 37 deletions REFERENCE.md
Original file line number Diff line number Diff line change
Expand Up @@ -247,6 +247,8 @@ The following parameters are available in the `rabbitmq` class:
* [`package_apt_pin`](#-rabbitmq--package_apt_pin)
* [`package_ensure`](#-rabbitmq--package_ensure)
* [`package_gpg_key`](#-rabbitmq--package_gpg_key)
* [`package_source`](#-rabbitmq--package_source)
* [`package_provider`](#-rabbitmq--package_provider)
* [`repo_gpg_key`](#-rabbitmq--repo_gpg_key)
* [`package_name`](#-rabbitmq--package_name)
* [`port`](#-rabbitmq--port)
Expand All @@ -271,6 +273,7 @@ The following parameters are available in the `rabbitmq` class:
* [`ssl_management_cacert`](#-rabbitmq--ssl_management_cacert)
* [`ssl_management_cert`](#-rabbitmq--ssl_management_cert)
* [`ssl_management_key`](#-rabbitmq--ssl_management_key)
* [`ssl_management_fail_if_no_peer_cert`](#-rabbitmq--ssl_management_fail_if_no_peer_cert)
* [`ssl_port`](#-rabbitmq--ssl_port)
* [`ssl_reuse_sessions`](#-rabbitmq--ssl_reuse_sessions)
* [`ssl_secure_renegotiate`](#-rabbitmq--ssl_secure_renegotiate)
Expand All @@ -297,9 +300,6 @@ The following parameters are available in the `rabbitmq` class:
* [`rabbitmqadmin_package`](#-rabbitmq--rabbitmqadmin_package)
* [`archive_options`](#-rabbitmq--archive_options)
* [`loopback_users`](#-rabbitmq--loopback_users)
* [`package_source`](#-rabbitmq--package_source)
* [`package_provider`](#-rabbitmq--package_provider)
* [`ssl_management_fail_if_no_peer_cert`](#-rabbitmq--ssl_management_fail_if_no_peer_cert)

##### <a name="-rabbitmq--admin_enable"></a>`admin_enable`

Expand Down Expand Up @@ -737,6 +737,22 @@ RPM package GPG key to import. Uses source method. Should be a URL for Debian/Re
RedHat OS family. Set to https://github.com/rabbitmq/signing-keys/releases/download/2.0/rabbitmq-release-signing-key.asc
for Debian/RedHat OS Family by default.

Default value: `undef`

##### <a name="-rabbitmq--package_source"></a>`package_source`

Data type: `Optional[String]`



Default value: `undef`

##### <a name="-rabbitmq--package_provider"></a>`package_provider`

Data type: `Optional[String]`



Default value: `undef`

##### <a name="-rabbitmq--repo_gpg_key"></a>`repo_gpg_key`
Expand Down Expand Up @@ -937,6 +953,14 @@ SSL management key. If unset set to ssl_key for backwards compatibility.

Default value: `$ssl_key`

##### <a name="-rabbitmq--ssl_management_fail_if_no_peer_cert"></a>`ssl_management_fail_if_no_peer_cert`

Data type: `Boolean`



Default value: `false`

##### <a name="-rabbitmq--ssl_port"></a>`ssl_port`

Data type: `Integer[1, 65535]`
Expand Down Expand Up @@ -1155,30 +1179,6 @@ This option configures a list of users to allow access via the loopback interfac

Default value: `['guest']`

##### <a name="-rabbitmq--package_source"></a>`package_source`

Data type: `Optional[String]`



Default value: `undef`

##### <a name="-rabbitmq--package_provider"></a>`package_provider`

Data type: `Optional[String]`



Default value: `undef`

##### <a name="-rabbitmq--ssl_management_fail_if_no_peer_cert"></a>`ssl_management_fail_if_no_peer_cert`

Data type: `Boolean`



Default value: `false`

## Resource types

### <a name="rabbitmq_binding"></a>`rabbitmq_binding`
Expand Down Expand Up @@ -1260,7 +1260,7 @@ Default value: `queue`

Valid values: `present`, `absent`

The basic property that the resource should be in.
Whether the resource should be present or absent

Default value: `present`

Expand Down Expand Up @@ -1358,7 +1358,7 @@ The following properties are available in the `rabbitmq_cluster` type.

Valid values: `present`, `absent`

The basic property that the resource should be in.
Whether the resource should be present or absent

Default value: `present`

Expand Down Expand Up @@ -1439,11 +1439,13 @@ The following parameters are available in the `rabbitmq_erlang_cookie` type.

Valid values: `true`, `false`

Force parameter

Default value: `false`

##### <a name="-rabbitmq_erlang_cookie--path"></a>`path`

Path of the erlang cookie

##### <a name="-rabbitmq_erlang_cookie--provider"></a>`provider`

Expand All @@ -1452,23 +1454,27 @@ will usually discover the appropriate provider for your platform.

##### <a name="-rabbitmq_erlang_cookie--rabbitmq_group"></a>`rabbitmq_group`

Rabbitmq Group

Default value: `rabbitmq`

##### <a name="-rabbitmq_erlang_cookie--rabbitmq_home"></a>`rabbitmq_home`

Path to the rabbitmq home directory

Default value: `/var/lib/rabbitmq`

##### <a name="-rabbitmq_erlang_cookie--rabbitmq_user"></a>`rabbitmq_user`

Rabbitmq User

Default value: `rabbitmq`

##### <a name="-rabbitmq_erlang_cookie--service_name"></a>`service_name`

Valid values: `%r{^\S+$}`

Name of the service

### <a name="rabbitmq_exchange"></a>`rabbitmq_exchange`

Expand Down Expand Up @@ -1501,7 +1507,7 @@ The following properties are available in the `rabbitmq_exchange` type.

Valid values: `present`, `absent`

The basic property that the resource should be in.
Whether the resource should be present or absent

Default value: `present`

Expand Down Expand Up @@ -1635,7 +1641,7 @@ The component_name to use when setting parameter, eg: shovel or federation

Valid values: `present`, `absent`

The basic property that the resource should be in.
Whether the resource should be present or absent

Default value: `present`

Expand Down Expand Up @@ -1709,7 +1715,7 @@ The following properties are available in the `rabbitmq_plugin` type.

Valid values: `present`, `absent`

The basic property that the resource should be in.
Whether the resource should be present or absent

Default value: `present`

Expand Down Expand Up @@ -1789,7 +1795,7 @@ policy definition

Valid values: `present`, `absent`

The basic property that the resource should be in.
Whether the resource should be present or absent

Default value: `present`

Expand Down Expand Up @@ -1855,7 +1861,7 @@ The following properties are available in the `rabbitmq_queue` type.

Valid values: `present`, `absent`

The basic property that the resource should be in.
Whether the resource should be present or absent

Default value: `present`

Expand Down Expand Up @@ -1970,7 +1976,7 @@ Default value: `false`

Valid values: `present`, `absent`

The basic property that the resource should be in.
Whether the resource should be present or absent

Default value: `present`

Expand Down Expand Up @@ -2032,7 +2038,7 @@ regexp representing configuration permissions

Valid values: `present`, `absent`

The basic property that the resource should be in.
Whether the resource should be present or absent

Default value: `present`

Expand Down Expand Up @@ -2105,7 +2111,7 @@ A description of the vhost

Valid values: `present`, `absent`

The basic property that the resource should be in.
Whether the resource should be present or absent

Default value: `present`

Expand Down
1 change: 1 addition & 0 deletions lib/puppet/provider/rabbitmq_binding/rabbitmqadmin.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

require File.expand_path(File.join(File.dirname(__FILE__), '..', 'rabbitmq_cli'))
Puppet::Type.type(:rabbitmq_binding).provide(:rabbitmqadmin, parent: Puppet::Provider::RabbitmqCli) do
desc 'Rabbitmqadmin provider for rabbitmq binding'
confine feature: :posix

# Without this, the composite namevar stuff doesn't work properly.
Expand Down
1 change: 1 addition & 0 deletions lib/puppet/provider/rabbitmq_cluster/rabbitmqctl.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
:rabbitmqctl,
parent: Puppet::Provider::RabbitmqCli
) do
desc 'Rabbitmqctl provider for rabbitmq cluster'
confine feature: :posix

def exists?
Expand Down
1 change: 1 addition & 0 deletions lib/puppet/provider/rabbitmq_erlang_cookie/ruby.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
require 'puppet'
require 'set'
Puppet::Type.type(:rabbitmq_erlang_cookie).provide(:ruby) do
desc 'Ruby provider for rabbitmq erlang cookie'
confine feature: :posix

def exists?
Expand Down
1 change: 1 addition & 0 deletions lib/puppet/provider/rabbitmq_exchange/rabbitmqadmin.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
require 'puppet'
require File.expand_path(File.join(File.dirname(__FILE__), '..', 'rabbitmq_cli'))
Puppet::Type.type(:rabbitmq_exchange).provide(:rabbitmqadmin, parent: Puppet::Provider::RabbitmqCli) do
desc 'Rabbitmqadmin provider for rabbitmq exchange'
confine feature: :posix

def should_vhost
Expand Down
1 change: 1 addition & 0 deletions lib/puppet/provider/rabbitmq_parameter/rabbitmqctl.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

require File.expand_path(File.join(File.dirname(__FILE__), '..', 'rabbitmq_cli'))
Puppet::Type.type(:rabbitmq_parameter).provide(:rabbitmqctl, parent: Puppet::Provider::RabbitmqCli) do
desc 'Rabbitmqctl provider for rabbitmq parameter'
confine feature: :posix

mk_resource_methods
Expand Down
1 change: 1 addition & 0 deletions lib/puppet/provider/rabbitmq_plugin/rabbitmqplugins.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

require File.expand_path(File.join(File.dirname(__FILE__), '..', 'rabbitmq_cli'))
Puppet::Type.type(:rabbitmq_plugin).provide(:rabbitmqplugins, parent: Puppet::Provider::RabbitmqCli) do
desc 'Rabbitmqplugins provider for rabbitmq plugin'
confine feature: :posix

def self.plugin_list
Expand Down
1 change: 1 addition & 0 deletions lib/puppet/provider/rabbitmq_policy/rabbitmqctl.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

require File.expand_path(File.join(File.dirname(__FILE__), '..', 'rabbitmq_cli'))
Puppet::Type.type(:rabbitmq_policy).provide(:rabbitmqctl, parent: Puppet::Provider::RabbitmqCli) do
desc 'Rabbitmqctl provider for rabbitmq policy'
confine feature: :posix

# cache policies
Expand Down
1 change: 1 addition & 0 deletions lib/puppet/provider/rabbitmq_queue/rabbitmqadmin.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

require File.expand_path(File.join(File.dirname(__FILE__), '..', 'rabbitmq_cli'))
Puppet::Type.type(:rabbitmq_queue).provide(:rabbitmqadmin, parent: Puppet::Provider::RabbitmqCli) do
desc 'Rabbitmqadmin provider for rabbitmq queue'
confine feature: :posix

def should_vhost
Expand Down
1 change: 1 addition & 0 deletions lib/puppet/provider/rabbitmq_user/rabbitmqctl.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
:rabbitmqctl,
parent: Puppet::Provider::RabbitmqCli
) do
desc 'Rabbitmqctl provider for rabbitmq user'
confine feature: :posix

def initialize(value = {})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

require File.expand_path(File.join(File.dirname(__FILE__), '..', 'rabbitmq_cli'))
Puppet::Type.type(:rabbitmq_user_permissions).provide(:rabbitmqctl, parent: Puppet::Provider::RabbitmqCli) do
desc 'Rabbitmqctl provider for rabbitmq user permissions'
confine feature: :posix

# cache users permissions
Expand Down
1 change: 1 addition & 0 deletions lib/puppet/provider/rabbitmq_vhost/rabbitmqctl.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
:rabbitmqctl,
parent: Puppet::Provider::RabbitmqCli
) do
desc 'Rabbitmqctl provider for rabbitmq vhost'
confine feature: :posix

def self.prefetch(resources)
Expand Down
1 change: 1 addition & 0 deletions lib/puppet/type/rabbitmq_binding.rb
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
DESC

ensurable do
desc 'Whether the resource should be present or absent'
defaultto(:present)
newvalue(:present) do
provider.create
Expand Down
1 change: 1 addition & 0 deletions lib/puppet/type/rabbitmq_cluster.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
DESC

ensurable do
desc 'Whether the resource should be present or absent'
defaultto(:present)
newvalue(:present) do
provider.create
Expand Down
9 changes: 8 additions & 1 deletion lib/puppet/type/rabbitmq_erlang_cookie.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,9 @@
this type directly.
DESC

newparam(:path, namevar: true)
newparam(:path, namevar: true) do
desc 'Path of the erlang cookie'
end

newproperty(:content) do
desc 'Content of cookie'
Expand All @@ -33,23 +35,28 @@ def should_to_s(_value)
end

newparam(:force) do
desc 'Force parameter'
defaultto(:false)
newvalues(:true, :false)
end

newparam(:rabbitmq_user) do
desc 'Rabbitmq User'
defaultto('rabbitmq')
end

newparam(:rabbitmq_group) do
desc 'Rabbitmq Group'
defaultto('rabbitmq')
end

newparam(:rabbitmq_home) do
desc 'Path to the rabbitmq home directory'
defaultto('/var/lib/rabbitmq')
end

newparam(:service_name) do
desc 'Name of the service'
newvalues(%r{^\S+$})
end
end
1 change: 1 addition & 0 deletions lib/puppet/type/rabbitmq_exchange.rb
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
DESC

ensurable do
desc 'Whether the resource should be present or absent'
defaultto(:present)
newvalue(:present) do
provider.create
Expand Down
1 change: 1 addition & 0 deletions lib/puppet/type/rabbitmq_parameter.rb
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
DESC

ensurable do
desc 'Whether the resource should be present or absent'
defaultto(:present)
newvalue(:present) do
provider.create
Expand Down
Loading
Loading