-
Notifications
You must be signed in to change notification settings - Fork 136
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
FacterDB: Switch to stringified facts
- Loading branch information
1 parent
959c7cf
commit 7cc60b8
Showing
7 changed files
with
21 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,3 +3,5 @@ | |
enabled_lint_checks: | ||
- parameter_documentation | ||
- parameter_types | ||
spec/spec_helper.rb: | ||
facterdb_string_keys: true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -17,8 +17,7 @@ | |
describe 'with defaults' do | ||
it { is_expected.to compile } | ||
|
||
epel = facts[:osfamily] == 'RedHat' && facts[:operatingsystem] != 'Fedora' | ||
|
||
epel = facts['os']['family'] == 'RedHat' && facts['os']['name'] != 'Fedora' | ||
it 'contains the correct resources' do | ||
is_expected.to contain_class('letsencrypt::install'). | ||
with(configure_epel: epel). | ||
|
@@ -33,7 +32,7 @@ | |
cron_monthday: ['*']) | ||
is_expected.to contain_cron('letsencrypt-renew').with_ensure('absent') | ||
|
||
if facts[:osfamily] == 'FreeBSD' | ||
if facts['os']['family'] == 'FreeBSD' | ||
is_expected.to contain_ini_setting('/usr/local/etc/letsencrypt/cli.ini email [email protected]') | ||
is_expected.to contain_ini_setting('/usr/local/etc/letsencrypt/cli.ini server https://acme-v02.api.letsencrypt.org/directory') | ||
is_expected.to contain_file('letsencrypt-renewal-hooks-puppet'). | ||
|
@@ -50,7 +49,7 @@ | |
is_expected.to contain_file('letsencrypt-renewal-hooks-puppet').with_path('/etc/letsencrypt/renewal-hooks-puppet') | ||
end | ||
|
||
if facts[:osfamily] == 'RedHat' | ||
if facts['os']['family'] == 'RedHat' | ||
if epel | ||
is_expected.to contain_class('epel').that_comes_before('Package[letsencrypt]') | ||
else | ||
|
@@ -60,20 +59,20 @@ | |
is_expected.to contain_class('letsencrypt').with(package_command: 'certbot') | ||
is_expected.to contain_package('letsencrypt').with(name: 'certbot').with_ensure('installed') | ||
is_expected.to contain_file('/etc/letsencrypt').with(ensure: 'directory') | ||
elsif facts[:osfamily] == 'Debian' | ||
elsif facts['os']['family'] == 'Debian' | ||
is_expected.to contain_class('letsencrypt::install').with(package_name: 'certbot') | ||
is_expected.to contain_file('/etc/letsencrypt').with(ensure: 'directory') | ||
elsif facts[:operatingsystem] == 'Gentoo' | ||
elsif facts['os']['name'] == 'Gentoo' | ||
is_expected.to contain_class('letsencrypt::install').with(package_name: 'app-crypt/certbot') | ||
is_expected.to contain_class('letsencrypt').with(package_command: 'certbot') | ||
is_expected.to contain_package('letsencrypt').with(name: 'app-crypt/certbot').with_ensure('installed') | ||
is_expected.to contain_file('/etc/letsencrypt').with(ensure: 'directory') | ||
elsif facts[:operatingsystem] == 'OpenBSD' | ||
elsif facts['os']['name'] == 'OpenBSD' | ||
is_expected.to contain_class('letsencrypt::install').with(package_name: 'certbot') | ||
is_expected.to contain_class('letsencrypt').with(package_command: 'certbot') | ||
is_expected.to contain_package('letsencrypt').with(name: 'certbot').with_ensure('installed') | ||
is_expected.to contain_file('/etc/letsencrypt').with(ensure: 'directory') | ||
elsif facts[:operatingsystem] == 'FreeBSD' | ||
elsif facts['os']['name'] == 'FreeBSD' | ||
is_expected.to contain_class('letsencrypt::install').with(package_name: 'py311-certbot') | ||
is_expected.to contain_class('letsencrypt').with(package_command: 'certbot') | ||
is_expected.to contain_package('letsencrypt').with(name: 'py311-certbot').with_ensure('installed') | ||
|
@@ -100,7 +99,7 @@ | |
describe 'with custom config' do | ||
let(:additional_params) { { config: { 'foo' => 'bar' } } } | ||
|
||
case facts[:operatingsystem] | ||
case facts['os']['name'] | ||
when 'FreeBSD' | ||
it { is_expected.to contain_ini_setting('/usr/local/etc/letsencrypt/cli.ini foo bar') } | ||
else | ||
|
@@ -237,7 +236,7 @@ | |
|
||
it { is_expected.to compile.with_all_deps } | ||
|
||
case facts[:operatingsystem] | ||
case facts['os']['name'] | ||
when 'FreeBSD' | ||
it { is_expected.to contain_ini_setting('/usr/local/etc/letsencrypt/cli.ini email [email protected]') } | ||
else | ||
|
@@ -253,7 +252,7 @@ | |
context 'with unsafe_registration set to true' do | ||
let(:params) { { unsafe_registration: true } } | ||
|
||
case facts[:operatingsystem] | ||
case facts['os']['name'] | ||
when 'FreeBSD' | ||
it { is_expected.not_to contain_ini_setting('/usr/local/etc/letsencrypt/cli.ini email [email protected]') } | ||
it { is_expected.to contain_ini_setting('/usr/local/etc/letsencrypt/cli.ini register-unsafely-without-email true') } | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,7 +12,7 @@ | |
let(:pre_condition) { "class { letsencrypt: email => '[email protected]', package_command => 'letsencrypt' }" } | ||
|
||
# FreeBSD uses a different filesystem path | ||
pathprefix = facts[:kernel] == 'FreeBSD' ? '/usr/local' : '' | ||
pathprefix = facts['kernel'] == 'FreeBSD' ? '/usr/local' : '' | ||
|
||
context 'with a single domain' do | ||
let(:title) { 'foo.example.com' } | ||
|
@@ -32,7 +32,7 @@ | |
with_content(%r{#!/bin/sh}) | ||
end | ||
|
||
if facts[:osfamily] == 'FreeBSD' | ||
if facts['os']['family'] == 'FreeBSD' | ||
it { is_expected.to contain_file('/usr/local/etc/letsencrypt') } | ||
it { is_expected.to contain_ini_setting('/usr/local/etc/letsencrypt/cli.ini email [email protected]') } | ||
it { is_expected.to contain_ini_setting('/usr/local/etc/letsencrypt/cli.ini server https://acme-v02.api.letsencrypt.org/directory') } | ||
|
@@ -497,7 +497,7 @@ class { 'letsencrypt::plugin::dns_cloudflare': | |
it { is_expected.to contain_exec('letsencrypt certonly foo.example.com').with_unless(['test ! -f /usr/local/sbin/letsencrypt-domain-validation', '/usr/local/sbin/letsencrypt-domain-validation /foo/bar/baz/live/foo.example.com/cert.pem \'foo.example.com\'']) } | ||
end | ||
|
||
context 'on FreeBSD', if: facts[:os]['name'] == 'FreeBSD' do | ||
context 'on FreeBSD', if: facts['os']['name'] == 'FreeBSD' do | ||
let(:title) { 'foo.example.com' } | ||
let(:pre_condition) { "class { letsencrypt: email => '[email protected]'}" } | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters