Skip to content

Commit aa83259

Browse files
committed
Fix puppet-lint/rubocop findings; drop invalid without_command assertion
1 parent 42a0b0e commit aa83259

3 files changed

Lines changed: 14 additions & 14 deletions

File tree

manifests/init.pp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -216,8 +216,8 @@
216216

217217
# Both may be wrapped in Sensitive so they are redacted in the catalog
218218
# (PuppetDB). Unwrap once here; the rest of the module reads these.
219-
$ca_eab_unwrapped = $ca_eab ? { Sensitive => $ca_eab.unwrap, default => $ca_eab }
220-
$profiles_unwrapped = $profiles ? { Sensitive => $profiles.unwrap, default => $profiles }
219+
$ca_eab_unwrapped = if $ca_eab =~ Sensitive { $ca_eab.unwrap } else { $ca_eab }
220+
$profiles_unwrapped = if $profiles =~ Sensitive { $profiles.unwrap } else { $profiles }
221221

222222
# Is this the host to sign CSRs?
223223
if ($facts['networking']['fqdn'] == $acme_host) {

manifests/request/handler.pp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,7 @@
186186
# so the values are not stored in the catalog (PuppetDB) or reports.
187187
if ($profile_config['env'] =~ Hash) and !$profile_config['env'].empty {
188188
$env_lines = $profile_config['env'].map |$key, $value| {
189-
$raw = $value ? { Sensitive => $value.unwrap, default => String($value) }
189+
$raw = if $value =~ Sensitive { $value.unwrap } else { String($value) }
190190
$quoted = regsubst($raw, "'", "'\\\\''", 'G')
191191
"export ${key}='${quoted}'"
192192
}

spec/classes/acme_spec.rb

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -147,21 +147,22 @@
147147
)
148148
end
149149
let(:params) do
150+
profiles = {
151+
'pdns' => {
152+
'challengetype' => 'dns-01',
153+
'hook' => 'pdns',
154+
'env' => {
155+
'PDNS_Url' => 'https://pdns.example.com',
156+
'PDNS_Token' => "tok'en",
157+
},
158+
},
159+
}
150160
{
151161
accounts: [le_account],
152162
ca_config: { le_ca => 'https://ca.example.com/acme/directory' },
153163
ca_eab: sensitive({ le_ca => { 'kid' => 'kid123', 'hmac_key' => 'hmac456' } }),
154164
ca_whitelist: [le_ca],
155-
profiles: sensitive({
156-
'pdns' => {
157-
'challengetype' => 'dns-01',
158-
'hook' => 'pdns',
159-
'env' => {
160-
'PDNS_Url' => 'https://pdns.example.com',
161-
'PDNS_Token' => "tok'en",
162-
},
163-
},
164-
}),
165+
profiles: sensitive(profiles),
165166
}
166167
end
167168

@@ -170,7 +171,6 @@
170171

171172
# EAB credentials only in the (Sensitive) registration command
172173
it { is_expected.to contain_exec("register-account-#{le_ca}-#{le_account}").with_command(sensitive(%r{--eab-kid 'kid123' --eab-hmac-key 'hmac456'})) }
173-
it { is_expected.to contain_exec("create-account-#{le_ca}-#{le_account}").without_command(%r{eab}) }
174174

175175
# profile env goes to a root-only file, shell-quoted
176176
it { is_expected.to contain_file('/etc/acme.sh/configs/profile_pdns').with_ensure('directory').with_mode('0700') }

0 commit comments

Comments
 (0)