From 76b63b95fd6c0281748e5986e357339e9741551c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gardais=20J=C3=A9r=C3=A9my?= Date: Tue, 29 Nov 2016 16:01:47 +0100 Subject: [PATCH] Add test to verify the variables. --- README.md | 16 ++++++++-------- manifests/init.pp | 11 +++++++++++ 2 files changed, 19 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index e2b0d65..582e5ad 100644 --- a/README.md +++ b/README.md @@ -70,14 +70,14 @@ class { 'root': ### Parameters -* `profile_path` : Path to the .profile to load personal initialization. Defaults to '/root/.profile'. -* `profile_content` : Template file used to generate the previous configuration file. Defaults to 'root/preferences/profile.erb'. -* `bashrc_path` : Path to the Bash's rcfile. Defaults to '/root/.bashrc'. -* `bashrc_content` : Template file used to generate the previous configuration file. Default to 'root/preferences/bashrc.erb'. -* `forward_path` : Path to the forward file. Defaults to '/root/.forward'. -* `forward_content` : Template file used to generate the previous configuration file. Default to 'root/preferences/forward.erb'. -* `address_to_forward` : List of addresses that must receive root's mails. Default to ''. -* `default_shell_path` : Path to a bin file to use as default shell for root. Defaults to '/bin/bash'. +* `profile_path` : Path to the .profile to load personal initialization. Must be a absolut path, defaults to '/root/.profile'. +* `profile_content` : Template file used to generate the previous configuration file. Must be a string ending with **.erb**, defaults to 'root/preferences/profile.erb'. +* `bashrc_path` : Path to the Bash's rcfile. Must be a absolut path, defaults to '/root/.bashrc'. +* `bashrc_content` : Template file used to generate the previous configuration file. Must be a string ending with **.erb**, default to 'root/preferences/bashrc.erb'. +* `forward_path` : Path to the forward file. Must be a absolut path, defaults to '/root/.forward'. +* `forward_content` : Template file used to generate the previous configuration file. Must be a string ending with **.erb**, default to 'root/preferences/forward.erb'. +* `address_to_forward` : List of addresses that must receive root's mails. Must be a string, default to ''. +* `default_shell_path` : Path to a bin file to use as default shell for root. Must be a absolut path, defaults to '/bin/bash'. * `ip_zsh` : A regex to determine if a ssh client should have ZSH as default shell. Defaults to '127.0.0.1'. ## Limitations diff --git a/manifests/init.pp b/manifests/init.pp index 36b1fb9..648068e 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -48,6 +48,17 @@ class root ( $ip_zsh = $root::params::ip_zsh, ) inherits root::params { + + validate_re($profile_path, '^/') + validate_re($profile_content, '.erb$') + validate_re($bashrc_path, '^/') + validate_re($bashrc_content, '.erb$') + validate_re($forward_path, '^/') + validate_re($forward_content, '.erb$') + validate_string($address_to_forward) + validate_re($default_shell_path, '^/') + + include '::root::config' } # public class : root