Skip to content

Commit

Permalink
Use EPP instead of ERB
Browse files Browse the repository at this point in the history
As a Preparation for making this Module "Sensitive"-aware, we prefer
to use EPP instead of ERB in such Situations, where "Sensitive" could
come into Play, as EPP is able to handle Data of Type Sensitive
natively.
  • Loading branch information
cocker-cc authored Jul 9, 2021
1 parent b759778 commit 5dfe8aa
Show file tree
Hide file tree
Showing 5 changed files with 55 additions and 29 deletions.
19 changes: 17 additions & 2 deletions manifests/cli.pp
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,16 @@
owner => 'root',
group => 'root',
mode => '0644',
content => template('foreman/hammer_etc.yml.erb'),
content => epp(
'foreman/hammer_etc.yml.epp',
{
host => $foreman_url_real,
use_sessions => $use_sessions,
refresh_cache => $refresh_cache,
request_timeout => $request_timeout,
ssl_ca_file => $ssl_ca_file_real,
}
),
}

# Separate configuration for admin username/password
Expand All @@ -83,7 +92,13 @@
group => 'root',
mode => '0600',
replace => false,
content => template('foreman/hammer_root.yml.erb'),
content => epp(
'foreman/hammer_root.yml.epp',
{
username => $username_real,
password => $password_real,
}
),
}
}

Expand Down
30 changes: 30 additions & 0 deletions templates/hammer_etc.yml.epp
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
<%- |
Optional[Stdlib::HTTPUrl] $host,
Boolean $use_sessions,
Boolean $refresh_cache,
Integer[-1] $request_timeout,
Optional[Stdlib::Absolutepath] $ssl_ca_file,
| -%>
:foreman:
# Enable/disable foreman commands
:enable_module: true

# Your foreman server address
:host: '<%= $host %>'

# Enable using sessions
# When sessions are enabled, hammer ignores credentials stored in the config file
# and asks for them interactively at the begining of each session.
:use_sessions: <%= $use_sessions %>

# Check API documentation cache status on each request
:refresh_cache: <%= $refresh_cache %>

# API request timeout in seconds, set -1 for infinity
:request_timeout: <%= $request_timeout %>

<% if $ssl_ca_file { -%>

:ssl:
:ssl_ca_file: '<%= $ssl_ca_file %>'
<% } -%>
23 changes: 0 additions & 23 deletions templates/hammer_etc.yml.erb

This file was deleted.

8 changes: 8 additions & 0 deletions templates/hammer_root.yml.epp
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<%- |
Optional[String] $username,
Optional[String] $password,
| -%>
:foreman:
# Credentials. You'll be asked for the interactively if you leave them blank here
:username: '<%= $username %>'
:password: '<%= $password %>'
4 changes: 0 additions & 4 deletions templates/hammer_root.yml.erb

This file was deleted.

0 comments on commit 5dfe8aa

Please sign in to comment.