Skip to content

Commit

Permalink
CLI: Allow to configure use_sessions setting
Browse files Browse the repository at this point in the history
  • Loading branch information
neomilium committed Nov 22, 2020
1 parent c784e66 commit ceefd75
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 0 deletions.
3 changes: 3 additions & 0 deletions manifests/cli.pp
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@
#
# $manage_root_config:: Whether to manage /root/.hammer configuration.
#
# $use_sessions:: Enable using sessions
#
# $refresh_cache:: Check API documentation cache status on each request
#
# $request_timeout:: API request timeout, set -1 for infinity
Expand All @@ -31,6 +33,7 @@
Boolean $manage_root_config = $foreman::cli::params::manage_root_config,
Optional[String] $username = $foreman::cli::params::username,
Optional[String] $password = $foreman::cli::params::password,
Boolean $use_sessions = $foreman::cli::params::use_sessions,
Boolean $refresh_cache = $foreman::cli::params::refresh_cache,
Integer[-1] $request_timeout = $foreman::cli::params::request_timeout,
Optional[Stdlib::Absolutepath] $ssl_ca_file = $foreman::cli::params::ssl_ca_file,
Expand Down
1 change: 1 addition & 0 deletions manifests/cli/params.pp
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
$password = undef
$refresh_cache = false
$request_timeout = 120
$use_sessions = false
$ssl_ca_file = undef

# OS specific paths
Expand Down
3 changes: 3 additions & 0 deletions spec/classes/foreman_cli_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
':foreman:',
' :enable_module: true',
" :host: 'http://example.com'",
' :use_sessions: false',
' :refresh_cache: false',
' :request_timeout: 120',
])
Expand Down Expand Up @@ -56,6 +57,7 @@
':foreman:',
' :enable_module: true',
" :host: 'http://example.com'",
' :use_sessions: false',
' :refresh_cache: false',
' :request_timeout: 120',
':ssl:',
Expand Down Expand Up @@ -96,6 +98,7 @@ class { 'foreman':
':foreman:',
' :enable_module: true',
" :host: 'https://foreman.example.com'",
' :use_sessions: false',
' :refresh_cache: false',
' :request_timeout: 120',
':ssl:',
Expand Down
6 changes: 6 additions & 0 deletions templates/hammer_etc.yml.erb
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,17 @@
# Your foreman server address
:host: '<%= @foreman_url_real %>'

# 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_real -%>

:ssl:
Expand Down

0 comments on commit ceefd75

Please sign in to comment.