diff --git a/REFERENCE.md b/REFERENCE.md new file mode 100644 index 00000000..15aa66d0 --- /dev/null +++ b/REFERENCE.md @@ -0,0 +1,1326 @@ +# Reference + + +## Table of Contents + +**Classes** + +* [`r10k`](#r10k): This class configures r10k +* [`r10k::config`](#r10kconfig): == Class: r10k::config Set up the root r10k config file (/etc/r10k.yaml). === Parameters * [*cachedir*] Path to a directory to be used b +* [`r10k::install`](#r10kinstall): This class is used by the ruby or pe_ruby class +* [`r10k::install::bundle`](#r10kinstallbundle): This class installs the r10k bundle +* [`r10k::install::gem`](#r10kinstallgem): Install the r10k gem using system ruby +* [`r10k::install::puppet_gem`](#r10kinstallpuppet_gem): This class links the r10k binary for Puppet FOSS 4.2 and up +* [`r10k::mcollective`](#r10kmcollective): Install the r10k mcollective agent +* [`r10k::mcollective::application`](#r10kmcollectiveapplication): Install the r10k mcollective application to a client +* [`r10k::params`](#r10kparams): Reasonable defaults for all classes +* [`r10k::postrun_command`](#r10kpostrun_command): This class handles the R10k postrun command. +* [`r10k::prerun_command`](#r10kprerun_command): This class handles the R10k prerun command. +* [`r10k::webhook`](#r10kwebhook): This class creates a github webhoook to allow curl style post-rec scripts +* [`r10k::webhook::config`](#r10kwebhookconfig): == Class: r10k::webhook::config Set up the root r10k config file (/etc/webhook.yaml). === Authors Zack Smith +* [`r10k::webhook::package`](#r10kwebhookpackage): Private class, do not include it directly. Installs the webhook packages + +**Tasks** + +* [`deploy`](#deploy): Trigger an r10k deployment. + +## Classes + +### r10k + +This class configures r10k + +#### Parameters + +The following parameters are available in the `r10k` class. + +##### `remote` + +Data type: `Any` + + + +Default value: $r10k::params::remote + +##### `sources` + +Data type: `Any` + + + +Default value: $r10k::params::sources + +##### `cachedir` + +Data type: `Any` + + + +Default value: $r10k::params::r10k_cache_dir + +##### `configfile` + +Data type: `Any` + + + +Default value: $r10k::params::r10k_config_file + +##### `version` + +Data type: `Any` + + + +Default value: $r10k::params::version + +##### `puppet_master` + +Data type: `Any` + + + +Default value: $r10k::params::puppet_master + +##### `modulepath` + +Data type: `Any` + + + +Default value: $r10k::params::modulepath + +##### `manage_modulepath` + +Data type: `Any` + + + +Default value: $r10k::params::manage_modulepath + +##### `manage_ruby_dependency` + +Data type: `Enum['include','declare','ignore']` + + + +Default value: $r10k::params::manage_ruby_dependency + +##### `r10k_basedir` + +Data type: `Any` + + + +Default value: $r10k::params::r10k_basedir + +##### `package_name` + +Data type: `Any` + + + +Default value: $r10k::params::package_name + +##### `provider` + +Data type: `Any` + + + +Default value: $r10k::params::provider + +##### `gentoo_keywords` + +Data type: `Any` + + + +Default value: $r10k::params::gentoo_keywords + +##### `install_options` + +Data type: `Any` + + + +Default value: $r10k::params::install_options + +##### `mcollective` + +Data type: `Any` + + + +Default value: $r10k::params::mcollective + +##### `manage_configfile_symlink` + +Data type: `Any` + + + +Default value: $r10k::params::manage_configfile_symlink + +##### `configfile_symlink` + +Data type: `Any` + + + +Default value: $r10k::params::configfile_symlink + +##### `git_settings` + +Data type: `Hash` + + + +Default value: $r10k::params::git_settings + +##### `forge_settings` + +Data type: `Hash` + + + +Default value: $r10k::params::forge_settings + +##### `deploy_settings` + +Data type: `Hash` + + + +Default value: $r10k::params::deploy_settings + +##### `root_user` + +Data type: `Any` + + + +Default value: $r10k::params::root_user + +##### `proxy` + +Data type: `Optional[String[1]]` + + + +Default value: $r10k::params::proxy + +##### `root_group` + +Data type: `Any` + + + +Default value: $r10k::params::root_group + +##### `postrun` + +Data type: `Any` + + + +Default value: `undef` + +##### `include_prerun_command` + +Data type: `Boolean` + + + +Default value: `false` + +##### `include_postrun_command` + +Data type: `Boolean` + + + +Default value: `false` + +### r10k::config + +== Class: r10k::config + +Set up the root r10k config file (/etc/r10k.yaml). + +=== Parameters + +* [*cachedir*] + Path to a directory to be used by r10k for caching data. + Default: /var/cache/r10k +* [*sources*] + Hash containing data sources to be used by r10k to create dynamic Puppet + environments. Default: {} +* [*postrun*] + **Optional:** Array containing the parts of a system call. + Example: ['/usr/bin/curl', '-F', 'deploy=done', 'http://my-app.site/endpoint'] + Default: undef +* [*manage_configfile_symlink*] + Boolean to determine if a symlink to the r10k config file is to be managed. + Default: false +* [*configfile_symlink*] + Location of symlink that points to configfile. Default: /etc/r10k.yaml +* [*forge_settings*] + Hash containing settings for downloading modules from the Puppet Forge. +* [*proxy*] + String containing proxy setting for r10k.yaml. + Default: '' + +=== Examples + + class { 'r10k::config': + sources => { + 'somename' => { + 'remote' => 'ssh://git@github.com/someuser/somerepo.git', + 'basedir' => "${::settings::confdir}/environments" + }, + 'someothername' => { + 'remote' => 'ssh://git@github.com/someuser/someotherrepo.git', + 'basedir' => '/some/other/basedir' + }, + }, + } + +== Documentation + +* https://github.com/adrienthebo/r10k#dynamic-environment-configuration + +=== Authors + +Charlie Sharpsteen +Zack Smith + +#### Parameters + +The following parameters are available in the `r10k::config` class. + +##### `configfile` + +Data type: `Any` + + + +Default value: $r10k::params::r10k_config_file + +##### `cachedir` + +Data type: `Any` + + + +Default value: $r10k::params::r10k_cache_dir + +##### `sources` + +Data type: `Optional[Hash]` + + + +Default value: $r10k::params::sources + +##### `modulepath` + +Data type: `Any` + + + +Default value: $r10k::params::modulepath + +##### `remote` + +Data type: `Any` + + + +Default value: $r10k::params::remote + +##### `manage_modulepath` + +Data type: `Boolean` + + + +Default value: $r10k::params::manage_modulepath + +##### `r10k_basedir` + +Data type: `Stdlib::Absolutepath` + + + +Default value: $r10k::params::r10k_basedir + +##### `manage_configfile_symlink` + +Data type: `Boolean` + + + +Default value: $r10k::params::manage_configfile_symlink + +##### `configfile_symlink` + +Data type: `Stdlib::Absolutepath` + + + +Default value: $r10k::params::configfile_symlink + +##### `git_settings` + +Data type: `Hash` + + + +Default value: $r10k::params::git_settings + +##### `forge_settings` + +Data type: `Hash` + + + +Default value: $r10k::params::forge_settings + +##### `deploy_settings` + +Data type: `Hash` + + + +Default value: $r10k::params::deploy_settings + +##### `postrun` + +Data type: `Optional[Array]` + + + +Default value: `undef` + +##### `root_user` + +Data type: `Any` + + + +Default value: $r10k::params::root_user + +##### `root_group` + +Data type: `Any` + + + +Default value: $r10k::params::root_group + +##### `puppetconf_path` + +Data type: `Stdlib::Absolutepath` + + + +Default value: $r10k::params::puppetconf_path + +##### `proxy` + +Data type: `Optional[String[1]]` + + + +Default value: $r10k::params::proxy + +##### `r10k_yaml_template` + +Data type: `String` + + + +Default value: 'r10k/r10k.yaml.erb' + +### r10k::install + +This class is used by the ruby or pe_ruby class + +#### Parameters + +The following parameters are available in the `r10k::install` class. + +##### `package_name` + +Data type: `Any` + + + +##### `version` + +Data type: `Any` + + + +##### `provider` + +Data type: `Any` + + + +##### `keywords` + +Data type: `Any` + + + +##### `install_options` + +Data type: `Any` + + + +##### `manage_ruby_dependency` + +Data type: `Any` + + + +##### `puppet_master` + +Data type: `Any` + + + +Default value: `true` + +##### `is_pe_server` + +Data type: `Any` + + + +Default value: $r10k::params::is_pe_server + +### r10k::install::bundle + +This class installs the r10k bundle + +#### Parameters + +The following parameters are available in the `r10k::install::bundle` class. + +##### `revision` + +Data type: `Any` + + + +Default value: 'master' + +##### `source` + +Data type: `Any` + + + +Default value: 'https://github.com/adrienthebo/r10k.git' + +### r10k::install::gem + +Install the r10k gem using system ruby + +#### Parameters + +The following parameters are available in the `r10k::install::gem` class. + +##### `manage_ruby_dependency` + +Data type: `Any` + + + +##### `version` + +Data type: `Any` + + + +### r10k::install::puppet_gem + +This class links the r10k binary for Puppet FOSS 4.2 and up + +### r10k::mcollective + +Install the r10k mcollective agent + +#### Parameters + +The following parameters are available in the `r10k::mcollective` class. + +##### `ensure` + +Data type: `Any` + + + +Default value: `true` + +##### `agent_name` + +Data type: `Any` + + + +Default value: $r10k::params::mc_agent_name + +##### `app_name` + +Data type: `Any` + + + +Default value: $r10k::params::mc_app_name + +##### `agent_ddl` + +Data type: `Any` + + + +Default value: $r10k::params::mc_agent_ddl_name + +##### `agent_path` + +Data type: `Any` + + + +Default value: $r10k::params::mc_agent_path + +##### `app_path` + +Data type: `Any` + + + +Default value: $r10k::params::mc_application_path + +##### `mc_service` + +Data type: `Any` + + + +Default value: $r10k::params::mc_service_name + +##### `http_proxy` + +Data type: `Any` + + + +Default value: $r10k::params::mc_http_proxy + +##### `git_ssl_no_verify` + +Data type: `Any` + + + +Default value: $r10k::params::mc_git_ssl_no_verify + +##### `root_user` + +Data type: `Any` + + + +Default value: $r10k::params::root_user + +##### `root_group` + +Data type: `Any` + + + +Default value: $r10k::params::root_group + +### r10k::mcollective::application + +Install the r10k mcollective application to a client + +#### Parameters + +The following parameters are available in the `r10k::mcollective::application` class. + +##### `agent_name` + +Data type: `Any` + + + +Default value: $r10k::params::mc_agent_name + +##### `app_name` + +Data type: `Any` + + + +Default value: $r10k::params::mc_app_name + +##### `agent_ddl` + +Data type: `Any` + + + +Default value: $r10k::params::mc_agent_ddl_name + +##### `agent_path` + +Data type: `Any` + + + +Default value: $r10k::params::mc_agent_path + +##### `app_path` + +Data type: `Any` + + + +Default value: $r10k::params::mc_application_path + +##### `mc_service` + +Data type: `Any` + + + +Default value: $r10k::params::mc_service_name + +### r10k::params + +Reasonable defaults for all classes + +### r10k::postrun_command + +This class handles the R10k postrun command. + +#### Parameters + +The following parameters are available in the `r10k::postrun_command` class. + +##### `ensure` + +Data type: `Enum['present', 'absent']` + +Whether to configure the R10k postrun command. + +Default value: 'present' + +##### `command` + +Data type: `String[1]` + +Specifies a command to run after every agent run. + +Default value: 'deploy environment -p' + +### r10k::prerun_command + +This class handles the R10k prerun command. + +#### Parameters + +The following parameters are available in the `r10k::prerun_command` class. + +##### `ensure` + +Data type: `Enum['present', 'absent']` + +Whether to configure the R10k prerun command. + +Default value: 'present' + +##### `command` + +Data type: `String[1]` + +Specifies a command to run before every agent run. + +Default value: 'deploy environment -p' + +### r10k::webhook + +This class creates a github webhoook to allow curl style post-rec scripts + +#### Parameters + +The following parameters are available in the `r10k::webhook` class. + +##### `ensure` + +Data type: `Any` + + + +Default value: `true` + +##### `user` + +Data type: `Any` + + + +Default value: $r10k::params::webhook_user + +##### `group` + +Data type: `Any` + + + +Default value: $r10k::params::webhook_group + +##### `background` + +Data type: `Any` + + + +Default value: $r10k::params::webhook_background + +##### `bin_template` + +Data type: `Any` + + + +Default value: $r10k::params::webhook_bin_template + +##### `service_template` + +Data type: `Any` + + + +Default value: $r10k::params::webhook_service_template + +##### `service_file` + +Data type: `Any` + + + +Default value: $r10k::params::webhook_service_file + +##### `use_mcollective` + +Data type: `Any` + + + +Default value: $r10k::params::webhook_use_mcollective + +##### `is_pe_server` + +Data type: `Any` + + + +Default value: $r10k::params::is_pe_server + +##### `root_user` + +Data type: `Any` + + + +Default value: $r10k::params::root_user + +##### `root_group` + +Data type: `Any` + + + +Default value: $r10k::params::root_group + +##### `manage_packages` + +Data type: `Any` + + + +Default value: `true` + +##### `ruby_bin` + +Data type: `Any` + + + +Default value: `undef` + +### r10k::webhook::config + +== Class: r10k::webhook::config + +Set up the root r10k config file (/etc/webhook.yaml). + +=== Authors + +Zack Smith + +#### Parameters + +The following parameters are available in the `r10k::webhook::config` class. + +##### `ensure` + +Data type: `Any` + + + +Default value: `true` + +##### `hash` + +Data type: `Variant[String, Hash]` + + + +Default value: 'UNSET' + +##### `certname` + +Data type: `Any` + + + +Default value: $r10k::params::webhook_certname + +##### `certpath` + +Data type: `Any` + + + +Default value: $r10k::params::webhook_certpath + +##### `user` + +Data type: `Any` + + + +Default value: $r10k::params::webhook_user + +##### `pass` + +Data type: `Any` + + + +Default value: $r10k::params::webhook_pass + +##### `bind_address` + +Data type: `Any` + + + +Default value: $r10k::params::webhook_bind_address + +##### `port` + +Data type: `Any` + + + +Default value: $r10k::params::webhook_port + +##### `access_logfile` + +Data type: `Any` + + + +Default value: $r10k::params::webhook_access_logfile + +##### `client_cfg` + +Data type: `Any` + + + +Default value: $r10k::params::webhook_client_cfg + +##### `default_branch` + +Data type: `Any` + + + +Default value: $r10k::params::webhook_default_branch + +##### `use_mco_ruby` + +Data type: `Any` + + + +Default value: $r10k::params::webhook_use_mco_ruby + +##### `protected` + +Data type: `Any` + + + +Default value: $r10k::params::webhook_protected + +##### `github_secret` + +Data type: `Any` + + + +Default value: $r10k::params::webhook_github_secret + +##### `bitbucket_secret` + +Data type: `Optional[String[1]]` + + + +Default value: $r10k::params::webhook_bitbucket_secret + +##### `discovery_timeout` + +Data type: `Any` + + + +Default value: $r10k::params::webhook_discovery_timeout + +##### `client_timeout` + +Data type: `Any` + + + +Default value: $r10k::params::webhook_client_timeout + +##### `prefix` + +Data type: `Any` + + + +Default value: $r10k::params::webhook_prefix + +##### `prefix_command` + +Data type: `Any` + + + +Default value: $r10k::params::webhook_prefix_command + +##### `server_software` + +Data type: `Any` + + + +Default value: $r10k::params::webhook_server_software + +##### `enable_ssl` + +Data type: `Any` + + + +Default value: $r10k::params::webhook_enable_ssl + +##### `use_mcollective` + +Data type: `Any` + + + +Default value: $r10k::params::webhook_use_mcollective + +##### `r10k_deploy_arguments` + +Data type: `Any` + + + +Default value: $r10k::params::webhook_r10k_deploy_arguments + +##### `public_key_path` + +Data type: `Any` + + + +Default value: $r10k::params::webhook_public_key_path + +##### `private_key_path` + +Data type: `Any` + + + +Default value: $r10k::params::webhook_private_key_path + +##### `yaml_template` + +Data type: `Any` + + + +Default value: $r10k::params::webhook_yaml_template + +##### `command_prefix` + +Data type: `Any` + + + +Default value: $r10k::params::webhook_r10k_command_prefix + +##### `repository_events` + +Data type: `Any` + + + +Default value: $r10k::params::webhook_repository_events + +##### `allow_uppercase` + +Data type: `Any` + + + +Default value: $r10k::params::webhook_allow_uppercase + +##### `slack_webhook` + +Data type: `Any` + + + +Default value: $r10k::params::webhook_slack_webhook + +##### `slack_channel` + +Data type: `Any` + + + +Default value: $r10k::params::webhook_slack_channel + +##### `slack_username` + +Data type: `Any` + + + +Default value: $r10k::params::webhook_slack_username + +##### `slack_proxy_url` + +Data type: `Any` + + + +Default value: $r10k::params::webhook_slack_proxy_url + +##### `rocketchat_webhook` + +Data type: `Any` + + + +Default value: $r10k::params::webhook_rocketchat_webhook + +##### `rocketchat_channel` + +Data type: `Any` + + + +Default value: $r10k::params::webhook_rocketchat_channel + +##### `rocketchat_username` + +Data type: `Any` + + + +Default value: $r10k::params::webhook_rocketchat_username + +##### `configfile_owner` + +Data type: `Any` + + + +Default value: $r10k::params::webhook_configfile_owner + +##### `configfile_group` + +Data type: `Any` + + + +Default value: $r10k::params::webhook_configfile_group + +##### `configfile_mode` + +Data type: `Any` + + + +Default value: $r10k::params::webhook_configfile_mode + +##### `configfile` + +Data type: `Any` + + + +Default value: '/etc/webhook.yaml' + +##### `manage_symlink` + +Data type: `Any` + + + +Default value: `false` + +##### `configfile_symlink` + +Data type: `Any` + + + +Default value: '/etc/webhook.yaml' + +##### `enable_mutex_lock` + +Data type: `Any` + + + +Default value: $r10k::params::webhook_enable_mutex_lock + +##### `ignore_environments` + +Data type: `Array` + + + +Default value: $r10k::params::webhook_ignore_environments + +##### `mco_arguments` + +Data type: `Optional[String]` + + + +Default value: $r10k::params::webhook_mco_arguments + +##### `generate_types` + +Data type: `Boolean` + + + +Default value: $r10k::params::webhook_generate_types + +### r10k::webhook::package + +Private class, do not include it directly. +Installs the webhook packages + +#### Parameters + +The following parameters are available in the `r10k::webhook::package` class. + +##### `is_pe_server` + +Data type: `Any` + + + +Default value: $r10k::params::is_pe_server + +##### `provider` + +Data type: `Any` + + + +Default value: $r10k::params::provider + +##### `sinatra_version` + +Data type: `Any` + + + +Default value: $r10k::params::webhook_sinatra_version + +##### `webrick_version` + +Data type: `Any` + + + +Default value: $r10k::params::webhook_webrick_version + +## Tasks + +### deploy + +Trigger an r10k deployment. + +**Supports noop?** false + +#### Parameters + +##### `environment` + +Data type: `Optional[Pattern[/\A[a-z0-9_]+\Z/]]` + +The environment to deploy. + +##### `environments` + +Data type: `Optional[Pattern[/\A[a-z0-9_,]+\Z/]]` + +A comma separated list of environments to deploy. Takes precedence over `environment`. + +##### `module` + +Data type: `Optional[Pattern[/\A[a-z0-9_]+\Z/]]` + +A module to deploy across all environments. + +##### `modules` + +Data type: `Optional[Pattern[/\A[a-z0-9_,]+\Z/]]` + +A comma separated list of modules to deploy. Takes precedence over `module`. + diff --git a/data/common.yaml b/data/common.yaml new file mode 100644 index 00000000..3f6ed159 --- /dev/null +++ b/data/common.yaml @@ -0,0 +1,8 @@ +--- +r10k::include_postrun_command: false +r10k::postrun_command::ensure: 'present' +r10k::postrun_command::command: 'deploy environment -p' + +r10k::include_prerun_command: false +r10k::prerun_command::ensure: 'present' +r10k::prerun_command::command: 'deploy environment -p' diff --git a/hiera.yaml b/hiera.yaml new file mode 100644 index 00000000..e6158ddf --- /dev/null +++ b/hiera.yaml @@ -0,0 +1,16 @@ +--- +version: 5 + +defaults: + datadir: 'data' + data_hash: 'yaml_data' + +hierarchy: + - name: 'Major Version' + path: "os/%{facts.os.name}-%{facts.os.release.major}.yaml" + - name: 'Distribution Name' + path: "os/%{facts.os.name}.yaml" + - name: 'Operating System Family' + path: "family/%{facts.os.family}.yaml" + - name: 'Common' + path: 'common.yaml' diff --git a/manifests/params.pp b/manifests/params.pp index 2168875d..eb7e9a43 100644 --- a/manifests/params.pp +++ b/manifests/params.pp @@ -18,7 +18,6 @@ } $r10k_cache_dir = "${facts['puppet_vardir']}/r10k" $r10k_config_file = '/etc/puppetlabs/r10k/r10k.yaml' - $r10k_binary = 'r10k' $puppetconf_path = '/etc/puppetlabs/puppet' $manage_configfile_symlink = false $configfile_symlink = '/etc/r10k.yaml' @@ -109,10 +108,6 @@ fail("Puppet version ${facts['puppetversion']} is no longer supported. Please use an earlier version of puppet/r10k.") } - # prerun_command in puppet.conf - $pre_postrun_command = "${r10k_binary} deploy environment -p" - - # Mcollective configuration static $mc_agent_name = "${module_name}.rb" $mc_agent_ddl_name = "${module_name}.ddl" diff --git a/manifests/postrun_command.pp b/manifests/postrun_command.pp index 64b6d6e1..bea96932 100644 --- a/manifests/postrun_command.pp +++ b/manifests/postrun_command.pp @@ -1,14 +1,24 @@ -# This class will configure r10k to run as part of the masters agent run +# @summary +# This class handles the R10k postrun command. +# +# @param ensure +# Whether to configure the R10k postrun command. +# +# @param command +# Specifies a command to run after every agent run. +# class r10k::postrun_command ( - $command = $r10k::params::pre_postrun_command, Enum['present', 'absent'] $ensure = 'present', -) inherits r10k::params { + String[1] $command = 'deploy environment -p', +) { + + $binary = pick_default($facts['r10k_path'], '/bin/r10k') ini_setting { 'r10k_postrun_command': ensure => $ensure, - path => "${r10k::params::puppetconf_path}/puppet.conf", + path => $settings::config, section => 'agent', setting => 'postrun_command', - value => $command, + value => "${binary} ${command}", } } diff --git a/manifests/prerun_command.pp b/manifests/prerun_command.pp index 80a7dec6..4662157e 100644 --- a/manifests/prerun_command.pp +++ b/manifests/prerun_command.pp @@ -1,14 +1,24 @@ -# This class will configure r10k to run as part of the masters agent run +# @summary +# This class handles the R10k prerun command. +# +# @param ensure +# Whether to configure the R10k prerun command. +# +# @param command +# Specifies a command to run before every agent run. +# class r10k::prerun_command ( - $command = $r10k::params::pre_postrun_command, Enum['present', 'absent'] $ensure = 'present', -) inherits r10k::params { + String[1] $command = 'deploy environment -p', +) { + + $binary = pick_default($facts['r10k_path'], '/bin/r10k') ini_setting { 'r10k_prerun_command': ensure => $ensure, - path => "${r10k::params::puppetconf_path}/puppet.conf", + path => $settings::config, section => 'agent', setting => 'prerun_command', - value => $command, + value => "${binary} ${command}", } } diff --git a/spec/classes/postrun_command_spec.rb b/spec/classes/postrun_command_spec.rb index 127ec4c9..b190c7d3 100644 --- a/spec/classes/postrun_command_spec.rb +++ b/spec/classes/postrun_command_spec.rb @@ -16,18 +16,17 @@ context 'adding custom postrun_command' do let :params do { - command: 'r10k synchronize', + command: 'synchronize', ensure: 'present' } end - it { is_expected.to contain_class('r10k::params') } it do is_expected.to contain_ini_setting('r10k_postrun_command').with( ensure: 'present', section: 'agent', setting: 'postrun_command', - value: 'r10k synchronize' + value: '/bin/r10k synchronize' ) end end @@ -35,18 +34,17 @@ context 'removing custom postrun_command' do let :params do { - command: 'r10k synchronize', + command: 'synchronize', ensure: 'absent' } end - it { is_expected.to contain_class('r10k::params') } it do is_expected.to contain_ini_setting('r10k_postrun_command').with( ensure: 'absent', section: 'agent', setting: 'postrun_command', - value: 'r10k synchronize' + value: '/bin/r10k synchronize' ) end end @@ -54,13 +52,12 @@ context 'with Puppet FOSS' do context 'adding default postrun_command' do - it { is_expected.to contain_class('r10k::params') } it do is_expected.to contain_ini_setting('r10k_postrun_command').with( ensure: 'present', section: 'agent', setting: 'postrun_command', - value: 'r10k deploy environment -p' + value: '/bin/r10k deploy environment -p' ) end end @@ -68,18 +65,17 @@ context 'adding custom postrun_command' do let :params do { - command: 'r10k21 synchronize', + command: 'synchronize', ensure: 'present' } end - it { is_expected.to contain_class('r10k::params') } it do is_expected.to contain_ini_setting('r10k_postrun_command').with( ensure: 'present', section: 'agent', setting: 'postrun_command', - value: 'r10k21 synchronize' + value: '/bin/r10k synchronize' ) end end @@ -87,18 +83,17 @@ context 'removing custom postrun_command' do let :params do { - command: 'r10k21 synchronize', + command: 'synchronize', ensure: 'absent' } end - it { is_expected.to contain_class('r10k::params') } it do is_expected.to contain_ini_setting('r10k_postrun_command').with( ensure: 'absent', section: 'agent', setting: 'postrun_command', - value: 'r10k21 synchronize' + value: '/bin/r10k synchronize' ) end end diff --git a/spec/classes/prerun_command_spec.rb b/spec/classes/prerun_command_spec.rb index bb779291..0e6d090c 100644 --- a/spec/classes/prerun_command_spec.rb +++ b/spec/classes/prerun_command_spec.rb @@ -16,18 +16,17 @@ context 'adding custom prerun_command' do let :params do { - command: 'r10k synchronize', + command: 'synchronize', ensure: 'present' } end - it { is_expected.to contain_class('r10k::params') } it do is_expected.to contain_ini_setting('r10k_prerun_command').with( ensure: 'present', section: 'agent', setting: 'prerun_command', - value: 'r10k synchronize' + value: '/bin/r10k synchronize' ) end end @@ -35,18 +34,17 @@ context 'removing custom prerun_command' do let :params do { - command: 'r10k synchronize', + command: 'synchronize', ensure: 'absent' } end - it { is_expected.to contain_class('r10k::params') } it do is_expected.to contain_ini_setting('r10k_prerun_command').with( ensure: 'absent', section: 'agent', setting: 'prerun_command', - value: 'r10k synchronize' + value: '/bin/r10k synchronize' ) end end @@ -54,13 +52,12 @@ context 'with Puppet FOSS' do context 'default prerun_command' do - it { is_expected.to contain_class('r10k::params') } it do is_expected.to contain_ini_setting('r10k_prerun_command').with( ensure: 'present', section: 'agent', setting: 'prerun_command', - value: 'r10k deploy environment -p' + value: '/bin/r10k deploy environment -p' ) end end @@ -68,18 +65,17 @@ context 'adding custom prerun_command' do let :params do { - command: 'r10k21 synchronize', + command: 'synchronize', ensure: 'present' } end - it { is_expected.to contain_class('r10k::params') } it do is_expected.to contain_ini_setting('r10k_prerun_command').with( ensure: 'present', section: 'agent', setting: 'prerun_command', - value: 'r10k21 synchronize' + value: '/bin/r10k synchronize' ) end end @@ -87,41 +83,21 @@ context 'removing custom prerun_command' do let :params do { - command: 'r10k21 synchronize', + command: 'synchronize', ensure: 'absent' } end - it { is_expected.to contain_class('r10k::params') } it do is_expected.to contain_ini_setting('r10k_prerun_command').with( ensure: 'absent', section: 'agent', setting: 'prerun_command', - value: 'r10k21 synchronize' + value: '/bin/r10k synchronize' ) end end end - - context 'removing custom prerun_command' do - let :params do - { - command: 'r10k22 synchronize', - ensure: 'absent' - } - end - - it { is_expected.to contain_class('r10k::params') } - it do - is_expected.to contain_ini_setting('r10k_prerun_command').with( - ensure: 'absent', - section: 'agent', - setting: 'prerun_command', - value: 'r10k22 synchronize' - ) - end - end end end end