From 423001b7026ab183fb204181c58ef5fb6a7901f0 Mon Sep 17 00:00:00 2001 From: Daniel Heule Date: Sat, 8 Feb 2014 21:48:51 +0100 Subject: [PATCH 1/2] Make state parameter optional for all types, fixes #131 --- cdist/conf/type/__pf_ruleset/man.text | 2 +- cdist/conf/type/__pf_ruleset/parameter/default/state | 1 + cdist/conf/type/__pf_ruleset/parameter/optional | 1 + cdist/conf/type/__postgres_database/gencode-remote | 3 +-- cdist/conf/type/__postgres_database/man.text | 2 +- cdist/conf/type/__postgres_database/parameter/default/state | 1 + cdist/conf/type/__postgres_role/gencode-remote | 3 +-- cdist/conf/type/__postgres_role/parameter/default/state | 1 + cdist/conf/type/__rvm/man.text | 2 +- cdist/conf/type/__rvm/parameter/default/state | 1 + .../parameter/required => __rvm/parameter/optional} | 0 cdist/conf/type/__rvm_gemset/man.text | 2 +- cdist/conf/type/__rvm_gemset/parameter/default/state | 1 + .../parameter/required => __rvm_gemset/parameter/optional} | 0 cdist/conf/type/__rvm_gemset/parameter/required | 1 - cdist/conf/type/__rvm_ruby/man.text | 2 +- cdist/conf/type/__rvm_ruby/parameter/default/state | 1 + cdist/conf/type/__rvm_ruby/parameter/optional | 1 + cdist/conf/type/__rvm_ruby/parameter/required | 1 - 19 files changed, 15 insertions(+), 11 deletions(-) create mode 100644 cdist/conf/type/__pf_ruleset/parameter/default/state create mode 100644 cdist/conf/type/__postgres_database/parameter/default/state create mode 100644 cdist/conf/type/__postgres_role/parameter/default/state create mode 100644 cdist/conf/type/__rvm/parameter/default/state rename cdist/conf/type/{__pf_ruleset/parameter/required => __rvm/parameter/optional} (100%) create mode 100644 cdist/conf/type/__rvm_gemset/parameter/default/state rename cdist/conf/type/{__rvm/parameter/required => __rvm_gemset/parameter/optional} (100%) create mode 100644 cdist/conf/type/__rvm_ruby/parameter/default/state create mode 100644 cdist/conf/type/__rvm_ruby/parameter/optional diff --git a/cdist/conf/type/__pf_ruleset/man.text b/cdist/conf/type/__pf_ruleset/man.text index 0dc07f71..29efe065 100644 --- a/cdist/conf/type/__pf_ruleset/man.text +++ b/cdist/conf/type/__pf_ruleset/man.text @@ -16,7 +16,7 @@ This type is used on *BSD systems to manage the pf firewall's ruleset. REQUIRED PARAMETERS ------------------- state:: - Either "absent" (no ruleset at all) or "present" + Either "absent" (no ruleset at all) or "present", defaults to "present". OPTIONAL PARAMETERS diff --git a/cdist/conf/type/__pf_ruleset/parameter/default/state b/cdist/conf/type/__pf_ruleset/parameter/default/state new file mode 100644 index 00000000..e7f6134f --- /dev/null +++ b/cdist/conf/type/__pf_ruleset/parameter/default/state @@ -0,0 +1 @@ +present diff --git a/cdist/conf/type/__pf_ruleset/parameter/optional b/cdist/conf/type/__pf_ruleset/parameter/optional index 5a18cd2f..d77f3048 100644 --- a/cdist/conf/type/__pf_ruleset/parameter/optional +++ b/cdist/conf/type/__pf_ruleset/parameter/optional @@ -1 +1,2 @@ source +state diff --git a/cdist/conf/type/__postgres_database/gencode-remote b/cdist/conf/type/__postgres_database/gencode-remote index 0ffc842a..c097efce 100755 --- a/cdist/conf/type/__postgres_database/gencode-remote +++ b/cdist/conf/type/__postgres_database/gencode-remote @@ -19,8 +19,7 @@ # name="$__object_id" -state_should="present" -[ -f "$__object/parameter/state" ] && state_should="$(cat "$__object/parameter/state")" +state_should="$(cat "$__object/parameter/state")" state_is="$(cat "$__object/explorer/state")" if [ "$state_should" != "$state_is" ]; then diff --git a/cdist/conf/type/__postgres_database/man.text b/cdist/conf/type/__postgres_database/man.text index 88259b6f..c7c0d3cd 100644 --- a/cdist/conf/type/__postgres_database/man.text +++ b/cdist/conf/type/__postgres_database/man.text @@ -16,7 +16,7 @@ This cdist type allows you to create or drop postgres databases. OPTIONAL PARAMETERS ------------------- state:: - either 'present' or 'absent' + either 'present' or 'absent', defaults to 'present'. owner:: the role owning this database diff --git a/cdist/conf/type/__postgres_database/parameter/default/state b/cdist/conf/type/__postgres_database/parameter/default/state new file mode 100644 index 00000000..e7f6134f --- /dev/null +++ b/cdist/conf/type/__postgres_database/parameter/default/state @@ -0,0 +1 @@ +present diff --git a/cdist/conf/type/__postgres_role/gencode-remote b/cdist/conf/type/__postgres_role/gencode-remote index 65a9d588..0230e48e 100755 --- a/cdist/conf/type/__postgres_role/gencode-remote +++ b/cdist/conf/type/__postgres_role/gencode-remote @@ -20,8 +20,7 @@ name="$__object_id" state_is="$(cat "$__object/explorer/state")" -state_should="present" -[ -f "$__object/parameter/state" ] && state_should="$(cat "$__object/parameter/state")" +state_should="$(cat "$__object/parameter/state")" [ "$state_is" = "$state_should" ] && exit 0 diff --git a/cdist/conf/type/__postgres_role/parameter/default/state b/cdist/conf/type/__postgres_role/parameter/default/state new file mode 100644 index 00000000..e7f6134f --- /dev/null +++ b/cdist/conf/type/__postgres_role/parameter/default/state @@ -0,0 +1 @@ +present diff --git a/cdist/conf/type/__rvm/man.text b/cdist/conf/type/__rvm/man.text index c1f83e60..0408d125 100644 --- a/cdist/conf/type/__rvm/man.text +++ b/cdist/conf/type/__rvm/man.text @@ -16,7 +16,7 @@ RVM is the Ruby enVironment Manager for the Ruby programming language. REQUIRED PARAMETERS ------------------- state:: - Either "present" or "absent". + Either "present" or "absent", defaults to "present". EXAMPLES diff --git a/cdist/conf/type/__rvm/parameter/default/state b/cdist/conf/type/__rvm/parameter/default/state new file mode 100644 index 00000000..e7f6134f --- /dev/null +++ b/cdist/conf/type/__rvm/parameter/default/state @@ -0,0 +1 @@ +present diff --git a/cdist/conf/type/__pf_ruleset/parameter/required b/cdist/conf/type/__rvm/parameter/optional similarity index 100% rename from cdist/conf/type/__pf_ruleset/parameter/required rename to cdist/conf/type/__rvm/parameter/optional diff --git a/cdist/conf/type/__rvm_gemset/man.text b/cdist/conf/type/__rvm_gemset/man.text index 44c0c555..e85425f3 100644 --- a/cdist/conf/type/__rvm_gemset/man.text +++ b/cdist/conf/type/__rvm_gemset/man.text @@ -18,7 +18,7 @@ REQUIRED PARAMETERS user:: The remote user account to use state:: - Either "present" or "absent". + Either "present" or "absent", defaults to "present". BOOLEAN PARAMETERS ------------------- diff --git a/cdist/conf/type/__rvm_gemset/parameter/default/state b/cdist/conf/type/__rvm_gemset/parameter/default/state new file mode 100644 index 00000000..e7f6134f --- /dev/null +++ b/cdist/conf/type/__rvm_gemset/parameter/default/state @@ -0,0 +1 @@ +present diff --git a/cdist/conf/type/__rvm/parameter/required b/cdist/conf/type/__rvm_gemset/parameter/optional similarity index 100% rename from cdist/conf/type/__rvm/parameter/required rename to cdist/conf/type/__rvm_gemset/parameter/optional diff --git a/cdist/conf/type/__rvm_gemset/parameter/required b/cdist/conf/type/__rvm_gemset/parameter/required index 5aea6f1e..4eb8387f 100644 --- a/cdist/conf/type/__rvm_gemset/parameter/required +++ b/cdist/conf/type/__rvm_gemset/parameter/required @@ -1,2 +1 @@ -state user diff --git a/cdist/conf/type/__rvm_ruby/man.text b/cdist/conf/type/__rvm_ruby/man.text index dbbab85e..6419a4d4 100644 --- a/cdist/conf/type/__rvm_ruby/man.text +++ b/cdist/conf/type/__rvm_ruby/man.text @@ -18,7 +18,7 @@ REQUIRED PARAMETERS user:: The remote user account to use state:: - Either "present" or "absent". + Either "present" or "absent", defaults to "present". BOOLEAN PARAMETERS ------------------ diff --git a/cdist/conf/type/__rvm_ruby/parameter/default/state b/cdist/conf/type/__rvm_ruby/parameter/default/state new file mode 100644 index 00000000..e7f6134f --- /dev/null +++ b/cdist/conf/type/__rvm_ruby/parameter/default/state @@ -0,0 +1 @@ +present diff --git a/cdist/conf/type/__rvm_ruby/parameter/optional b/cdist/conf/type/__rvm_ruby/parameter/optional new file mode 100644 index 00000000..ff72b5c7 --- /dev/null +++ b/cdist/conf/type/__rvm_ruby/parameter/optional @@ -0,0 +1 @@ +state diff --git a/cdist/conf/type/__rvm_ruby/parameter/required b/cdist/conf/type/__rvm_ruby/parameter/required index 5aea6f1e..4eb8387f 100644 --- a/cdist/conf/type/__rvm_ruby/parameter/required +++ b/cdist/conf/type/__rvm_ruby/parameter/required @@ -1,2 +1 @@ -state user From f3172fda957557174fe8d123a28ef50d0076658e Mon Sep 17 00:00:00 2001 From: Daniel Heule Date: Sat, 8 Feb 2014 22:06:27 +0100 Subject: [PATCH 2/2] 2 more types for issue 131 --- cdist/conf/type/__jail/man.text | 2 +- cdist/conf/type/__jail/parameter/default/state | 1 + cdist/conf/type/__jail/parameter/optional | 1 + cdist/conf/type/__jail/parameter/required | 1 - cdist/conf/type/__rvm_gem/man.text | 2 +- cdist/conf/type/__rvm_gem/parameter/default/state | 1 + cdist/conf/type/__rvm_gem/parameter/optional | 1 + cdist/conf/type/__rvm_gem/parameter/required | 1 - 8 files changed, 6 insertions(+), 4 deletions(-) create mode 100644 cdist/conf/type/__jail/parameter/default/state delete mode 100644 cdist/conf/type/__jail/parameter/required create mode 100644 cdist/conf/type/__rvm_gem/parameter/default/state diff --git a/cdist/conf/type/__jail/man.text b/cdist/conf/type/__jail/man.text index b439e0f5..9c968d84 100644 --- a/cdist/conf/type/__jail/man.text +++ b/cdist/conf/type/__jail/man.text @@ -16,7 +16,7 @@ This type is used on FreeBSD to manage jails. REQUIRED PARAMETERS ------------------- state:: - Either "present" or "absent." + Either "present" or "absent", defaults to "present". jailbase:: The location of the .tgz archive containing the base fs for your jails. diff --git a/cdist/conf/type/__jail/parameter/default/state b/cdist/conf/type/__jail/parameter/default/state new file mode 100644 index 00000000..e7f6134f --- /dev/null +++ b/cdist/conf/type/__jail/parameter/default/state @@ -0,0 +1 @@ +present diff --git a/cdist/conf/type/__jail/parameter/optional b/cdist/conf/type/__jail/parameter/optional index 08ecd469..b36f0fa5 100644 --- a/cdist/conf/type/__jail/parameter/optional +++ b/cdist/conf/type/__jail/parameter/optional @@ -5,3 +5,4 @@ interface devfs-ruleset jaildir jailbase +state diff --git a/cdist/conf/type/__jail/parameter/required b/cdist/conf/type/__jail/parameter/required deleted file mode 100644 index ff72b5c7..00000000 --- a/cdist/conf/type/__jail/parameter/required +++ /dev/null @@ -1 +0,0 @@ -state diff --git a/cdist/conf/type/__rvm_gem/man.text b/cdist/conf/type/__rvm_gem/man.text index 2b72e7ae..d7eff3be 100644 --- a/cdist/conf/type/__rvm_gem/man.text +++ b/cdist/conf/type/__rvm_gem/man.text @@ -20,7 +20,7 @@ user:: gemset:: The gemset to use state:: - Either "present" or "absent" + Either "present" or "absent", defaults to "present". OPTIONAL PARAMETERS ------------------- diff --git a/cdist/conf/type/__rvm_gem/parameter/default/state b/cdist/conf/type/__rvm_gem/parameter/default/state new file mode 100644 index 00000000..e7f6134f --- /dev/null +++ b/cdist/conf/type/__rvm_gem/parameter/default/state @@ -0,0 +1 @@ +present diff --git a/cdist/conf/type/__rvm_gem/parameter/optional b/cdist/conf/type/__rvm_gem/parameter/optional index 4ad96d51..96983811 100644 --- a/cdist/conf/type/__rvm_gem/parameter/optional +++ b/cdist/conf/type/__rvm_gem/parameter/optional @@ -1 +1,2 @@ default +state diff --git a/cdist/conf/type/__rvm_gem/parameter/required b/cdist/conf/type/__rvm_gem/parameter/required index 75f60bb8..58243a95 100644 --- a/cdist/conf/type/__rvm_gem/parameter/required +++ b/cdist/conf/type/__rvm_gem/parameter/required @@ -1,3 +1,2 @@ -state gemset user