-
Notifications
You must be signed in to change notification settings - Fork 185
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added experimental template for pdk to create tp based profiles
- Loading branch information
Showing
1 changed file
with
44 additions
and
0 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 |
---|---|---|
@@ -0,0 +1,44 @@ | ||
<% app_name = name.gsub("profile::", "") -%> | ||
# <%= name %> | ||
# | ||
# @summary This profile manages <%= app_name %> | ||
# | ||
# @example | ||
# include <%= name %> | ||
# | ||
# @param ensure If to install or remove <%= app_name %> | ||
# @param config_file_template The erb template (as used in template()) to manage | ||
# the content of <%= app_name %> application's main configuration file | ||
# @param options_hash An open hash of options to use in the provided template. | ||
# It's looked up via a deep merge hash | ||
<%- if params -%> | ||
<%- params.each do |param| -%> | ||
# @param <%= param[:name] %> <%= param[:description] %>. | ||
<%- end -%> | ||
class <%= name %> ( | ||
Enum['present','absent'] $ensure = 'present', | ||
String $config_file_template = '', | ||
<%- params.each do |param| -%> | ||
<%= param[:type].ljust(max_type_length) %> $<%= param[:name] %>, | ||
<%- end -%> | ||
) { | ||
<%- else -%> | ||
class <%= name %> ( | ||
Enum['present','absent'] $ensure = 'present', | ||
String $config_file_template = '', | ||
) { | ||
<%- end -%> | ||
|
||
::tp::install { '<%= app_name %>': | ||
ensure => $ensure, | ||
} | ||
|
||
if $config_file_template != '' { | ||
::tp::conf { '<%= app_name %>': | ||
ensure => $ensure, | ||
template => $config_file_template, | ||
options_hash => $options_hash, | ||
} | ||
} | ||
|
||
} |