From 824381e6cac28acbf3c5cd84d9d9000b3b37249e Mon Sep 17 00:00:00 2001 From: Daniel Heule Date: Fri, 17 Jan 2014 23:35:02 +0100 Subject: [PATCH 01/60] new special value require="CDIST_HONOR_MANIFEST_ORDER" which tells cdist to execute types in the manifest order --- cdist/emulator.py | 16 ++++++++++++++++ docs/man/man7/cdist-manifest.text | 16 ++++++++++++++++ 2 files changed, 32 insertions(+) diff --git a/cdist/emulator.py b/cdist/emulator.py index b70ef956..fe2af4c1 100644 --- a/cdist/emulator.py +++ b/cdist/emulator.py @@ -71,6 +71,7 @@ class Emulator(object): raise MissingRequiredEnvironmentVariableError(e.args[0]) self.object_base_path = os.path.join(self.global_path, "object") + self.typeorder_path = os.path.join(self.global_path, "typeorder") self.type_name = os.path.basename(argv[0]) self.cdist_type = core.CdistType(self.type_base_path, self.type_name) @@ -152,6 +153,9 @@ class Emulator(object): else: self.cdist_object.create() self.cdist_object.parameters = self.parameters + # record the created object in typeorder file + with open(self.typeorder_path, 'a') as tofd: + tofd.write(self.cdist_object.name + os.linesep) # Record / Append source self.cdist_object.source.append(self.object_source) @@ -188,6 +192,18 @@ class Emulator(object): # Ignore empty fields - probably the only field anyway if len(requirement) == 0: continue + + if requirement == "CDIST_HONOR_MANIFEST_ORDER": + # load object name created bevor this one from typeorder file ... + with open(self.typeorder_path, 'r') as tofd: + lines = tofd.readlines() + # replace the placeholder with the last created object + try: + requirement = lines[-2].strip() + except IndexError: + # if no second last line, we are on the first object, so do not set a requirement + continue + # Raises an error, if object cannot be created try: cdist_object = self.cdist_object.object_from_name(requirement) diff --git a/docs/man/man7/cdist-manifest.text b/docs/man/man7/cdist-manifest.text index 92d0b897..d2738c2b 100644 --- a/docs/man/man7/cdist-manifest.text +++ b/docs/man/man7/cdist-manifest.text @@ -128,6 +128,22 @@ All objects that are created in a type manifest are automatically required from the type that is calling them. This is called "autorequirement" in cdist jargon. +You can tell cdist to execute all types in the order in which they are created +in the manifest by setting require to the special value of +"CDIST_HONOR_MANIFEST_ORDER". + +-------------------------------------------------------------------------------- + +# Tells cdist to execute all types in the order in which they are created ... +export require="CDIST_HONOR_MANIFEST_ORDER" +__sample_type 1 +__sample_type 2 +__example_type 23 +# Now this types are executed in the creation order +-------------------------------------------------------------------------------- + + + EXAMPLES -------- From 61aec12ba1b0b0f55ec418895b61d46701c56b30 Mon Sep 17 00:00:00 2001 From: Daniel Heule Date: Sat, 18 Jan 2014 19:23:21 +0100 Subject: [PATCH 02/60] Try2 to make cdist honor the manifest order, this implementation has some more lines of code, but no collision with the require variable. --- cdist/emulator.py | 36 ++++++++++++++++++------------- docs/man/man7/cdist-manifest.text | 22 ++++++++++++++----- 2 files changed, 38 insertions(+), 20 deletions(-) diff --git a/cdist/emulator.py b/cdist/emulator.py index fe2af4c1..eeb441aa 100644 --- a/cdist/emulator.py +++ b/cdist/emulator.py @@ -154,8 +154,8 @@ class Emulator(object): self.cdist_object.create() self.cdist_object.parameters = self.parameters # record the created object in typeorder file - with open(self.typeorder_path, 'a') as tofd: - tofd.write(self.cdist_object.name + os.linesep) + with open(self.typeorder_path, 'a') as typeorderfile: + print(self.cdist_object.name, file=typeorderfile) # Record / Append source self.cdist_object.source.append(self.object_source) @@ -184,6 +184,24 @@ class Emulator(object): def record_requirements(self): """record requirements""" + #from pudb import set_trace; set_trace(); + + if "EXECUTE_TYPES_IN_CREATION_ORDER" in self.env and self.env['EXECUTE_TYPES_IN_CREATION_ORDER'] == 'true': + # load object name created bevor this one from typeorder file ... + with open(self.typeorder_path, 'r') as typecreationfile: + typecreationorder = typecreationfile.readlines() + # get the type created bevore this one ... + try: + lastcreatedtype = typecreationorder[-2].strip() + if 'require' in self.env: + self.env['require'] += " " + lastcreatedtype + else: + self.env['require'] = lastcreatedtype + self.log.debug("Injecting require for EXECUTE_TYPES_IN_CREATION_ORDER: %s for %s", lastcreatedtype, self.cdist_object.name) + except IndexError: + # if no second last line, we are on the first type, so do not set a requirement + pass + if "require" in self.env: requirements = self.env['require'] @@ -192,18 +210,6 @@ class Emulator(object): # Ignore empty fields - probably the only field anyway if len(requirement) == 0: continue - - if requirement == "CDIST_HONOR_MANIFEST_ORDER": - # load object name created bevor this one from typeorder file ... - with open(self.typeorder_path, 'r') as tofd: - lines = tofd.readlines() - # replace the placeholder with the last created object - try: - requirement = lines[-2].strip() - except IndexError: - # if no second last line, we are on the first object, so do not set a requirement - continue - # Raises an error, if object cannot be created try: cdist_object = self.cdist_object.object_from_name(requirement) @@ -212,7 +218,7 @@ class Emulator(object): raise - self.log.debug("Recording requirement: " + requirement) + self.log.debug("Recording requirement: %s", requirement) # Save the sanitised version, not the user supplied one # (__file//bar => __file/bar) diff --git a/docs/man/man7/cdist-manifest.text b/docs/man/man7/cdist-manifest.text index d2738c2b..d2f5ba05 100644 --- a/docs/man/man7/cdist-manifest.text +++ b/docs/man/man7/cdist-manifest.text @@ -128,18 +128,30 @@ All objects that are created in a type manifest are automatically required from the type that is calling them. This is called "autorequirement" in cdist jargon. + +EXECUTE_TYPES_IN_CREATION_ORDER is a EXPERIMENTAL FEATURE ! You can tell cdist to execute all types in the order in which they are created -in the manifest by setting require to the special value of -"CDIST_HONOR_MANIFEST_ORDER". +in the manifest by exporting EXECUTE_TYPES_IN_CREATION_ORDER with the value true. -------------------------------------------------------------------------------- # Tells cdist to execute all types in the order in which they are created ... -export require="CDIST_HONOR_MANIFEST_ORDER" +export EXECUTE_TYPES_IN_CREATION_ORDER=true __sample_type 1 -__sample_type 2 +require="__some_type_somewhere/id" __sample_type 2 __example_type 23 -# Now this types are executed in the creation order +# Now this types are executed in the creation order until the variable is unset +unset EXECUTE_TYPES_IN_CREATION_ORDER +# all now following types cdist makes the order .. +__not_in_order_type 42 + +# how it works : +# this lines above are translated to: +__sample_type 1 +require="__some_type_somewhere/id __sample_type/1" __sample_type 2 +require="__sample_type/2" __example_type 23 +__not_in_order_type 42 + -------------------------------------------------------------------------------- From aee97cffd662ac21991517b6933a84409ca900b0 Mon Sep 17 00:00:00 2001 From: Steven Armstrong Date: Mon, 20 Jan 2014 14:01:29 +0100 Subject: [PATCH 03/60] install proper packages Signed-off-by: Steven Armstrong --- cdist/conf/type/__apt_ppa/man.text | 7 +++++-- cdist/conf/type/__apt_ppa/manifest | 6 +++--- cdist/conf/type/__apt_ppa/parameter/default/state | 1 + cdist/conf/type/__apt_ppa/parameter/{required => optional} | 0 4 files changed, 9 insertions(+), 5 deletions(-) create mode 100644 cdist/conf/type/__apt_ppa/parameter/default/state rename cdist/conf/type/__apt_ppa/parameter/{required => optional} (100%) diff --git a/cdist/conf/type/__apt_ppa/man.text b/cdist/conf/type/__apt_ppa/man.text index 6a5990d5..da18e9f0 100644 --- a/cdist/conf/type/__apt_ppa/man.text +++ b/cdist/conf/type/__apt_ppa/man.text @@ -16,7 +16,8 @@ This cdist type allows manage ubuntu ppa repositories. REQUIRED PARAMETERS ------------------- state:: - The state the ppa should be in, either "present" or "absent". + The state the ppa should be in, either 'present' or 'absent'. + Defaults to 'present' OPTIONAL PARAMETERS @@ -29,6 +30,8 @@ EXAMPLES -------------------------------------------------------------------------------- # Enable a ppa repository +__apt_ppa ppa:sans-intern/missing-bits +# same as __apt_ppa ppa:sans-intern/missing-bits --state present # Disable a ppa repository @@ -43,5 +46,5 @@ SEE ALSO COPYING ------- -Copyright \(C) 2011 Steven Armstrong. Free use of this software is +Copyright \(C) 2011-2014 Steven Armstrong. Free use of this software is granted under the terms of the GNU General Public License version 3 (GPLv3). diff --git a/cdist/conf/type/__apt_ppa/manifest b/cdist/conf/type/__apt_ppa/manifest index e7ad0c26..2d91942b 100755 --- a/cdist/conf/type/__apt_ppa/manifest +++ b/cdist/conf/type/__apt_ppa/manifest @@ -1,6 +1,6 @@ #!/bin/sh # -# 2011 Steven Armstrong (steven-cdist at armstrong.cc) +# 2011-2014 Steven Armstrong (steven-cdist at armstrong.cc) # # This file is part of cdist. # @@ -20,9 +20,9 @@ name="$__object_id" -__package python-software-properties --state present +__package software-properties-common -require="__package/python-software-properties" \ +require="__package/software-properties-common" \ __file /usr/local/bin/remove-apt-repository \ --source "$__type/files/remove-apt-repository" \ --mode 0755 diff --git a/cdist/conf/type/__apt_ppa/parameter/default/state b/cdist/conf/type/__apt_ppa/parameter/default/state new file mode 100644 index 00000000..e7f6134f --- /dev/null +++ b/cdist/conf/type/__apt_ppa/parameter/default/state @@ -0,0 +1 @@ +present diff --git a/cdist/conf/type/__apt_ppa/parameter/required b/cdist/conf/type/__apt_ppa/parameter/optional similarity index 100% rename from cdist/conf/type/__apt_ppa/parameter/required rename to cdist/conf/type/__apt_ppa/parameter/optional From 92e67182a65c9421dc1a65e5de545c18bca46606 Mon Sep 17 00:00:00 2001 From: Daniel Heule Date: Tue, 21 Jan 2014 22:24:35 +0100 Subject: [PATCH 04/60] parameter default handling in __cdist type corrected --- cdist/conf/type/__cdist/manifest | 18 +++--------------- .../conf/type/__cdist/parameter/default/branch | 1 + .../conf/type/__cdist/parameter/default/source | 1 + .../type/__cdist/parameter/default/username | 1 + 4 files changed, 6 insertions(+), 15 deletions(-) create mode 100644 cdist/conf/type/__cdist/parameter/default/branch create mode 100644 cdist/conf/type/__cdist/parameter/default/source create mode 100644 cdist/conf/type/__cdist/parameter/default/username diff --git a/cdist/conf/type/__cdist/manifest b/cdist/conf/type/__cdist/manifest index 44d62f6c..7c0ae60e 100755 --- a/cdist/conf/type/__cdist/manifest +++ b/cdist/conf/type/__cdist/manifest @@ -27,23 +27,11 @@ else shell="" fi -if [ -f "$__object/parameter/username" ]; then - username="$(cat "$__object/parameter/username")" -else - username="cdist" -fi +username="$(cat "$__object/parameter/username")" -if [ -f "$__object/parameter/branch" ]; then - branch="$(cat "$__object/parameter/branch")" -else - branch="master" -fi +branch="$(cat "$__object/parameter/branch")" -if [ -f "$__object/parameter/source" ]; then - source="$(cat "$__object/parameter/source")" -else - source="git://github.com/telmich/cdist.git" -fi +source="$(cat "$__object/parameter/source")" # Currently hardcoded - if anyone cares, make a parameter # out of it diff --git a/cdist/conf/type/__cdist/parameter/default/branch b/cdist/conf/type/__cdist/parameter/default/branch new file mode 100644 index 00000000..1f7391f9 --- /dev/null +++ b/cdist/conf/type/__cdist/parameter/default/branch @@ -0,0 +1 @@ +master diff --git a/cdist/conf/type/__cdist/parameter/default/source b/cdist/conf/type/__cdist/parameter/default/source new file mode 100644 index 00000000..d669308f --- /dev/null +++ b/cdist/conf/type/__cdist/parameter/default/source @@ -0,0 +1 @@ +git://github.com/telmich/cdist.git diff --git a/cdist/conf/type/__cdist/parameter/default/username b/cdist/conf/type/__cdist/parameter/default/username new file mode 100644 index 00000000..a585e141 --- /dev/null +++ b/cdist/conf/type/__cdist/parameter/default/username @@ -0,0 +1 @@ +cdist From 02c3fe49887d75d28d581221cf51eeaf00e66379 Mon Sep 17 00:00:00 2001 From: Daniel Heule Date: Tue, 21 Jan 2014 22:33:10 +0100 Subject: [PATCH 05/60] parameter default handling in __qemu_img type corrected --- cdist/conf/type/__qemu_img/gencode-remote | 6 ++---- cdist/conf/type/__qemu_img/manifest | 6 ++---- cdist/conf/type/__qemu_img/parameter/default/format | 1 + cdist/conf/type/__qemu_img/parameter/default/state | 1 + cdist/conf/type/__qemu_img/parameter/optional | 1 + 5 files changed, 7 insertions(+), 8 deletions(-) create mode 100644 cdist/conf/type/__qemu_img/parameter/default/format create mode 100644 cdist/conf/type/__qemu_img/parameter/default/state diff --git a/cdist/conf/type/__qemu_img/gencode-remote b/cdist/conf/type/__qemu_img/gencode-remote index 2a76cf8f..6e4bb4d0 100644 --- a/cdist/conf/type/__qemu_img/gencode-remote +++ b/cdist/conf/type/__qemu_img/gencode-remote @@ -2,8 +2,7 @@ # State: absent is handled by manifest - we need only to do stuff if image is # not existing and state != absent # -state="present" -[ -f "$__object/parameter/state" ] && state="$(cat "$__object/parameter/state")" +state="$(cat "$__object/parameter/state")" [ "$state" = "absent" ] && exit 0 exists="$(cat "$__object/explorer/exists")" @@ -13,8 +12,7 @@ exists="$(cat "$__object/explorer/exists")" # Still there? Create image # -format=qcow2 -[ -f "$__object/parameter/format" ] && format="$(cat "$__object/parameter/format")" +format="$(cat "$__object/parameter/format")" size="$(cat "$__object/parameter/size")" diskimage="/$__object_id" diff --git a/cdist/conf/type/__qemu_img/manifest b/cdist/conf/type/__qemu_img/manifest index b835301d..6d50037f 100644 --- a/cdist/conf/type/__qemu_img/manifest +++ b/cdist/conf/type/__qemu_img/manifest @@ -2,10 +2,8 @@ # Default settings # -format=qcow2 -state=present -[ -f "$__object/parameter/format" ] && format="$(cat "$__object/parameter/format")" -[ -f "$__object/parameter/state" ] && state="$(cat "$__object/parameter/state")" +format="$(cat "$__object/parameter/format")" +state="$(cat "$__object/parameter/state")" diskimage="/$__object_id" diff --git a/cdist/conf/type/__qemu_img/parameter/default/format b/cdist/conf/type/__qemu_img/parameter/default/format new file mode 100644 index 00000000..e0a90ab9 --- /dev/null +++ b/cdist/conf/type/__qemu_img/parameter/default/format @@ -0,0 +1 @@ +qcow2 diff --git a/cdist/conf/type/__qemu_img/parameter/default/state b/cdist/conf/type/__qemu_img/parameter/default/state new file mode 100644 index 00000000..e7f6134f --- /dev/null +++ b/cdist/conf/type/__qemu_img/parameter/default/state @@ -0,0 +1 @@ +present diff --git a/cdist/conf/type/__qemu_img/parameter/optional b/cdist/conf/type/__qemu_img/parameter/optional index 0e8469e7..71b9a32b 100644 --- a/cdist/conf/type/__qemu_img/parameter/optional +++ b/cdist/conf/type/__qemu_img/parameter/optional @@ -1 +1,2 @@ format +state From 08b8270739b7a17778d5e5427d6635b65ba1484a Mon Sep 17 00:00:00 2001 From: Daniel Heule Date: Tue, 21 Jan 2014 22:45:35 +0100 Subject: [PATCH 06/60] parameter default handling in __zypper_service type corrected --- cdist/conf/type/__zypper_service/gencode-remote | 13 ++----------- cdist/conf/type/__zypper_service/manifest | 6 +----- 2 files changed, 3 insertions(+), 16 deletions(-) diff --git a/cdist/conf/type/__zypper_service/gencode-remote b/cdist/conf/type/__zypper_service/gencode-remote index d11749ae..df8d1660 100644 --- a/cdist/conf/type/__zypper_service/gencode-remote +++ b/cdist/conf/type/__zypper_service/gencode-remote @@ -39,17 +39,8 @@ else uri="$__object_id" fi -if [ -f "$__object/parameter/state" ]; then - state_should="$(cat "$__object/parameter/state")" -else - state_should="present" -fi - -if [ -f "$__object/parameter/type" ]; then - stype="$(cat "$__object/parameter/type")" -else - stype="ris" -fi +state_should="$(cat "$__object/parameter/state")" +stype="$(cat "$__object/parameter/type")" exp_uri="$(cat "$__object/explorer/service_uri")" exp_id="$(cat "$__object/explorer/service_id")" diff --git a/cdist/conf/type/__zypper_service/manifest b/cdist/conf/type/__zypper_service/manifest index d8773605..aa4a39a3 100644 --- a/cdist/conf/type/__zypper_service/manifest +++ b/cdist/conf/type/__zypper_service/manifest @@ -33,11 +33,7 @@ else uri="$__object_id" fi -if [ -f "$__object/parameter/state" ]; then - state_should="$(cat "$__object/parameter/state")" -else - state_should="present" -fi +state_should="$(cat "$__object/parameter/state")" exp_uri="$(cat "$__object/explorer/service_uri")" From 360b42e89219d088b4bfb24db610672111f7b9bd Mon Sep 17 00:00:00 2001 From: Daniel Heule Date: Tue, 21 Jan 2014 22:57:06 +0100 Subject: [PATCH 07/60] parameter default handling in __zypper_repo type corrected --- cdist/conf/type/__zypper_repo/gencode-remote | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/cdist/conf/type/__zypper_repo/gencode-remote b/cdist/conf/type/__zypper_repo/gencode-remote index 4d834c47..f678552b 100644 --- a/cdist/conf/type/__zypper_repo/gencode-remote +++ b/cdist/conf/type/__zypper_repo/gencode-remote @@ -45,11 +45,7 @@ else id="$__object_id" fi -if [ -f "$__object/parameter/state" ]; then - state="$(cat "$__object/parameter/state")" -else - state="present" -fi +state="$(cat "$__object/parameter/state")" repo_id="$(cat "$__object/explorer/repo_id")" From b75481a4d41cb45c25cccdf2bfb053a10e7b9ede Mon Sep 17 00:00:00 2001 From: Daniel Heule Date: Tue, 21 Jan 2014 23:18:10 +0100 Subject: [PATCH 08/60] parameter default handling in __key_value type corrected --- cdist/conf/type/__key_value/gencode-remote | 4 ++-- cdist/conf/type/__key_value/manifest | 3 +-- cdist/conf/type/__key_value/parameter/default/state | 1 + 3 files changed, 4 insertions(+), 4 deletions(-) create mode 100644 cdist/conf/type/__key_value/parameter/default/state diff --git a/cdist/conf/type/__key_value/gencode-remote b/cdist/conf/type/__key_value/gencode-remote index ec91894f..b79d9688 100755 --- a/cdist/conf/type/__key_value/gencode-remote +++ b/cdist/conf/type/__key_value/gencode-remote @@ -21,8 +21,8 @@ key="$__object_id" [ -f "$__object/parameter/key" ] && key="$(cat "$__object/parameter/key")" -state_should=present -[ -f "$__object/parameter/state" ] && state_should="$(cat "$__object/parameter/state")" + +state_should="$(cat "$__object/parameter/state")" file="$(cat "$__object/parameter/file")" delimiter="$(cat "$__object/parameter/delimiter")" diff --git a/cdist/conf/type/__key_value/manifest b/cdist/conf/type/__key_value/manifest index 8ed9cc9c..56f4c874 100755 --- a/cdist/conf/type/__key_value/manifest +++ b/cdist/conf/type/__key_value/manifest @@ -19,8 +19,7 @@ # along with cdist. If not, see . # -state_should=present -[ -f "$__object/parameter/state" ] && state_should="$(cat "$__object/parameter/state")" +state_should="$(cat "$__object/parameter/state")" if [ "$state_should" = "present" -a ! -f "$__object/parameter/value" ]; then echo "Missing required parameter 'value'" >&2 diff --git a/cdist/conf/type/__key_value/parameter/default/state b/cdist/conf/type/__key_value/parameter/default/state new file mode 100644 index 00000000..e7f6134f --- /dev/null +++ b/cdist/conf/type/__key_value/parameter/default/state @@ -0,0 +1 @@ +present From 0e49ccbf4369acc66b351b984685ad35a064de3e Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Wed, 22 Jan 2014 00:44:56 +0100 Subject: [PATCH 09/60] ++changes Signed-off-by: Nico Schottelius --- docs/changelog | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/docs/changelog b/docs/changelog index 242f92b0..4addc772 100644 --- a/docs/changelog +++ b/docs/changelog @@ -9,7 +9,12 @@ Changelog * Core: Add environment variable to select shell for executing scripts (Daniel Heule) * Explorer hostname: Return host name by using uname -n * New Type: __hostname (Steven Armstrong) + * Type __cdist: Use default paremeters (Daniel Heule) + * Type __key_value: Use default paremeters (Daniel Heule) * Type __line: Use printf instead of echo for printing user input + * Type __qemu_img: Use default paremeters (Daniel Heule) + * Type __zypper_repo: Use default paremeters (Daniel Heule) + * Type __zypper_service: Use default paremeters (Daniel Heule) 3.0.2: 2014-01-19 * Documentation: Document all messages sent by types (Daniel Heule) From 87d72dfc1a7b6c4a8c2d0bbd77c6188dac8555fa Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Wed, 22 Jan 2014 00:46:35 +0100 Subject: [PATCH 10/60] release: 3.0.3 Signed-off-by: Nico Schottelius --- docs/changelog | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/changelog b/docs/changelog index 4addc772..d4100898 100644 --- a/docs/changelog +++ b/docs/changelog @@ -4,7 +4,7 @@ Changelog * Changes are always commented with their author in (braces) * Exception: No braces means author == Nico Schottelius -3.0.3: +3.0.3: 2014-01-22 * Core: Enhance error message when requirement is missing object id * Core: Add environment variable to select shell for executing scripts (Daniel Heule) * Explorer hostname: Return host name by using uname -n From 7a0b3cd7b7d416d16ff34f03402110b6327cf8a0 Mon Sep 17 00:00:00 2001 From: Steven Armstrong Date: Wed, 22 Jan 2014 21:21:34 +0100 Subject: [PATCH 11/60] python-software-properties still needed for older ubuntu versions Signed-off-by: Steven Armstrong --- cdist/conf/type/__apt_ppa/manifest | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/cdist/conf/type/__apt_ppa/manifest b/cdist/conf/type/__apt_ppa/manifest index 2d91942b..1d90e9c4 100755 --- a/cdist/conf/type/__apt_ppa/manifest +++ b/cdist/conf/type/__apt_ppa/manifest @@ -21,8 +21,9 @@ name="$__object_id" __package software-properties-common +__package python-software-properties -require="__package/software-properties-common" \ +require="__package/software-properties-common __package/python-software-properties" \ __file /usr/local/bin/remove-apt-repository \ --source "$__type/files/remove-apt-repository" \ --mode 0755 From a62e4aade352cc4786a1240ef8b5912234e1c856 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Wed, 22 Jan 2014 22:07:12 +0100 Subject: [PATCH 12/60] ++changes Signed-off-by: Nico Schottelius --- docs/changelog | 3 +++ 1 file changed, 3 insertions(+) diff --git a/docs/changelog b/docs/changelog index d4100898..d8af2cf3 100644 --- a/docs/changelog +++ b/docs/changelog @@ -4,6 +4,9 @@ Changelog * Changes are always commented with their author in (braces) * Exception: No braces means author == Nico Schottelius +3.0.4: + * Type __apt_ppa: Install required software (Steven Armstrong) + 3.0.3: 2014-01-22 * Core: Enhance error message when requirement is missing object id * Core: Add environment variable to select shell for executing scripts (Daniel Heule) From 78be159eb789dfef83421cff5703d0b54f25c904 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Mon, 27 Jan 2014 14:15:41 +0100 Subject: [PATCH 13/60] update reference: we also do not touch 'files' in the object Signed-off-by: Nico Schottelius --- docs/man/cdist-reference.text.sh | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/docs/man/cdist-reference.text.sh b/docs/man/cdist-reference.text.sh index a72452eb..5c9f603c 100755 --- a/docs/man/cdist-reference.text.sh +++ b/docs/man/cdist-reference.text.sh @@ -131,7 +131,8 @@ confdir/type//explorer:: confdir/type//files:: This directory is reserved for user data and will not be used - by cdist at any time + by cdist at any time. It can be used for storing supplementary + files (like scripts to act as a template or configuration files). out/:: This directory contains output of cdist and is usually located @@ -175,9 +176,16 @@ OBJECTS For object to object communication and tests, the following paths are usable within a object directory: +files:: + This directory is reserved for user data and will not be used + by cdist at any time. It can be used freely by the type + (for instance to store template results). changed:: This empty file exists in an object directory, if the object has code to be excuted (either remote or local) +stdin:: + This file exists and contains data, if data was provided on stdin + when the type was called. ENVIRONMENT VARIABLES From 9049a1421cfd5b5e8f4ee72e79178ab90dce681c Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Mon, 27 Jan 2014 14:17:51 +0100 Subject: [PATCH 14/60] support --file - in __debconf_set_selections Signed-off-by: Nico Schottelius --- .../conf/type/__debconf_set_selections/gencode-remote | 10 ++++++++-- cdist/conf/type/__debconf_set_selections/man.text | 7 ++++++- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/cdist/conf/type/__debconf_set_selections/gencode-remote b/cdist/conf/type/__debconf_set_selections/gencode-remote index 62be6a12..4892ec25 100755 --- a/cdist/conf/type/__debconf_set_selections/gencode-remote +++ b/cdist/conf/type/__debconf_set_selections/gencode-remote @@ -1,6 +1,6 @@ #!/bin/sh # -# 2011 Nico Schottelius (nico-cdist at schottelius.org) +# 2011-2014 Nico Schottelius (nico-cdist at schottelius.org) # # This file is part of cdist. # @@ -21,6 +21,12 @@ # Setup selections # +filename"$(cat "$__object/parameter/file")" + +if [ "$filename" = "-" ]; then + filename="$__object/stdin" +fi + echo "debconf-set-selections << __file-eof" -cat "$(cat "$__object/parameter/file")" +cat "$(cat "$filename")" echo "__file-eof" diff --git a/cdist/conf/type/__debconf_set_selections/man.text b/cdist/conf/type/__debconf_set_selections/man.text index f1e13a8e..e36ebaa3 100644 --- a/cdist/conf/type/__debconf_set_selections/man.text +++ b/cdist/conf/type/__debconf_set_selections/man.text @@ -18,6 +18,7 @@ REQUIRED PARAMETERS ------------------- file:: Use the given filename as input for debconf-set-selections(1) + If filename is "-", read from stdin. EXAMPLES @@ -29,6 +30,10 @@ __debconf_set_selections nslcd --file /path/to/file # Setup configuration for nslcd from another type __debconf_set_selections nslcd --file "$__type/files/preseed/nslcd" + +__debconf_set_selections nslcd --file - << eof +gitolite gitolite/gituser string git +eof -------------------------------------------------------------------------------- @@ -41,5 +46,5 @@ SEE ALSO COPYING ------- -Copyright \(C) 2011-2013 Nico Schottelius. Free use of this software is +Copyright \(C) 2011-2014 Nico Schottelius. Free use of this software is granted under the terms of the GNU General Public License version 3 (GPLv3). From 565e11b16dc53c0d887c4060940c7bffb2e581d5 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Mon, 27 Jan 2014 14:18:56 +0100 Subject: [PATCH 15/60] ++changes Signed-off-by: Nico Schottelius --- docs/changelog | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/docs/changelog b/docs/changelog index d8af2cf3..d9c2c8b5 100644 --- a/docs/changelog +++ b/docs/changelog @@ -5,7 +5,10 @@ Changelog * Exception: No braces means author == Nico Schottelius 3.0.4: + * Documentation: Update reference (files path in object space) * Type __apt_ppa: Install required software (Steven Armstrong) + * Type __debconf_set_selections: Support --file - to read from stdin + 3.0.3: 2014-01-22 * Core: Enhance error message when requirement is missing object id @@ -19,6 +22,7 @@ Changelog * Type __zypper_repo: Use default paremeters (Daniel Heule) * Type __zypper_service: Use default paremeters (Daniel Heule) + 3.0.2: 2014-01-19 * Documentation: Document all messages sent by types (Daniel Heule) * New Type: __block (Steven Armstrong) From 4ef55ef13f9172ab6bb045d5a6bfb7acec982758 Mon Sep 17 00:00:00 2001 From: Daniel Heule Date: Mon, 27 Jan 2014 16:19:01 +0100 Subject: [PATCH 16/60] allow object overrides with CDIST_ALLOW_OVERRIDE=true --- cdist/core/cdist_object.py | 6 ++++-- cdist/emulator.py | 5 ++++- docs/man/man7/cdist-manifest.text | 24 ++++++++++++++++++++++++ 3 files changed, 32 insertions(+), 3 deletions(-) diff --git a/cdist/core/cdist_object.py b/cdist/core/cdist_object.py index 45b5e3ff..9ead71c7 100644 --- a/cdist/core/cdist_object.py +++ b/cdist/core/cdist_object.py @@ -2,6 +2,7 @@ # # 2011 Steven Armstrong (steven-cdist at armstrong.cc) # 2011-2013 Nico Schottelius (nico-cdist at schottelius.org) +# 2014 Daniel Heule (hda at sfs.biz) # # This file is part of cdist. # @@ -215,9 +216,10 @@ class CdistObject(object): """Create this cdist object on the filesystem. """ try: - os.makedirs(self.absolute_path, exist_ok=False) + cdexist_ok = True if os.environ.get('CDIST_ALLOW_OVERRIDE',"false") == 'true' else False + os.makedirs(self.absolute_path, exist_ok=cdexist_ok) absolute_parameter_path = os.path.join(self.base_path, self.parameter_path) - os.makedirs(absolute_parameter_path, exist_ok=False) + os.makedirs(absolute_parameter_path, exist_ok=cdexist_ok) except EnvironmentError as error: raise cdist.Error('Error creating directories for cdist object: %s: %s' % (self, error)) diff --git a/cdist/emulator.py b/cdist/emulator.py index 63d3bbbc..0693eb35 100644 --- a/cdist/emulator.py +++ b/cdist/emulator.py @@ -2,6 +2,7 @@ # # 2011-2013 Nico Schottelius (nico-cdist at schottelius.org) # 2012 Steven Armstrong (steven-cdist at armstrong.cc) +# 2014 Daniel Heule (hda at sfs.biz) # # This file is part of cdist. # @@ -144,12 +145,14 @@ class Emulator(object): if value is not None: self.parameters[key] = value - if self.cdist_object.exists: + if self.cdist_object.exists and os.environ.get('CDIST_ALLOW_OVERRIDE',"false") != 'true': if self.cdist_object.parameters != self.parameters: raise cdist.Error("Object %s already exists with conflicting parameters:\n%s: %s\n%s: %s" % (self.cdist_object.name, " ".join(self.cdist_object.source), self.cdist_object.parameters, self.object_source, self.parameters) ) else: + if self.cdist_object.exists: + self.log.debug('Object %s override forced with CDIST_ALLOW_OVERRIDE=true',self.cdist_object.name) self.cdist_object.create() self.cdist_object.parameters = self.parameters diff --git a/docs/man/man7/cdist-manifest.text b/docs/man/man7/cdist-manifest.text index 92d0b897..84dc36ae 100644 --- a/docs/man/man7/cdist-manifest.text +++ b/docs/man/man7/cdist-manifest.text @@ -161,6 +161,30 @@ __package lighttpd --state present require="__package/lighttpd" __package munin --state present -------------------------------------------------------------------------------- +OVERRIDES +--------- +In some special cases, you would like to create an allready defined object +with different parameters. In normal situations this leads to an error in cdist. +If you whish, you can mark this second definition of an object with +CDIST_ALLOW_OVERRIDE=true to tell cdist, that this object override is +wanted and should be accepted. + +-------------------------------------------------------------------------------- +# for example in the inial manifest + +# reate user account foobar with some hash for password +__user foobar --password 'some_fancy_hash' + +# ... many statements and includes in the manifest later ... +# somewhere in a conditionaly sourced manifest +# (e.g. for example only sourced if a special application is on the target host) + +# this leads to an error ... +__user foobar --password 'some_other_hash' + +# this tells cdist, that you know that this is an override and should be accepted +CDIST_ALLOW_OVERRIDE=true __user foobar --password 'some_other_hash' +-------------------------------------------------------------------------------- SEE ALSO From 723be34bca37e97cb7cf3d94367d5e224ec7b325 Mon Sep 17 00:00:00 2001 From: Jake Guffey Date: Mon, 27 Jan 2014 13:22:03 -0500 Subject: [PATCH 17/60] Fixed typo Was assigning jaildir=$object/parameter/name, fixed to $object/parameter/jaildir --- cdist/conf/type/__jail/gencode-local | 2 +- cdist/conf/type/__jail/gencode-remote | 2 +- cdist/conf/type/__jail/manifest | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/cdist/conf/type/__jail/gencode-local b/cdist/conf/type/__jail/gencode-local index 075a6ef1..d6384156 100755 --- a/cdist/conf/type/__jail/gencode-local +++ b/cdist/conf/type/__jail/gencode-local @@ -23,7 +23,7 @@ # if [ -f "$__object/parameter/jaildir" ]; then - jaildir="$(cat "$__object/parameter/name")" + jaildir="$(cat "$__object/parameter/jaildir")" else jaildir="/usr/jail" fi diff --git a/cdist/conf/type/__jail/gencode-remote b/cdist/conf/type/__jail/gencode-remote index b044e4b0..afbb81a5 100755 --- a/cdist/conf/type/__jail/gencode-remote +++ b/cdist/conf/type/__jail/gencode-remote @@ -85,7 +85,7 @@ if [ -f "$__object/parameter/onboot" ]; then fi if [ -f "$__object/parameter/jaildir" ]; then - jaildir="$(cat "$__object/parameter/name")" + jaildir="$(cat "$__object/parameter/jaildir")" else jaildir="/usr/jail" fi diff --git a/cdist/conf/type/__jail/manifest b/cdist/conf/type/__jail/manifest index 0570d62d..cf5b7938 100755 --- a/cdist/conf/type/__jail/manifest +++ b/cdist/conf/type/__jail/manifest @@ -34,7 +34,7 @@ if [ ! "$os" = "freebsd" ]; then fi if [ -f "$__object/parameter/jaildir" ]; then - jaildir="$(cat "$__object/parameter/name")" + jaildir="$(cat "$__object/parameter/jaildir")" else jaildir="/usr/jail" fi From e52a059adfbb2152d33f0cb9e7c1516db9e00188 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Mon, 27 Jan 2014 19:38:26 +0100 Subject: [PATCH 18/60] ++changes Signed-off-by: Nico Schottelius --- docs/changelog | 1 + 1 file changed, 1 insertion(+) diff --git a/docs/changelog b/docs/changelog index d9c2c8b5..34e44913 100644 --- a/docs/changelog +++ b/docs/changelog @@ -8,6 +8,7 @@ Changelog * Documentation: Update reference (files path in object space) * Type __apt_ppa: Install required software (Steven Armstrong) * Type __debconf_set_selections: Support --file - to read from stdin + * Type __jail: Fix jaildir parameter handling (Jake Guffey) 3.0.3: 2014-01-22 From aa3e92f07b9ff91b298064ba8b6173ad0a1dcea6 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Wed, 29 Jan 2014 21:08:22 +0100 Subject: [PATCH 19/60] use directory files/, not templates Signed-off-by: Nico Schottelius --- docs/man/man7/cdist-best-practice.text | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/man/man7/cdist-best-practice.text b/docs/man/man7/cdist-best-practice.text index e6685cad..a818be60 100644 --- a/docs/man/man7/cdist-best-practice.text +++ b/docs/man/man7/cdist-best-practice.text @@ -164,8 +164,8 @@ For more details consult sudoers(5) TEMPLATING ---------- -* create directory templates/ in your type (convention) -* create the template as an executable file like templates/basic.conf.sh, it will output text using shell variables for the values +* create directory files/ in your type (convention) +* create the template as an executable file like files/basic.conf.sh, it will output text using shell variables for the values -------------------------------------------------------------------------------- #!/bin/sh @@ -191,7 +191,7 @@ EOF export ROOT='/var/www/test' # render the template mkdir -p "$__object/files" - "$__type/templates/basic.conf.sh" > "$__object/files/basic.conf" + "$__type/files/basic.conf.sh" > "$__object/files/basic.conf" # send the rendered template __file /etc/nginx/sites-available/test.conf \ --state present From 16d51b3cf11b445b24189bf225d2c9b37013a4a5 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Wed, 29 Jan 2014 22:40:59 +0100 Subject: [PATCH 20/60] backport ignoring install types in config mode from install_integration branch Signed-off-by: Nico Schottelius --- cdist/config.py | 6 +++++- cdist/core/cdist_type.py | 5 +++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/cdist/config.py b/cdist/config.py index 3f8a7fc6..73ba4710 100644 --- a/cdist/config.py +++ b/cdist/config.py @@ -163,7 +163,11 @@ class Config(object): """Short name for object list retrieval""" for cdist_object in core.CdistObject.list_objects(self.local.object_path, self.local.type_path): - yield cdist_object + if cdist_object.cdist_type.is_install: + self.log.debug("Running in config mode, ignoring install object: {0}".format(cdist_object)) + else: + yield cdist_object + def iterate_once(self): """ diff --git a/cdist/core/cdist_type.py b/cdist/core/cdist_type.py index 46e126f9..ff1ebaec 100644 --- a/cdist/core/cdist_type.py +++ b/cdist/core/cdist_type.py @@ -101,6 +101,11 @@ class CdistType(object): """Check whether a type is a singleton.""" return os.path.isfile(os.path.join(self.absolute_path, "singleton")) + @property + def is_install(self): + """Check whether a type is used for installation (if not: for configuration)""" + return os.path.isfile(os.path.join(self.absolute_path, "install")) + @property def explorers(self): """Return a list of available explorers""" From 228ed4dbd2608fc39a9dd878b44faed3b8cb5b58 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Wed, 29 Jan 2014 23:19:07 +0100 Subject: [PATCH 21/60] fix typos in __debconf_set_selections Signed-off-by: Nico Schottelius --- cdist/conf/type/__debconf_set_selections/gencode-remote | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cdist/conf/type/__debconf_set_selections/gencode-remote b/cdist/conf/type/__debconf_set_selections/gencode-remote index 4892ec25..bb719c46 100755 --- a/cdist/conf/type/__debconf_set_selections/gencode-remote +++ b/cdist/conf/type/__debconf_set_selections/gencode-remote @@ -21,12 +21,12 @@ # Setup selections # -filename"$(cat "$__object/parameter/file")" +filename="$(cat "$__object/parameter/file")" if [ "$filename" = "-" ]; then filename="$__object/stdin" fi echo "debconf-set-selections << __file-eof" -cat "$(cat "$filename")" +cat "$filename" echo "__file-eof" From d5f04b26c8e2f8f9a64a0a362695f3685a4c9b4d Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Wed, 29 Jan 2014 23:19:18 +0100 Subject: [PATCH 22/60] ++changes(3.0.4) Signed-off-by: Nico Schottelius --- docs/changelog | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/docs/changelog b/docs/changelog index 34e44913..32b4e42e 100644 --- a/docs/changelog +++ b/docs/changelog @@ -4,8 +4,10 @@ Changelog * Changes are always commented with their author in (braces) * Exception: No braces means author == Nico Schottelius -3.0.4: +3.0.4: 2014-01-29 + * Core: Ignore install types in config mode * Documentation: Update reference (files path in object space) + * Documentation: Update best practise: Replaces templates/ with files/ * Type __apt_ppa: Install required software (Steven Armstrong) * Type __debconf_set_selections: Support --file - to read from stdin * Type __jail: Fix jaildir parameter handling (Jake Guffey) From 197fabf40ac3c84f8bed89e3576b82672496bb61 Mon Sep 17 00:00:00 2001 From: Daniel Heule Date: Fri, 31 Jan 2014 17:56:55 +0100 Subject: [PATCH 23/60] added some ideas from asteven and a bit more description about the order in the manpage --- cdist/core/cdist_object.py | 7 +++---- cdist/emulator.py | 4 +++- docs/man/man7/cdist-manifest.text | 5 ++++- 3 files changed, 10 insertions(+), 6 deletions(-) diff --git a/cdist/core/cdist_object.py b/cdist/core/cdist_object.py index 9ead71c7..b17bd339 100644 --- a/cdist/core/cdist_object.py +++ b/cdist/core/cdist_object.py @@ -212,14 +212,13 @@ class CdistObject(object): """Checks wether this cdist object exists on the file systems.""" return os.path.exists(self.absolute_path) - def create(self): + def create(self, allow_overwrite=False): """Create this cdist object on the filesystem. """ try: - cdexist_ok = True if os.environ.get('CDIST_ALLOW_OVERRIDE',"false") == 'true' else False - os.makedirs(self.absolute_path, exist_ok=cdexist_ok) + os.makedirs(self.absolute_path, exist_ok=allow_overwrite) absolute_parameter_path = os.path.join(self.base_path, self.parameter_path) - os.makedirs(absolute_parameter_path, exist_ok=cdexist_ok) + os.makedirs(absolute_parameter_path, exist_ok=allow_overwrite) except EnvironmentError as error: raise cdist.Error('Error creating directories for cdist object: %s: %s' % (self, error)) diff --git a/cdist/emulator.py b/cdist/emulator.py index 0693eb35..e32f12e0 100644 --- a/cdist/emulator.py +++ b/cdist/emulator.py @@ -153,7 +153,9 @@ class Emulator(object): else: if self.cdist_object.exists: self.log.debug('Object %s override forced with CDIST_ALLOW_OVERRIDE=true',self.cdist_object.name) - self.cdist_object.create() + self.cdist_object.create(True) + else + self.cdist_object.create() self.cdist_object.parameters = self.parameters # Record / Append source diff --git a/docs/man/man7/cdist-manifest.text b/docs/man/man7/cdist-manifest.text index 84dc36ae..d9bcb893 100644 --- a/docs/man/man7/cdist-manifest.text +++ b/docs/man/man7/cdist-manifest.text @@ -163,11 +163,14 @@ require="__package/lighttpd" __package munin --state present OVERRIDES --------- -In some special cases, you would like to create an allready defined object +In some special cases, you would like to create an already defined object with different parameters. In normal situations this leads to an error in cdist. If you whish, you can mark this second definition of an object with CDIST_ALLOW_OVERRIDE=true to tell cdist, that this object override is wanted and should be accepted. +ATTENTION: Only use this feature if you are 100% sure in which order +cdist encounter the affected objects, otherwhise this results +into an undefined situation. -------------------------------------------------------------------------------- # for example in the inial manifest From 5fbac8d0baa85197216ed1e3cb3fa7262415fb40 Mon Sep 17 00:00:00 2001 From: Daniel Heule Date: Fri, 31 Jan 2014 17:59:56 +0100 Subject: [PATCH 24/60] forgot the : after the else ... --- cdist/emulator.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cdist/emulator.py b/cdist/emulator.py index e32f12e0..ed846e6d 100644 --- a/cdist/emulator.py +++ b/cdist/emulator.py @@ -154,7 +154,7 @@ class Emulator(object): if self.cdist_object.exists: self.log.debug('Object %s override forced with CDIST_ALLOW_OVERRIDE=true',self.cdist_object.name) self.cdist_object.create(True) - else + else: self.cdist_object.create() self.cdist_object.parameters = self.parameters From 99dedc493349f25dbc6ca191c78d395472a779c8 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Fri, 31 Jan 2014 21:48:09 +0100 Subject: [PATCH 25/60] examples are always the last section Signed-off-by: Nico Schottelius --- docs/man/man7/cdist-manifest.text | 58 +++++++++++++++---------------- 1 file changed, 29 insertions(+), 29 deletions(-) diff --git a/docs/man/man7/cdist-manifest.text b/docs/man/man7/cdist-manifest.text index d9bcb893..af86b7ee 100644 --- a/docs/man/man7/cdist-manifest.text +++ b/docs/man/man7/cdist-manifest.text @@ -129,6 +129,35 @@ from the type that is calling them. This is called "autorequirement" in cdist jargon. +OVERRIDES +--------- +In some special cases, you would like to create an already defined object +with different parameters. In normal situations this leads to an error in cdist. +If you whish, you can mark this second definition of an object with +CDIST_ALLOW_OVERRIDE=true to tell cdist, that this object override is +wanted and should be accepted. +ATTENTION: Only use this feature if you are 100% sure in which order +cdist encounter the affected objects, otherwhise this results +into an undefined situation. + +-------------------------------------------------------------------------------- +# for example in the inial manifest + +# reate user account foobar with some hash for password +__user foobar --password 'some_fancy_hash' + +# ... many statements and includes in the manifest later ... +# somewhere in a conditionaly sourced manifest +# (e.g. for example only sourced if a special application is on the target host) + +# this leads to an error ... +__user foobar --password 'some_other_hash' + +# this tells cdist, that you know that this is an override and should be accepted +CDIST_ALLOW_OVERRIDE=true __user foobar --password 'some_other_hash' +-------------------------------------------------------------------------------- + + EXAMPLES -------- The initial manifest may for instance contain the following code: @@ -161,35 +190,6 @@ __package lighttpd --state present require="__package/lighttpd" __package munin --state present -------------------------------------------------------------------------------- -OVERRIDES ---------- -In some special cases, you would like to create an already defined object -with different parameters. In normal situations this leads to an error in cdist. -If you whish, you can mark this second definition of an object with -CDIST_ALLOW_OVERRIDE=true to tell cdist, that this object override is -wanted and should be accepted. -ATTENTION: Only use this feature if you are 100% sure in which order -cdist encounter the affected objects, otherwhise this results -into an undefined situation. - --------------------------------------------------------------------------------- -# for example in the inial manifest - -# reate user account foobar with some hash for password -__user foobar --password 'some_fancy_hash' - -# ... many statements and includes in the manifest later ... -# somewhere in a conditionaly sourced manifest -# (e.g. for example only sourced if a special application is on the target host) - -# this leads to an error ... -__user foobar --password 'some_other_hash' - -# this tells cdist, that you know that this is an override and should be accepted -CDIST_ALLOW_OVERRIDE=true __user foobar --password 'some_other_hash' --------------------------------------------------------------------------------- - - SEE ALSO -------- - cdist-tutorial(7) From dc1a5dfd6dff5fbaeb544680e511246d653a792d Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Fri, 31 Jan 2014 21:50:32 +0100 Subject: [PATCH 26/60] update override documentation Signed-off-by: Nico Schottelius --- docs/man/man7/cdist-manifest.text | 38 +++++++++++++++++-------------- 1 file changed, 21 insertions(+), 17 deletions(-) diff --git a/docs/man/man7/cdist-manifest.text b/docs/man/man7/cdist-manifest.text index af86b7ee..7292a64f 100644 --- a/docs/man/man7/cdist-manifest.text +++ b/docs/man/man7/cdist-manifest.text @@ -140,23 +140,7 @@ ATTENTION: Only use this feature if you are 100% sure in which order cdist encounter the affected objects, otherwhise this results into an undefined situation. --------------------------------------------------------------------------------- -# for example in the inial manifest - -# reate user account foobar with some hash for password -__user foobar --password 'some_fancy_hash' - -# ... many statements and includes in the manifest later ... -# somewhere in a conditionaly sourced manifest -# (e.g. for example only sourced if a special application is on the target host) - -# this leads to an error ... -__user foobar --password 'some_other_hash' - -# this tells cdist, that you know that this is an override and should be accepted -CDIST_ALLOW_OVERRIDE=true __user foobar --password 'some_other_hash' --------------------------------------------------------------------------------- - +THIS IS A BETA FEATURE AND MAY BE REMOVED AT ANY TIME. EXAMPLES -------- @@ -190,6 +174,26 @@ __package lighttpd --state present require="__package/lighttpd" __package munin --state present -------------------------------------------------------------------------------- +How to override objects: + +-------------------------------------------------------------------------------- +# for example in the inital manifest + +# reate user account foobar with some hash for password +__user foobar --password 'some_fancy_hash' + +# ... many statements and includes in the manifest later ... +# somewhere in a conditionaly sourced manifest +# (e.g. for example only sourced if a special application is on the target host) + +# this leads to an error ... +__user foobar --password 'some_other_hash' + +# this tells cdist, that you know that this is an override and should be accepted +CDIST_ALLOW_OVERRIDE=true __user foobar --password 'some_other_hash' +-------------------------------------------------------------------------------- + + SEE ALSO -------- - cdist-tutorial(7) From ab3b15191884428689b6dd7379bea4278dd13ccd Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Fri, 31 Jan 2014 21:52:43 +0100 Subject: [PATCH 27/60] ++changes Signed-off-by: Nico Schottelius --- docs/changelog | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/docs/changelog b/docs/changelog index 32b4e42e..bd52bd78 100644 --- a/docs/changelog +++ b/docs/changelog @@ -4,6 +4,10 @@ Changelog * Changes are always commented with their author in (braces) * Exception: No braces means author == Nico Schottelius +3.0.5: + * Core: Introduce override concept (Daniel Heule) + + 3.0.4: 2014-01-29 * Core: Ignore install types in config mode * Documentation: Update reference (files path in object space) From 3a57367e7e895d3d4fe9fd761f0264df80aed0e3 Mon Sep 17 00:00:00 2001 From: Steven Armstrong Date: Sat, 1 Feb 2014 22:46:36 +0100 Subject: [PATCH 28/60] bugfix: make type actually work with --state absent Signed-off-by: Steven Armstrong --- cdist/conf/type/__process/gencode-remote | 17 +++++++---------- .../conf/type/__process/parameter/default/state | 1 + 2 files changed, 8 insertions(+), 10 deletions(-) create mode 100644 cdist/conf/type/__process/parameter/default/state diff --git a/cdist/conf/type/__process/gencode-remote b/cdist/conf/type/__process/gencode-remote index 41bc5381..639940d9 100755 --- a/cdist/conf/type/__process/gencode-remote +++ b/cdist/conf/type/__process/gencode-remote @@ -1,6 +1,7 @@ #!/bin/sh # # 2011-2012 Nico Schottelius (nico-cdist at schottelius.org) +# 2014 Steven Armstrong (steven-cdist at armstrong.cc) # # This file is part of cdist. # @@ -17,7 +18,6 @@ # You should have received a copy of the GNU General Public License # along with cdist. If not, see . # -# if [ -f "$__object/parameter/name" ]; then name="$(cat "$__object/parameter/name")" @@ -25,21 +25,18 @@ else name="$__object_id" fi -parameter_state="$__object/parameter/state" -if [ -f "$_parameter_state" ]; then - state_should=$(cat "$__object/parameter/state") -else - state_should="present" -fi +state_should="$(cat "$__object/parameter/state")" -runs="$(cat "$__object/explorer/runs")" -if [ "$runs" ]; then +if [ -s "$__object/explorer/runs" ]; then state_is="present" else state_is="absent" fi -[ "$state_is" = "$state_should" ] && exit 0 +if [ "$state_is" = "$state_should" ]; then + # nothing to do + exit 0 +fi case "$state_should" in present) diff --git a/cdist/conf/type/__process/parameter/default/state b/cdist/conf/type/__process/parameter/default/state new file mode 100644 index 00000000..e7f6134f --- /dev/null +++ b/cdist/conf/type/__process/parameter/default/state @@ -0,0 +1 @@ +present From 1b455e810b449aa2dc3771595f90cfcd298ac501 Mon Sep 17 00:00:00 2001 From: Daniel Heule Date: Sun, 2 Feb 2014 20:29:41 +0100 Subject: [PATCH 29/60] clarify in the example that override don't touch parameter witch are not present in the 2nd call --- docs/man/man7/cdist-manifest.text | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/docs/man/man7/cdist-manifest.text b/docs/man/man7/cdist-manifest.text index 7292a64f..aa146267 100644 --- a/docs/man/man7/cdist-manifest.text +++ b/docs/man/man7/cdist-manifest.text @@ -180,7 +180,7 @@ How to override objects: # for example in the inital manifest # reate user account foobar with some hash for password -__user foobar --password 'some_fancy_hash' +__user foobar --password 'some_fancy_hash' --home /home/foobarexample # ... many statements and includes in the manifest later ... # somewhere in a conditionaly sourced manifest @@ -191,6 +191,8 @@ __user foobar --password 'some_other_hash' # this tells cdist, that you know that this is an override and should be accepted CDIST_ALLOW_OVERRIDE=true __user foobar --password 'some_other_hash' +# its only an override, means the parameter --home is not touched +# and stay at the original value of /home/foobarexample -------------------------------------------------------------------------------- From 3c52710763a3f8537f732e716e53439d1b6af494 Mon Sep 17 00:00:00 2001 From: Daniel Heule Date: Mon, 3 Feb 2014 21:43:39 +0100 Subject: [PATCH 30/60] little changes for using default parameters correctly --- cdist/conf/type/__git/gencode-remote | 15 +++++---------- cdist/conf/type/__git/manifest | 3 +-- cdist/conf/type/__git/parameter/default/branch | 1 + cdist/conf/type/__git/parameter/default/group | 1 + cdist/conf/type/__git/parameter/default/mode | 1 + cdist/conf/type/__git/parameter/default/owner | 1 + cdist/conf/type/__git/parameter/default/state | 1 + cdist/conf/type/__jail/gencode-local | 12 ++---------- cdist/conf/type/__jail/gencode-remote | 13 +++---------- cdist/conf/type/__jail/manifest | 6 +----- .../type/__jail/parameter/default/devfs-ruleset | 1 + cdist/conf/type/__jail/parameter/default/jailbase | 1 + cdist/conf/type/__jail/parameter/default/jaildir | 1 + cdist/conf/type/__package_yum/gencode-remote | 6 +----- .../type/__package_yum/parameter/default/state | 1 + cdist/conf/type/__package_zypper/gencode-remote | 13 ++----------- .../type/__package_zypper/parameter/default/state | 1 + cdist/conf/type/__user_groups/gencode-remote | 2 +- .../type/__user_groups/parameter/default/state | 1 + 19 files changed, 27 insertions(+), 54 deletions(-) create mode 100644 cdist/conf/type/__git/parameter/default/branch create mode 100644 cdist/conf/type/__git/parameter/default/group create mode 100644 cdist/conf/type/__git/parameter/default/mode create mode 100644 cdist/conf/type/__git/parameter/default/owner create mode 100644 cdist/conf/type/__git/parameter/default/state create mode 100644 cdist/conf/type/__jail/parameter/default/devfs-ruleset create mode 100644 cdist/conf/type/__jail/parameter/default/jailbase create mode 100644 cdist/conf/type/__jail/parameter/default/jaildir create mode 100644 cdist/conf/type/__package_yum/parameter/default/state create mode 100644 cdist/conf/type/__package_zypper/parameter/default/state create mode 100644 cdist/conf/type/__user_groups/parameter/default/state diff --git a/cdist/conf/type/__git/gencode-remote b/cdist/conf/type/__git/gencode-remote index d719a492..c4fc1ef2 100644 --- a/cdist/conf/type/__git/gencode-remote +++ b/cdist/conf/type/__git/gencode-remote @@ -23,22 +23,17 @@ state_is="$(cat "$__object/explorer/state")" owner_is="$(cat "$__object/explorer/owner")" group_is="$(cat "$__object/explorer/group")" -state_should=present -[ -f "$__object/parameter/state" ] && state_should="$(cat "$__object/parameter/state")" +state_should="$(cat "$__object/parameter/state")" -branch=master -[ -f "$__object/parameter/branch" ] && branch="$(cat "$__object/parameter/branch")" +branch="$(cat "$__object/parameter/branch")" source="$(cat "$__object/parameter/source")" destination="/$__object_id" -owner="" -[ -f "$__object/parameter/owner" ] && owner="$(cat "$__object/parameter/owner")" -group="" -[ -f "$__object/parameter/group" ] && group="$(cat "$__object/parameter/group")" -mode="" -[ -f "$__object/parameter/mode" ] && mode="$(cat "$__object/parameter/mode")" +owner="$(cat "$__object/parameter/owner")" +group="$(cat "$__object/parameter/group")" +mode="$(cat "$__object/parameter/mode")" [ "$state_should" = "$state_is" -a \ "$owner" = "$owner_is" -a \ diff --git a/cdist/conf/type/__git/manifest b/cdist/conf/type/__git/manifest index 8d6a29e4..7f6fee84 100644 --- a/cdist/conf/type/__git/manifest +++ b/cdist/conf/type/__git/manifest @@ -23,8 +23,7 @@ __package git --state present -state_should=present -[ -f "$__object/parameter/state" ] && state_should="$(cat "$__object/parameter/state")" +state_should="$(cat "$__object/parameter/state")" # Let __directory handle removal of git repos diff --git a/cdist/conf/type/__git/parameter/default/branch b/cdist/conf/type/__git/parameter/default/branch new file mode 100644 index 00000000..1f7391f9 --- /dev/null +++ b/cdist/conf/type/__git/parameter/default/branch @@ -0,0 +1 @@ +master diff --git a/cdist/conf/type/__git/parameter/default/group b/cdist/conf/type/__git/parameter/default/group new file mode 100644 index 00000000..8b137891 --- /dev/null +++ b/cdist/conf/type/__git/parameter/default/group @@ -0,0 +1 @@ + diff --git a/cdist/conf/type/__git/parameter/default/mode b/cdist/conf/type/__git/parameter/default/mode new file mode 100644 index 00000000..8b137891 --- /dev/null +++ b/cdist/conf/type/__git/parameter/default/mode @@ -0,0 +1 @@ + diff --git a/cdist/conf/type/__git/parameter/default/owner b/cdist/conf/type/__git/parameter/default/owner new file mode 100644 index 00000000..8b137891 --- /dev/null +++ b/cdist/conf/type/__git/parameter/default/owner @@ -0,0 +1 @@ + diff --git a/cdist/conf/type/__git/parameter/default/state b/cdist/conf/type/__git/parameter/default/state new file mode 100644 index 00000000..e7f6134f --- /dev/null +++ b/cdist/conf/type/__git/parameter/default/state @@ -0,0 +1 @@ +present diff --git a/cdist/conf/type/__jail/gencode-local b/cdist/conf/type/__jail/gencode-local index d6384156..08c7b7bf 100755 --- a/cdist/conf/type/__jail/gencode-local +++ b/cdist/conf/type/__jail/gencode-local @@ -22,17 +22,9 @@ # virtual machines. # -if [ -f "$__object/parameter/jaildir" ]; then - jaildir="$(cat "$__object/parameter/jaildir")" -else - jaildir="/usr/jail" -fi +jaildir="$(cat "$__object/parameter/jaildir")" -if [ -f "$__object/parameter/jailbase" ]; then - jailbase="$(cat "$__object/parameter/jailbase")" -else - jailbase="" -fi +jailbase="$(cat "$__object/parameter/jailbase")" state="$(cat "$__object/parameter/state")" diff --git a/cdist/conf/type/__jail/gencode-remote b/cdist/conf/type/__jail/gencode-remote index afbb81a5..141c8150 100755 --- a/cdist/conf/type/__jail/gencode-remote +++ b/cdist/conf/type/__jail/gencode-remote @@ -66,11 +66,7 @@ else devfsenable="true" fi -if [ -f "$__object/parameter/devfs-ruleset" ]; then - devfsruleset="$(cat "$__object/parameter/devfs-ruleset")" -else - devfsruleset="jailrules" -fi +devfsruleset="$(cat "$__object/parameter/devfs-ruleset")" # devfs_ruleset being defined without devfs_enable being true # is pointless. Treat this as an error. @@ -84,14 +80,11 @@ if [ -f "$__object/parameter/onboot" ]; then onboot="true" fi -if [ -f "$__object/parameter/jaildir" ]; then - jaildir="$(cat "$__object/parameter/jaildir")" -else - jaildir="/usr/jail" -fi +jaildir="$(cat "$__object/parameter/jaildir")" present="$(cat "$__object/explorer/present")" status="$(cat "$__object/explorer/status")" + # Handle ip="iface|addr, iface|addr" format if [ $(expr "${ip}" : ".*|.*") -gt "0" ]; then # If we have multiple IPs defined, $interface doesn't make sense because ip="iface|addr, iface|addr" implies it diff --git a/cdist/conf/type/__jail/manifest b/cdist/conf/type/__jail/manifest index cf5b7938..6a953241 100755 --- a/cdist/conf/type/__jail/manifest +++ b/cdist/conf/type/__jail/manifest @@ -33,11 +33,7 @@ if [ ! "$os" = "freebsd" ]; then exit 1 fi -if [ -f "$__object/parameter/jaildir" ]; then - jaildir="$(cat "$__object/parameter/jaildir")" -else - jaildir="/usr/jail" -fi +jaildir="$(cat "$__object/parameter/jaildir")" __directory ${jaildir} --parents diff --git a/cdist/conf/type/__jail/parameter/default/devfs-ruleset b/cdist/conf/type/__jail/parameter/default/devfs-ruleset new file mode 100644 index 00000000..f602aa0a --- /dev/null +++ b/cdist/conf/type/__jail/parameter/default/devfs-ruleset @@ -0,0 +1 @@ +jailrules diff --git a/cdist/conf/type/__jail/parameter/default/jailbase b/cdist/conf/type/__jail/parameter/default/jailbase new file mode 100644 index 00000000..8b137891 --- /dev/null +++ b/cdist/conf/type/__jail/parameter/default/jailbase @@ -0,0 +1 @@ + diff --git a/cdist/conf/type/__jail/parameter/default/jaildir b/cdist/conf/type/__jail/parameter/default/jaildir new file mode 100644 index 00000000..ec7d86c6 --- /dev/null +++ b/cdist/conf/type/__jail/parameter/default/jaildir @@ -0,0 +1 @@ +/usr/jail diff --git a/cdist/conf/type/__package_yum/gencode-remote b/cdist/conf/type/__package_yum/gencode-remote index 9c98c257..5f0e8ac8 100755 --- a/cdist/conf/type/__package_yum/gencode-remote +++ b/cdist/conf/type/__package_yum/gencode-remote @@ -27,11 +27,7 @@ else name="$__object_id" fi -if [ -f "$__object/parameter/state" ]; then - state_should="$(cat "$__object/parameter/state")" -else - state_should="present" -fi +state_should="$(cat "$__object/parameter/state")" if grep -q -E "(centos|redhat|amazon)" "$__global/explorer/os"; then opts="-y --quiet" diff --git a/cdist/conf/type/__package_yum/parameter/default/state b/cdist/conf/type/__package_yum/parameter/default/state new file mode 100644 index 00000000..e7f6134f --- /dev/null +++ b/cdist/conf/type/__package_yum/parameter/default/state @@ -0,0 +1 @@ +present diff --git a/cdist/conf/type/__package_zypper/gencode-remote b/cdist/conf/type/__package_zypper/gencode-remote index 51713590..d9f16f8d 100644 --- a/cdist/conf/type/__package_zypper/gencode-remote +++ b/cdist/conf/type/__package_zypper/gencode-remote @@ -34,17 +34,8 @@ else name="$__object_id" fi -if [ -f "$__object/parameter/state" ]; then - state_should="$(cat "$__object/parameter/state")" -else - state_should="present" -fi - -if [ -f "$__object/parameter/ptype" ]; then - ptype="$(cat "$__object/parameter/ptype")" -else - ptype="package" -fi +state_should="$(cat "$__object/parameter/state")" +ptype="$(cat "$__object/parameter/ptype")" if [ -f "$__object/parameter/version" ]; then version_should="$(cat "$__object/parameter/version")" diff --git a/cdist/conf/type/__package_zypper/parameter/default/state b/cdist/conf/type/__package_zypper/parameter/default/state new file mode 100644 index 00000000..e7f6134f --- /dev/null +++ b/cdist/conf/type/__package_zypper/parameter/default/state @@ -0,0 +1 @@ +present diff --git a/cdist/conf/type/__user_groups/gencode-remote b/cdist/conf/type/__user_groups/gencode-remote index c5e4a35e..9f11dd16 100755 --- a/cdist/conf/type/__user_groups/gencode-remote +++ b/cdist/conf/type/__user_groups/gencode-remote @@ -19,7 +19,7 @@ # user="$(cat "$__object/parameter/user" 2>/dev/null || echo "$__object_id")" -state_should="$(cat "$__object/parameter/state" 2>/dev/null || echo "present")" +state_should="$(cat "$__object/parameter/state")" mkdir "$__object/files" # file has to be sorted for comparison with `comm` diff --git a/cdist/conf/type/__user_groups/parameter/default/state b/cdist/conf/type/__user_groups/parameter/default/state new file mode 100644 index 00000000..e7f6134f --- /dev/null +++ b/cdist/conf/type/__user_groups/parameter/default/state @@ -0,0 +1 @@ +present From 03ce5a28286eaf1c7bb876b0a11b51280ad6357c Mon Sep 17 00:00:00 2001 From: Steven Armstrong Date: Tue, 4 Feb 2014 12:24:10 +0100 Subject: [PATCH 31/60] import __apt_* types from private repo Signed-off-by: Steven Armstrong --- cdist/conf/type/__apt_key/explorer/state | 32 +++++++++ cdist/conf/type/__apt_key/gencode-remote | 42 +++++++++++ cdist/conf/type/__apt_key/man.text | 60 ++++++++++++++++ .../__apt_key/parameter/default/keyserver | 1 + .../type/__apt_key/parameter/default/state | 1 + cdist/conf/type/__apt_key/parameter/optional | 3 + cdist/conf/type/__apt_key_uri/explorer/state | 32 +++++++++ cdist/conf/type/__apt_key_uri/gencode-remote | 45 ++++++++++++ cdist/conf/type/__apt_key_uri/man.text | 51 ++++++++++++++ cdist/conf/type/__apt_key_uri/manifest | 21 ++++++ .../__apt_key_uri/parameter/default/state | 1 + .../type/__apt_key_uri/parameter/optional | 2 + .../type/__apt_key_uri/parameter/required | 1 + cdist/conf/type/__apt_norecommends/man.text | 42 +++++++++++ cdist/conf/type/__apt_norecommends/manifest | 40 +++++++++++ cdist/conf/type/__apt_norecommends/singleton | 0 .../__apt_source/files/source.list.template | 15 ++++ cdist/conf/type/__apt_source/man.text | 69 +++++++++++++++++++ cdist/conf/type/__apt_source/manifest | 58 ++++++++++++++++ .../conf/type/__apt_source/parameter/boolean | 1 + .../type/__apt_source/parameter/default/state | 1 + .../conf/type/__apt_source/parameter/optional | 4 ++ .../conf/type/__apt_source/parameter/required | 1 + 23 files changed, 523 insertions(+) create mode 100755 cdist/conf/type/__apt_key/explorer/state create mode 100755 cdist/conf/type/__apt_key/gencode-remote create mode 100644 cdist/conf/type/__apt_key/man.text create mode 100644 cdist/conf/type/__apt_key/parameter/default/keyserver create mode 100644 cdist/conf/type/__apt_key/parameter/default/state create mode 100644 cdist/conf/type/__apt_key/parameter/optional create mode 100755 cdist/conf/type/__apt_key_uri/explorer/state create mode 100755 cdist/conf/type/__apt_key_uri/gencode-remote create mode 100644 cdist/conf/type/__apt_key_uri/man.text create mode 100755 cdist/conf/type/__apt_key_uri/manifest create mode 100644 cdist/conf/type/__apt_key_uri/parameter/default/state create mode 100644 cdist/conf/type/__apt_key_uri/parameter/optional create mode 100644 cdist/conf/type/__apt_key_uri/parameter/required create mode 100644 cdist/conf/type/__apt_norecommends/man.text create mode 100755 cdist/conf/type/__apt_norecommends/manifest create mode 100644 cdist/conf/type/__apt_norecommends/singleton create mode 100755 cdist/conf/type/__apt_source/files/source.list.template create mode 100644 cdist/conf/type/__apt_source/man.text create mode 100755 cdist/conf/type/__apt_source/manifest create mode 100644 cdist/conf/type/__apt_source/parameter/boolean create mode 100644 cdist/conf/type/__apt_source/parameter/default/state create mode 100644 cdist/conf/type/__apt_source/parameter/optional create mode 100644 cdist/conf/type/__apt_source/parameter/required diff --git a/cdist/conf/type/__apt_key/explorer/state b/cdist/conf/type/__apt_key/explorer/state new file mode 100755 index 00000000..f7940741 --- /dev/null +++ b/cdist/conf/type/__apt_key/explorer/state @@ -0,0 +1,32 @@ +#!/bin/sh +# +# 2011-2014 Steven Armstrong (steven-cdist at armstrong.cc) +# +# This file is part of cdist. +# +# cdist is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# cdist is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with cdist. If not, see . +# +# +# Get the current state of the apt key. +# + +if [ -f "$__object/parameter/keyid" ]; then + keyid="$(cat "$__object/parameter/keyid")" +else + keyid="$__object_id" +fi + +apt-key export "$keyid" | head -n 1 | grep -Fqe "BEGIN PGP PUBLIC KEY BLOCK" \ + && echo present \ + || echo absent diff --git a/cdist/conf/type/__apt_key/gencode-remote b/cdist/conf/type/__apt_key/gencode-remote new file mode 100755 index 00000000..c6ead91c --- /dev/null +++ b/cdist/conf/type/__apt_key/gencode-remote @@ -0,0 +1,42 @@ +#!/bin/sh +# +# 2011-2014 Steven Armstrong (steven-cdist at armstrong.cc) +# +# This file is part of cdist. +# +# cdist is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# cdist is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with cdist. If not, see . +# + +if [ -f "$__object/parameter/keyid" ]; then + keyid="$(cat "$__object/parameter/keyid")" +else + keyid="$__object_id" +fi +state_should="$(cat "$__object/parameter/state")" +state_is="$(cat "$__object/explorer/state")" + +if [ "$state_should" = "$state_is" ]; then + # nothing to do + exit 0 +fi + +case "$state_should" in + present) + keyserver="$(cat "$__object/parameter/keyserver")" + echo "apt-key adv --keyserver \"$keyserver\" --recv-keys \"$keyid\"" + ;; + absent) + echo "apt-key del \"$keyid\"" + ;; +esac diff --git a/cdist/conf/type/__apt_key/man.text b/cdist/conf/type/__apt_key/man.text new file mode 100644 index 00000000..d571a633 --- /dev/null +++ b/cdist/conf/type/__apt_key/man.text @@ -0,0 +1,60 @@ +cdist-type__apt_key(7) +====================== +Steven Armstrong + + +NAME +---- +cdist-type__apt_key - manage the list of keys used by apt + + +DESCRIPTION +----------- +Manages the list of keys used by apt to authenticate packages. + + +REQUIRED PARAMETERS +------------------- +None. + + +OPTIONAL PARAMETERS +------------------- +state:: + 'present' or 'absent'. Defaults to 'present' + +keyid:: + the id of the key to add. Defaults to __object_id + +keyserver:: + the keyserver from which to fetch the key. If omitted a sane default is used. + + +EXAMPLES +-------- + +-------------------------------------------------------------------------------- +# Add Ubuntu Archive Automatic Signing Key +__apt_key 437D05B5 +# Same thing +__apt_key 437D05B5 --state present +# Get rid of it +__apt_key 437D05B5 --state absent + +# same thing with human readable name and explicit keyid +__apt_key UbuntuArchiveKey --keyid 437D05B5 + +# same thing with other keyserver +__apt_key UbuntuArchiveKey --keyid 437D05B5 --keyserver keyserver.ubuntu.com +-------------------------------------------------------------------------------- + + +SEE ALSO +-------- +- cdist-type(7) + + +COPYING +------- +Copyright \(C) 2011-2014 Steven Armstrong. Free use of this software is +granted under the terms of the GNU General Public License version 3 (GPLv3). diff --git a/cdist/conf/type/__apt_key/parameter/default/keyserver b/cdist/conf/type/__apt_key/parameter/default/keyserver new file mode 100644 index 00000000..f851282c --- /dev/null +++ b/cdist/conf/type/__apt_key/parameter/default/keyserver @@ -0,0 +1 @@ +subkeys.pgp.net diff --git a/cdist/conf/type/__apt_key/parameter/default/state b/cdist/conf/type/__apt_key/parameter/default/state new file mode 100644 index 00000000..e7f6134f --- /dev/null +++ b/cdist/conf/type/__apt_key/parameter/default/state @@ -0,0 +1 @@ +present diff --git a/cdist/conf/type/__apt_key/parameter/optional b/cdist/conf/type/__apt_key/parameter/optional new file mode 100644 index 00000000..18cf2586 --- /dev/null +++ b/cdist/conf/type/__apt_key/parameter/optional @@ -0,0 +1,3 @@ +state +keyid +keyserver diff --git a/cdist/conf/type/__apt_key_uri/explorer/state b/cdist/conf/type/__apt_key_uri/explorer/state new file mode 100755 index 00000000..15d6e653 --- /dev/null +++ b/cdist/conf/type/__apt_key_uri/explorer/state @@ -0,0 +1,32 @@ +#!/bin/sh +# +# 2011-2014 Steven Armstrong (steven-cdist at armstrong.cc) +# +# This file is part of cdist. +# +# cdist is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# cdist is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with cdist. If not, see . +# +# +# Get the current state of the apt key. +# + +if [ -f "$__object/parameter/name" ]; then + name="$(cat "$__object/parameter/name")" +else + name="$__object_id" +fi + +apt-key list | grep -Fqe "$name" \ + && echo present \ + || echo absent diff --git a/cdist/conf/type/__apt_key_uri/gencode-remote b/cdist/conf/type/__apt_key_uri/gencode-remote new file mode 100755 index 00000000..07af92ac --- /dev/null +++ b/cdist/conf/type/__apt_key_uri/gencode-remote @@ -0,0 +1,45 @@ +#!/bin/sh +# +# 2011-2014 Steven Armstrong (steven-cdist at armstrong.cc) +# +# This file is part of cdist. +# +# cdist is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# cdist is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with cdist. If not, see . +# + +if [ -f "$__object/parameter/name" ]; then + name="$(cat "$__object/parameter/name")" +else + name="$__object_id" +fi +state_should="$(cat "$__object/parameter/state")" +state_is="$(cat "$__object/explorer/state")" + +if [ "$state_should" = "$state_is" ]; then + # nothing to do + exit 0 +fi + +case "$state_should" in + present) + uri="$(cat "$__object/parameter/uri")" + echo "wget -q \"$uri\" -O - | apt-key add -" + ;; + absent) + cat << DONE +keyid=\$(apt-key list | grep -B1 "$name" | awk '/pub/ { print \$2 }' | cut -d'/' -f 2) +apt-key del \$keyid +DONE + ;; +esac diff --git a/cdist/conf/type/__apt_key_uri/man.text b/cdist/conf/type/__apt_key_uri/man.text new file mode 100644 index 00000000..fe9c3a25 --- /dev/null +++ b/cdist/conf/type/__apt_key_uri/man.text @@ -0,0 +1,51 @@ +cdist-type__apt_key_uri(7) +========================== +Steven Armstrong + + +NAME +---- +cdist-type__apt_key_uri - add apt key from uri + + +DESCRIPTION +----------- +Download a key from an uri and add it to the apt keyring. + + +REQUIRED PARAMETERS +------------------- +uri:: + the uri from which to download the key + + +OPTIONAL PARAMETERS +------------------- +state:: + 'present' or 'absent', defaults to 'present' + +name:: + a name for this key, used when testing if it is already installed. + Defaults to __object_id + + +EXAMPLES +-------- + +-------------------------------------------------------------------------------- +__apt_key_uri rabbitmq \ + --name 'RabbitMQ Release Signing Key ' \ + --uri http://www.rabbitmq.com/rabbitmq-signing-key-public.asc \ + --state present +-------------------------------------------------------------------------------- + + +SEE ALSO +-------- +- cdist-type(7) + + +COPYING +------- +Copyright \(C) 2011-2014 Steven Armstrong. Free use of this software is +granted under the terms of the GNU General Public License version 3 (GPLv3). diff --git a/cdist/conf/type/__apt_key_uri/manifest b/cdist/conf/type/__apt_key_uri/manifest new file mode 100755 index 00000000..5dae37a7 --- /dev/null +++ b/cdist/conf/type/__apt_key_uri/manifest @@ -0,0 +1,21 @@ +#!/bin/sh +# +# 2013-2014 Steven Armstrong (steven-cdist at armstrong.cc) +# +# This file is part of cdist. +# +# cdist is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# cdist is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with cdist. If not, see . +# + +__package wget diff --git a/cdist/conf/type/__apt_key_uri/parameter/default/state b/cdist/conf/type/__apt_key_uri/parameter/default/state new file mode 100644 index 00000000..e7f6134f --- /dev/null +++ b/cdist/conf/type/__apt_key_uri/parameter/default/state @@ -0,0 +1 @@ +present diff --git a/cdist/conf/type/__apt_key_uri/parameter/optional b/cdist/conf/type/__apt_key_uri/parameter/optional new file mode 100644 index 00000000..72c84b88 --- /dev/null +++ b/cdist/conf/type/__apt_key_uri/parameter/optional @@ -0,0 +1,2 @@ +state +name diff --git a/cdist/conf/type/__apt_key_uri/parameter/required b/cdist/conf/type/__apt_key_uri/parameter/required new file mode 100644 index 00000000..c7954952 --- /dev/null +++ b/cdist/conf/type/__apt_key_uri/parameter/required @@ -0,0 +1 @@ +uri diff --git a/cdist/conf/type/__apt_norecommends/man.text b/cdist/conf/type/__apt_norecommends/man.text new file mode 100644 index 00000000..3b65e72f --- /dev/null +++ b/cdist/conf/type/__apt_norecommends/man.text @@ -0,0 +1,42 @@ +cdist-type__apt_norecommends(7) +=============================== +Steven Armstrong + + +NAME +---- +cdist-type__apt_norecommends - configure apt to not install recommended packages + + +DESCRIPTION +----------- +Configure apt to not install any recommended or suggested packages. + + +REQUIRED PARAMETERS +------------------- +None. + + +OPTIONAL PARAMETERS +------------------- +None. + + +EXAMPLES +-------- + +-------------------------------------------------------------------------------- +__apt_norecommends +-------------------------------------------------------------------------------- + + +SEE ALSO +-------- +- cdist-type(7) + + +COPYING +------- +Copyright \(C) 2014 Steven Armstrong. Free use of this software is +granted under the terms of the GNU General Public License version 3 (GPLv3). diff --git a/cdist/conf/type/__apt_norecommends/manifest b/cdist/conf/type/__apt_norecommends/manifest new file mode 100755 index 00000000..8058d52e --- /dev/null +++ b/cdist/conf/type/__apt_norecommends/manifest @@ -0,0 +1,40 @@ +#!/bin/sh +# +# 2014 Steven Armstrong (steven-cdist at armstrong.cc) +# +# This file is part of cdist. +# +# cdist is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# cdist is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with cdist. If not, see . +# + + +os=$(cat "$__global/explorer/os") + +case "$os" in + ubuntu|debian) + # No stinking recommends thank you very much. + # If I want something installed I will do so myself. + __file /etc/apt/apt.conf.d/99-no-recommends \ + --owner root --group root --mode 644 \ + --source - << DONE +APT::Install-Recommends "0"; +APT::Install-Suggests "0"; +DONE + ;; + *) + echo "This type (${__type##*/}) makes no sense on your operating system ($os)." >&2 + echo "If you think otherwise please submit a patch." >&2 + exit 1 + ;; +esac diff --git a/cdist/conf/type/__apt_norecommends/singleton b/cdist/conf/type/__apt_norecommends/singleton new file mode 100644 index 00000000..e69de29b diff --git a/cdist/conf/type/__apt_source/files/source.list.template b/cdist/conf/type/__apt_source/files/source.list.template new file mode 100755 index 00000000..d4420e96 --- /dev/null +++ b/cdist/conf/type/__apt_source/files/source.list.template @@ -0,0 +1,15 @@ +#!/bin/sh +set -u + +entry="$uri $distribution $component" +cat << DONE +# Created by cdist ${__type##*/} +# Do not change. Changes will be overwritten. +# + +# $name +deb ${forcedarch} $entry +DONE +if [ -f "$__object/parameter/include-src" ]; then + echo "deb-src $entry" +fi diff --git a/cdist/conf/type/__apt_source/man.text b/cdist/conf/type/__apt_source/man.text new file mode 100644 index 00000000..fe40a91e --- /dev/null +++ b/cdist/conf/type/__apt_source/man.text @@ -0,0 +1,69 @@ +cdist-type__apt_source(7) +========================= +Steven Armstrong + + +NAME +---- +cdist-type__apt_source - manage apt sources + + +DESCRIPTION +----------- +This cdist type allows you to manage apt sources. + + +REQUIRED PARAMETERS +------------------- +uri:: + the uri to the apt repository + + +OPTIONAL PARAMETERS +------------------- +arch:: + set this if you need to force and specific arch (ubuntu specific) + +state:: + 'present' or 'absent', defaults to 'present' + +distribution:: + the distribution codename to use. Defaults to DISTRIB_CODENAME from + the targets /etc/lsb-release + +component:: + space delimited list of components to enable. Defaults to 'main'. + + +BOOLEAN PARAMETERS +------------------ +include-src:: + include deb-src entries + + +EXAMPLES +-------- + +-------------------------------------------------------------------------------- +__apt_source rabbitmq \ + --uri http://www.rabbitmq.com/debian/ \ + --distribution testing \ + --component main \ + --include-src \ + --state present + +__apt_source canonical_partner \ + --uri http://archive.canonical.com/ \ + --component partner --state present +-------------------------------------------------------------------------------- + + +SEE ALSO +-------- +- cdist-type(7) + + +COPYING +------- +Copyright \(C) 2011-2014 Steven Armstrong. Free use of this software is +granted under the terms of the GNU General Public License version 3 (GPLv3). diff --git a/cdist/conf/type/__apt_source/manifest b/cdist/conf/type/__apt_source/manifest new file mode 100755 index 00000000..b4d72a71 --- /dev/null +++ b/cdist/conf/type/__apt_source/manifest @@ -0,0 +1,58 @@ +#!/bin/sh +# +# 2011-2013 Steven Armstrong (steven-cdist at armstrong.cc) +# +# This file is part of cdist. +# +# cdist is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# cdist is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with cdist. If not, see . +# + +name="$__object_id" +state="$(cat "$__object/parameter/state")" +uri="$(cat "$__object/parameter/uri")" + +if [ -f "$__object/parameter/distribution" ]; then + distribution="$(cat "$__object/parameter/distribution")" +else + distribution="$(cat "$__global/explorer/lsb_codename")" +fi +if [ -f "$__object/parameter/component" ]; then + component="$(cat "$__object/parameter/component")" +else + # FIXME: nead to omit this for http://stat.ethz.ch/CRAN//bin/linux/ubuntu, investigate side-effects + #component="main" + component="" +fi +if [ -f "$__object/parameter/arch" ]; then + forcedarch="[arch=$(cat "$__object/parameter/arch")]" +else + forcedarch="" +fi + +# export variables for use in template +export name +export uri +export distribution +export component +export forcedarch + +# generate file from template +mkdir "$__object/files" +"$__type/files/source.list.template" > "$__object/files/source.list" +__file "/etc/apt/sources.list.d/${name}.list" \ + --source "$__object/files/source.list" \ + --owner root --group root --mode 0644 \ + --state "$state" + +require="$__object_name" __apt_update_index diff --git a/cdist/conf/type/__apt_source/parameter/boolean b/cdist/conf/type/__apt_source/parameter/boolean new file mode 100644 index 00000000..8fa49177 --- /dev/null +++ b/cdist/conf/type/__apt_source/parameter/boolean @@ -0,0 +1 @@ +include-src diff --git a/cdist/conf/type/__apt_source/parameter/default/state b/cdist/conf/type/__apt_source/parameter/default/state new file mode 100644 index 00000000..e7f6134f --- /dev/null +++ b/cdist/conf/type/__apt_source/parameter/default/state @@ -0,0 +1 @@ +present diff --git a/cdist/conf/type/__apt_source/parameter/optional b/cdist/conf/type/__apt_source/parameter/optional new file mode 100644 index 00000000..87537335 --- /dev/null +++ b/cdist/conf/type/__apt_source/parameter/optional @@ -0,0 +1,4 @@ +state +distribution +component +arch \ No newline at end of file diff --git a/cdist/conf/type/__apt_source/parameter/required b/cdist/conf/type/__apt_source/parameter/required new file mode 100644 index 00000000..c7954952 --- /dev/null +++ b/cdist/conf/type/__apt_source/parameter/required @@ -0,0 +1 @@ +uri From 2363cdda47289fbefbcb9647af549829ddbc28d0 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Wed, 5 Feb 2014 20:50:23 +0100 Subject: [PATCH 32/60] ++changes Signed-off-by: Nico Schottelius --- docs/changelog | 1 + 1 file changed, 1 insertion(+) diff --git a/docs/changelog b/docs/changelog index bd52bd78..f638f2a5 100644 --- a/docs/changelog +++ b/docs/changelog @@ -6,6 +6,7 @@ Changelog 3.0.5: * Core: Introduce override concept (Daniel Heule) + * Type __process: Make --state absent work (Steven Armstrong) 3.0.4: 2014-01-29 From d1cc8a69999cafbce9dc91cbb81399c0f324abf5 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Wed, 5 Feb 2014 20:50:59 +0100 Subject: [PATCH 33/60] document environment variables that influence cdist Signed-off-by: Nico Schottelius --- docs/man/cdist-reference.text.sh | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/docs/man/cdist-reference.text.sh b/docs/man/cdist-reference.text.sh index 5c9f603c..4b1906b4 100755 --- a/docs/man/cdist-reference.text.sh +++ b/docs/man/cdist-reference.text.sh @@ -188,8 +188,10 @@ stdin:: when the type was called. -ENVIRONMENT VARIABLES ---------------------- +ENVIRONMENT VARIABLES (FOR READING) +----------------------------------- +The following environment variables are exported by cdist: + __explorer:: Directory that contains all global explorers. Available for: initial manifest, explorer, type explorer, shell @@ -227,6 +229,12 @@ __type_explorer:: Directory that contains the type explorers. Available for: type explorer +ENVIRONMENT VARIABLES (FOR WRITING) +----------------------------------- +The following environment variables influence the behaviour of cdist: + +CDIST_ALLOW_OVERRIDE:: + Allow overwriting type parameters (see cdist-manifest(7)) SEE ALSO -------- From 65b3f6c75ab7c28c725c741c403682cfb15e86f1 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Wed, 5 Feb 2014 20:52:35 +0100 Subject: [PATCH 34/60] also document require variable Signed-off-by: Nico Schottelius --- docs/man/cdist-reference.text.sh | 3 +++ 1 file changed, 3 insertions(+) diff --git a/docs/man/cdist-reference.text.sh b/docs/man/cdist-reference.text.sh index 4b1906b4..5de59eab 100755 --- a/docs/man/cdist-reference.text.sh +++ b/docs/man/cdist-reference.text.sh @@ -233,6 +233,9 @@ ENVIRONMENT VARIABLES (FOR WRITING) ----------------------------------- The following environment variables influence the behaviour of cdist: +require:: + Setup dependencies between objects (see cdist-manifest(7)) + CDIST_ALLOW_OVERRIDE:: Allow overwriting type parameters (see cdist-manifest(7)) From f928072f746ed12125b20acd87251852e4366d86 Mon Sep 17 00:00:00 2001 From: Steven Armstrong Date: Wed, 5 Feb 2014 21:07:33 +0100 Subject: [PATCH 35/60] let the user decide what is sane and what not Signed-off-by: Steven Armstrong --- cdist/conf/type/__apt_key/man.text | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/cdist/conf/type/__apt_key/man.text b/cdist/conf/type/__apt_key/man.text index d571a633..1a33e732 100644 --- a/cdist/conf/type/__apt_key/man.text +++ b/cdist/conf/type/__apt_key/man.text @@ -27,7 +27,8 @@ keyid:: the id of the key to add. Defaults to __object_id keyserver:: - the keyserver from which to fetch the key. If omitted a sane default is used. + the keyserver from which to fetch the key. If omitted the default set in + ./parameter/default/keyserver is used. EXAMPLES From 34f2f7f0389b32c1c46763eda556bd7c98abcbff Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Wed, 5 Feb 2014 21:09:24 +0100 Subject: [PATCH 36/60] setting up CDIST_ALLOW_OVERRIDE to any value is ok - do not depend on true/yes/ja Signed-off-by: Nico Schottelius --- cdist/emulator.py | 4 ++-- docs/changelog | 1 + docs/man/man7/cdist-manifest.text | 6 +++--- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/cdist/emulator.py b/cdist/emulator.py index ed846e6d..4f91cd8e 100644 --- a/cdist/emulator.py +++ b/cdist/emulator.py @@ -145,14 +145,14 @@ class Emulator(object): if value is not None: self.parameters[key] = value - if self.cdist_object.exists and os.environ.get('CDIST_ALLOW_OVERRIDE',"false") != 'true': + if self.cdist_object.exists and not 'CDIST_ALLOW_OVERRIDE' in os.environ: if self.cdist_object.parameters != self.parameters: raise cdist.Error("Object %s already exists with conflicting parameters:\n%s: %s\n%s: %s" % (self.cdist_object.name, " ".join(self.cdist_object.source), self.cdist_object.parameters, self.object_source, self.parameters) ) else: if self.cdist_object.exists: - self.log.debug('Object %s override forced with CDIST_ALLOW_OVERRIDE=true',self.cdist_object.name) + self.log.debug('Object %s override forced with CDIST_ALLOW_OVERRIDE',self.cdist_object.name) self.cdist_object.create(True) else: self.cdist_object.create() diff --git a/docs/changelog b/docs/changelog index f638f2a5..14e34b3d 100644 --- a/docs/changelog +++ b/docs/changelog @@ -7,6 +7,7 @@ Changelog 3.0.5: * Core: Introduce override concept (Daniel Heule) * Type __process: Make --state absent work (Steven Armstrong) + * Documentation: Add documentation for influencing variables 3.0.4: 2014-01-29 diff --git a/docs/man/man7/cdist-manifest.text b/docs/man/man7/cdist-manifest.text index aa146267..7f1b95dc 100644 --- a/docs/man/man7/cdist-manifest.text +++ b/docs/man/man7/cdist-manifest.text @@ -133,8 +133,8 @@ OVERRIDES --------- In some special cases, you would like to create an already defined object with different parameters. In normal situations this leads to an error in cdist. -If you whish, you can mark this second definition of an object with -CDIST_ALLOW_OVERRIDE=true to tell cdist, that this object override is +If you whish, you can setup the environment variable CDIST_ALLOW_OVERRIDE +(any value or even empty is ok) to tell cdist, that this object override is wanted and should be accepted. ATTENTION: Only use this feature if you are 100% sure in which order cdist encounter the affected objects, otherwhise this results @@ -190,7 +190,7 @@ __user foobar --password 'some_fancy_hash' --home /home/foobarexample __user foobar --password 'some_other_hash' # this tells cdist, that you know that this is an override and should be accepted -CDIST_ALLOW_OVERRIDE=true __user foobar --password 'some_other_hash' +CDIST_ALLOW_OVERRIDE=yes __user foobar --password 'some_other_hash' # its only an override, means the parameter --home is not touched # and stay at the original value of /home/foobarexample -------------------------------------------------------------------------------- From 14a112fcce283d38a43cd9a94575f61e68aa195a Mon Sep 17 00:00:00 2001 From: Steven Armstrong Date: Wed, 5 Feb 2014 21:12:22 +0100 Subject: [PATCH 37/60] /wget/curl/ Signed-off-by: Steven Armstrong --- cdist/conf/type/__apt_key_uri/gencode-remote | 2 +- cdist/conf/type/__apt_key_uri/manifest | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/cdist/conf/type/__apt_key_uri/gencode-remote b/cdist/conf/type/__apt_key_uri/gencode-remote index 07af92ac..078b8695 100755 --- a/cdist/conf/type/__apt_key_uri/gencode-remote +++ b/cdist/conf/type/__apt_key_uri/gencode-remote @@ -34,7 +34,7 @@ fi case "$state_should" in present) uri="$(cat "$__object/parameter/uri")" - echo "wget -q \"$uri\" -O - | apt-key add -" + printf 'curl -s -L "%s" | apt-key add -\n' "$uri" ;; absent) cat << DONE diff --git a/cdist/conf/type/__apt_key_uri/manifest b/cdist/conf/type/__apt_key_uri/manifest index 5dae37a7..8dddde56 100755 --- a/cdist/conf/type/__apt_key_uri/manifest +++ b/cdist/conf/type/__apt_key_uri/manifest @@ -18,4 +18,4 @@ # along with cdist. If not, see . # -__package wget +__package curl From 7686a5ac5e14f4368b81a7d00b7dc5b46f21ae10 Mon Sep 17 00:00:00 2001 From: Steven Armstrong Date: Wed, 5 Feb 2014 21:17:15 +0100 Subject: [PATCH 38/60] be nice to them users Signed-off-by: Steven Armstrong --- cdist/conf/type/__apt_norecommends/manifest | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/cdist/conf/type/__apt_norecommends/manifest b/cdist/conf/type/__apt_norecommends/manifest index 8058d52e..881c2427 100755 --- a/cdist/conf/type/__apt_norecommends/manifest +++ b/cdist/conf/type/__apt_norecommends/manifest @@ -33,8 +33,10 @@ APT::Install-Suggests "0"; DONE ;; *) - echo "This type (${__type##*/}) makes no sense on your operating system ($os)." >&2 - echo "If you think otherwise please submit a patch." >&2 + cat >&2 << DONE +The developer of this type (${__type##*/}) did not think your operating system +($os) would have any use for it. If you think otherwise please submit a patch. +DONE exit 1 ;; esac From 6f0459f3c57607bb4b37ca6ae579f54ffd83c419 Mon Sep 17 00:00:00 2001 From: Steven Armstrong Date: Wed, 5 Feb 2014 21:18:47 +0100 Subject: [PATCH 39/60] remove legacy FIXME Signed-off-by: Steven Armstrong --- cdist/conf/type/__apt_source/man.text | 2 +- cdist/conf/type/__apt_source/manifest | 2 -- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/cdist/conf/type/__apt_source/man.text b/cdist/conf/type/__apt_source/man.text index fe40a91e..03b2b311 100644 --- a/cdist/conf/type/__apt_source/man.text +++ b/cdist/conf/type/__apt_source/man.text @@ -32,7 +32,7 @@ distribution:: the targets /etc/lsb-release component:: - space delimited list of components to enable. Defaults to 'main'. + space delimited list of components to enable. Defaults to an empty string. BOOLEAN PARAMETERS diff --git a/cdist/conf/type/__apt_source/manifest b/cdist/conf/type/__apt_source/manifest index b4d72a71..0e782716 100755 --- a/cdist/conf/type/__apt_source/manifest +++ b/cdist/conf/type/__apt_source/manifest @@ -30,8 +30,6 @@ fi if [ -f "$__object/parameter/component" ]; then component="$(cat "$__object/parameter/component")" else - # FIXME: nead to omit this for http://stat.ethz.ch/CRAN//bin/linux/ubuntu, investigate side-effects - #component="main" component="" fi if [ -f "$__object/parameter/arch" ]; then From c663d87ba6e8db478b86478193b48364dc349428 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Wed, 5 Feb 2014 22:53:45 +0100 Subject: [PATCH 40/60] release 3.0.5 Signed-off-by: Nico Schottelius --- docs/changelog | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/docs/changelog b/docs/changelog index 14e34b3d..5ce2e288 100644 --- a/docs/changelog +++ b/docs/changelog @@ -4,10 +4,11 @@ Changelog * Changes are always commented with their author in (braces) * Exception: No braces means author == Nico Schottelius -3.0.5: + +3.0.5: 2014-02-05 * Core: Introduce override concept (Daniel Heule) * Type __process: Make --state absent work (Steven Armstrong) - * Documentation: Add documentation for influencing variables + * Documentation: Update documentation for environment variables 3.0.4: 2014-01-29 From 2e6a8275130a1cb7657c0ed21b8651776e1006b6 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Wed, 5 Feb 2014 23:15:56 +0100 Subject: [PATCH 41/60] ++changes Signed-off-by: Nico Schottelius --- docs/changelog | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/docs/changelog b/docs/changelog index 5ce2e288..9c222384 100644 --- a/docs/changelog +++ b/docs/changelog @@ -5,6 +5,13 @@ Changelog * Exception: No braces means author == Nico Schottelius +3.0.6: + * New Type: __apt_key (Steven Armstrong) + * New Type: __apt_key_uri (Steven Armstrong) + * New Type: __apt_norecommends (Steven Armstrong) + * New Type: __apt_source (Steven Armstrong) + + 3.0.5: 2014-02-05 * Core: Introduce override concept (Daniel Heule) * Type __process: Make --state absent work (Steven Armstrong) From 294285c164fdb212ea2fc6277c97fc877e889cb2 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Thu, 6 Feb 2014 00:08:40 +0100 Subject: [PATCH 42/60] import __ccollect_source type Signed-off-by: Nico Schottelius --- .../type/__ccollect_source/explorer/cksum | 34 +++++++ .../conf/type/__ccollect_source/explorer/stat | 47 ++++++++++ .../conf/type/__ccollect_source/explorer/type | 33 +++++++ .../type/__ccollect_source/gencode-remote | 93 +++++++++++++++++++ cdist/conf/type/__ccollect_source/man.text | 64 +++++++++++++ cdist/conf/type/__ccollect_source/manifest | 53 +++++++++++ .../type/__ccollect_source/parameter/boolean | 1 + .../parameter/default/ccollectconf | 1 + .../__ccollect_source/parameter/default/state | 1 + .../type/__ccollect_source/parameter/optional | 2 + .../parameter/optional_multiple | 1 + .../type/__ccollect_source/parameter/required | 2 + 12 files changed, 332 insertions(+) create mode 100755 cdist/conf/type/__ccollect_source/explorer/cksum create mode 100755 cdist/conf/type/__ccollect_source/explorer/stat create mode 100755 cdist/conf/type/__ccollect_source/explorer/type create mode 100755 cdist/conf/type/__ccollect_source/gencode-remote create mode 100644 cdist/conf/type/__ccollect_source/man.text create mode 100755 cdist/conf/type/__ccollect_source/manifest create mode 100644 cdist/conf/type/__ccollect_source/parameter/boolean create mode 100644 cdist/conf/type/__ccollect_source/parameter/default/ccollectconf create mode 100644 cdist/conf/type/__ccollect_source/parameter/default/state create mode 100644 cdist/conf/type/__ccollect_source/parameter/optional create mode 100644 cdist/conf/type/__ccollect_source/parameter/optional_multiple create mode 100644 cdist/conf/type/__ccollect_source/parameter/required diff --git a/cdist/conf/type/__ccollect_source/explorer/cksum b/cdist/conf/type/__ccollect_source/explorer/cksum new file mode 100755 index 00000000..335e4e7a --- /dev/null +++ b/cdist/conf/type/__ccollect_source/explorer/cksum @@ -0,0 +1,34 @@ +#!/bin/sh +# +# 2011-2012 Nico Schottelius (nico-cdist at schottelius.org) +# +# This file is part of cdist. +# +# cdist is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# cdist is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with cdist. If not, see . +# +# +# Retrieve the md5sum of a file to be created, if it is already existing. +# + +destination="/$__object_id" + +if [ -e "$destination" ]; then + if [ -f "$destination" ]; then + cksum < "$destination" + else + echo "NO REGULAR FILE" + fi +else + echo "NO FILE FOUND, NO CHECKSUM CALCULATED." +fi diff --git a/cdist/conf/type/__ccollect_source/explorer/stat b/cdist/conf/type/__ccollect_source/explorer/stat new file mode 100755 index 00000000..298221b7 --- /dev/null +++ b/cdist/conf/type/__ccollect_source/explorer/stat @@ -0,0 +1,47 @@ +#!/bin/sh +# +# 2013 Steven Armstrong (steven-cdist armstrong.cc) +# +# This file is part of cdist. +# +# cdist is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# cdist is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with cdist. If not, see . +# + +destination="/$__object_id" + +# nothing to work with, nothing we could do +[ -e "$destination" ] || exit 0 + +os=$("$__explorer/os") +case "$os" in + "freebsd") + # FIXME: should be something like this based on man page, but can not test + stat -f "type: %ST +owner: %Du %Su +group: %Dg %Sg +mode: %Op %Sp +size: %Dz +links: %Dl +" "$destination" + ;; + *) + stat --printf="type: %F +owner: %u %U +group: %g %G +mode: %a %A +size: %s +links: %h +" "$destination" + ;; +esac diff --git a/cdist/conf/type/__ccollect_source/explorer/type b/cdist/conf/type/__ccollect_source/explorer/type new file mode 100755 index 00000000..e723047c --- /dev/null +++ b/cdist/conf/type/__ccollect_source/explorer/type @@ -0,0 +1,33 @@ +#!/bin/sh +# +# 2013 Steven Armstrong (steven-cdist armstrong.cc) +# +# This file is part of cdist. +# +# cdist is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# cdist is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with cdist. If not, see . +# + +destination="/$__object_id" + +if [ ! -e "$destination" ]; then + echo none +elif [ -h "$destination" ]; then + echo symlink +elif [ -f "$destination" ]; then + echo file +elif [ -d "$destination" ]; then + echo directory +else + echo unknown +fi diff --git a/cdist/conf/type/__ccollect_source/gencode-remote b/cdist/conf/type/__ccollect_source/gencode-remote new file mode 100755 index 00000000..c41b5179 --- /dev/null +++ b/cdist/conf/type/__ccollect_source/gencode-remote @@ -0,0 +1,93 @@ +#!/bin/sh +# +# 2014 Nico Schottelius (nico-cdist at schottelius.org) +# +# This file is part of cdist. +# +# cdist is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# cdist is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with cdist. If not, see . +# + +destination="/$__object_id" +state_should="$(cat "$__object/parameter/state")" +type="$(cat "$__object/explorer/type")" +stat_file="$__object/explorer/stat" + + +get_current_value() { + if [ -s "$stat_file" ]; then + _name="$1" + _value="$2" + case "$_value" in + [0-9]*) + _index=2 + ;; + *) + _index=3 + ;; + esac + awk '/'"$_name"':/ { print $'$_index' }' "$stat_file" + unset _name _value _index + fi +} + +set_group() { + echo chgrp \"$1\" \"$destination\" + echo chgrp $1 >> "$__messages_out" +} + +set_owner() { + echo chown \"$1\" \"$destination\" + echo chown $1 >> "$__messages_out" +} + +set_mode() { + echo chmod \"$1\" \"$destination\" + echo chmod $1 >> "$__messages_out" +} + +set_attributes= +case "$state_should" in + present|exists) + # Note: Mode - needs to happen last as a chown/chgrp can alter mode by + # clearing S_ISUID and S_ISGID bits (see chown(2)) + for attribute in group owner mode; do + if [ -f "$__object/parameter/$attribute" ]; then + value_should="$(cat "$__object/parameter/$attribute")" + + # change 0xxx format to xxx format => same as stat returns + if [ "$attribute" = mode ]; then + value_should="$(echo $value_should | sed 's/^0\(...\)/\1/')" + fi + + value_is="$(get_current_value "$attribute" "$value_should")" + if [ -f "$__object/files/set-attributes" -o "$value_should" != "$value_is" ]; then + "set_$attribute" "$value_should" + fi + fi + done + + ;; + + absent) + if [ "$type" = "file" ]; then + echo rm -f \"$destination\" + echo remove >> "$__messages_out" + fi + ;; + + *) + echo "Unknown state: $state_should" >&2 + exit 1 + ;; +esac diff --git a/cdist/conf/type/__ccollect_source/man.text b/cdist/conf/type/__ccollect_source/man.text new file mode 100644 index 00000000..32a7467e --- /dev/null +++ b/cdist/conf/type/__ccollect_source/man.text @@ -0,0 +1,64 @@ +cdist-type__ccollect_source(7) +============================== +Nico Schottelius + + +NAME +---- +cdist-type__ccollect_source - Manage ccollect sources + + +DESCRIPTION +----------- +This cdist type allows you to create or delete ccollect sources. + +REQUIRED PARAMETERS +------------------- +source:: + The source from which to backup +destination:: + The destination directory + + +OPTIONAL PARAMETERS +------------------- +state:: + 'present' or 'absent', defaults to 'present' +ccollectconf:: + The CCOLLECT_CONF directory. Defaults to /etc/ccollect. + + +OPTIONAL MULTIPLE PARAMETERS +---------------------------- +exclude:: + Paths to exclude of backup + +BOOLEAN PARAMETERS +------------------ +verbose:: + Whether to report backup verbosely + +EXAMPLES +-------- + +-------------------------------------------------------------------------------- +__ccollect_source doc.ungleich.ch \ + --source doc.ungleich.ch:/ \ + --destination /backup/doc.ungleich.ch \ + --exclude '/proc/*' --exclude '/sys/*' \ + --verbose + +-------------------------------------------------------------------------------- + + +SEE ALSO +-------- +- cdist-type(7) +- ccollect(1) +- http://www.nico.schottelius.org/software/ccollect/ + + +COPYING +------- +Copyright \(C) 2014 Nico Schottelius. Free use of this software is +granted under the terms of the GNU General Public License version 3 (GPLv3). diff --git a/cdist/conf/type/__ccollect_source/manifest b/cdist/conf/type/__ccollect_source/manifest new file mode 100755 index 00000000..89c2ef2b --- /dev/null +++ b/cdist/conf/type/__ccollect_source/manifest @@ -0,0 +1,53 @@ +#!/bin/sh +# +# 2014 Nico Schottelius (nico-cdist at schottelius.org) +# +# This file is part of cdist. +# +# cdist is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# cdist is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with cdist. If not, see . +# + +name="$__object_id" +state="$(cat "$__object/parameter/state")" +source="$(cat "$__object/parameter/source")" +destination="$(cat "$__object/parameter/destination")" +ccollectconf="$(cat "$__object/parameter/ccollectconf" | sed 's,/$,,')" + +sourcedir="$ccollectconf/sources" +basedir="$sourcedir/$name" + +destination_file="$basedir/destination" +source_file="$basedir/source" +exclude_file="$basedir/exclude" +verbose_file="$basedir/verbose" + +__directory "$basedir" --state "$state" + +export require="__directory$basedir" +echo "$destination" | __file "$destination_file" --source - --state "$state" +echo "$source" | __file "$source_file" --source - --state "$state" + +################################################################################ +# Booleans +if [ -f "$__object/parameter/verbose" ]; then + verbosestate="present" +else + verbosestate="absent" +fi +__file "$verbose_file" --state "$verbosestate" + +if [ -f "$__object/parameter/exclude" ]; then + __file "$exclude_file" --source - --state "$state" \ + < "$__object/parameter/exclude" +fi diff --git a/cdist/conf/type/__ccollect_source/parameter/boolean b/cdist/conf/type/__ccollect_source/parameter/boolean new file mode 100644 index 00000000..c00ee94a --- /dev/null +++ b/cdist/conf/type/__ccollect_source/parameter/boolean @@ -0,0 +1 @@ +verbose diff --git a/cdist/conf/type/__ccollect_source/parameter/default/ccollectconf b/cdist/conf/type/__ccollect_source/parameter/default/ccollectconf new file mode 100644 index 00000000..a9fda009 --- /dev/null +++ b/cdist/conf/type/__ccollect_source/parameter/default/ccollectconf @@ -0,0 +1 @@ +/etc/ccollect diff --git a/cdist/conf/type/__ccollect_source/parameter/default/state b/cdist/conf/type/__ccollect_source/parameter/default/state new file mode 100644 index 00000000..e7f6134f --- /dev/null +++ b/cdist/conf/type/__ccollect_source/parameter/default/state @@ -0,0 +1 @@ +present diff --git a/cdist/conf/type/__ccollect_source/parameter/optional b/cdist/conf/type/__ccollect_source/parameter/optional new file mode 100644 index 00000000..0249d11e --- /dev/null +++ b/cdist/conf/type/__ccollect_source/parameter/optional @@ -0,0 +1,2 @@ +ccollectconf +state diff --git a/cdist/conf/type/__ccollect_source/parameter/optional_multiple b/cdist/conf/type/__ccollect_source/parameter/optional_multiple new file mode 100644 index 00000000..9ba870ea --- /dev/null +++ b/cdist/conf/type/__ccollect_source/parameter/optional_multiple @@ -0,0 +1 @@ +exclude diff --git a/cdist/conf/type/__ccollect_source/parameter/required b/cdist/conf/type/__ccollect_source/parameter/required new file mode 100644 index 00000000..9239646e --- /dev/null +++ b/cdist/conf/type/__ccollect_source/parameter/required @@ -0,0 +1,2 @@ +source +destination From c1d2ceefc2ed2d294927f18335f47ab14ef6b154 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Thu, 6 Feb 2014 00:10:02 +0100 Subject: [PATCH 43/60] ++changes Signed-off-by: Nico Schottelius --- docs/changelog | 1 + 1 file changed, 1 insertion(+) diff --git a/docs/changelog b/docs/changelog index 9c222384..7d693496 100644 --- a/docs/changelog +++ b/docs/changelog @@ -10,6 +10,7 @@ Changelog * New Type: __apt_key_uri (Steven Armstrong) * New Type: __apt_norecommends (Steven Armstrong) * New Type: __apt_source (Steven Armstrong) + * New Type: __ccollect_source 3.0.5: 2014-02-05 From 98e7b7644cd9ae031b89c6ed604ac589e2adc0cd Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Thu, 6 Feb 2014 11:35:45 +0100 Subject: [PATCH 44/60] release 3.0.6 Signed-off-by: Nico Schottelius --- docs/changelog | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/docs/changelog b/docs/changelog index 7d693496..e07f14ff 100644 --- a/docs/changelog +++ b/docs/changelog @@ -5,12 +5,17 @@ Changelog * Exception: No braces means author == Nico Schottelius -3.0.6: +3.0.6: 2014-02-06 * New Type: __apt_key (Steven Armstrong) * New Type: __apt_key_uri (Steven Armstrong) * New Type: __apt_norecommends (Steven Armstrong) * New Type: __apt_source (Steven Armstrong) * New Type: __ccollect_source + * Type __git: Use default parameters (Daniel Heule) + * Type __jail: Use default parameters (Daniel Heule) + * Type __package_yum: Use default parameters (Daniel Heule) + * Type __package_zypper: Use default parameters (Daniel Heule) + * Type __user_groups: Use default parameters (Daniel Heule) 3.0.5: 2014-02-05 From 51afca5336464dc65ed183bf83c21e718d167db0 Mon Sep 17 00:00:00 2001 From: Daniel Heule Date: Thu, 6 Feb 2014 15:26:17 +0100 Subject: [PATCH 45/60] Implement lastest suggestions from nico, rename ENV Variable to CDIST_ORDER_DEPENDENCY --- cdist/emulator.py | 5 ++--- docs/man/man7/cdist-manifest.text | 8 ++++---- 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/cdist/emulator.py b/cdist/emulator.py index 2c3c12a4..203c97e5 100644 --- a/cdist/emulator.py +++ b/cdist/emulator.py @@ -189,9 +189,8 @@ class Emulator(object): def record_requirements(self): """record requirements""" - #from pudb import set_trace; set_trace(); - if "EXECUTE_TYPES_IN_CREATION_ORDER" in self.env and self.env['EXECUTE_TYPES_IN_CREATION_ORDER'] == 'true': + if "CDIST_ORDER_DEPENDENCY" in self.env: # load object name created bevor this one from typeorder file ... with open(self.typeorder_path, 'r') as typecreationfile: typecreationorder = typecreationfile.readlines() @@ -202,7 +201,7 @@ class Emulator(object): self.env['require'] += " " + lastcreatedtype else: self.env['require'] = lastcreatedtype - self.log.debug("Injecting require for EXECUTE_TYPES_IN_CREATION_ORDER: %s for %s", lastcreatedtype, self.cdist_object.name) + self.log.debug("Injecting require for CDIST_ORDER_DEPENDENCY: %s for %s", lastcreatedtype, self.cdist_object.name) except IndexError: # if no second last line, we are on the first type, so do not set a requirement pass diff --git a/docs/man/man7/cdist-manifest.text b/docs/man/man7/cdist-manifest.text index 8ae8f966..66a4cd2a 100644 --- a/docs/man/man7/cdist-manifest.text +++ b/docs/man/man7/cdist-manifest.text @@ -142,19 +142,19 @@ into an undefined situation. THIS IS A BETA FEATURE AND MAY BE REMOVED AT ANY TIME. -EXECUTE_TYPES_IN_CREATION_ORDER is a EXPERIMENTAL FEATURE ! +CDIST_ORDER_DEPENDENCY is a EXPERIMENTAL FEATURE ! You can tell cdist to execute all types in the order in which they are created -in the manifest by exporting EXECUTE_TYPES_IN_CREATION_ORDER with the value true. +in the manifest by exporting CDIST_ORDER_DEPENDENCY. -------------------------------------------------------------------------------- # Tells cdist to execute all types in the order in which they are created ... -export EXECUTE_TYPES_IN_CREATION_ORDER=true +export CDIST_ORDER_DEPENDENCY=on __sample_type 1 require="__some_type_somewhere/id" __sample_type 2 __example_type 23 # Now this types are executed in the creation order until the variable is unset -unset EXECUTE_TYPES_IN_CREATION_ORDER +unset CDIST_ORDER_DEPENDENCY # all now following types cdist makes the order .. __not_in_order_type 42 From 724385fcf38a0ee94009250e434c02dc941530d4 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Thu, 6 Feb 2014 15:55:41 +0100 Subject: [PATCH 46/60] update manifest document for in order execution Signed-off-by: Nico Schottelius --- docs/man/man7/cdist-manifest.text | 67 ++++++++++++++++++------------- 1 file changed, 39 insertions(+), 28 deletions(-) diff --git a/docs/man/man7/cdist-manifest.text b/docs/man/man7/cdist-manifest.text index 66a4cd2a..fbdab849 100644 --- a/docs/man/man7/cdist-manifest.text +++ b/docs/man/man7/cdist-manifest.text @@ -128,6 +128,19 @@ All objects that are created in a type manifest are automatically required from the type that is calling them. This is called "autorequirement" in cdist jargon. +CREATE DEPENDENCIES FROM EXECUTION ORDER +----------------------------------------- +You can tell cdist to execute all types in the order in which they are created +in the manifest by setting up the variable CDIST_ORDER_DEPENDENCY. +When cdist sees that this variable is setup, the current created object +automatically depends on the previously created object. + +It essentially helps you to build up blocks of code that build upon each other +(like first creating the directory xyz than the file below the directory). + +THIS IS A BETA FEATURE AND MAY BE REMOVED OR CHANGED AT ANY TIME. + + OVERRIDES --------- In some special cases, you would like to create an already defined object @@ -139,33 +152,7 @@ ATTENTION: Only use this feature if you are 100% sure in which order cdist encounter the affected objects, otherwhise this results into an undefined situation. -THIS IS A BETA FEATURE AND MAY BE REMOVED AT ANY TIME. - - -CDIST_ORDER_DEPENDENCY is a EXPERIMENTAL FEATURE ! -You can tell cdist to execute all types in the order in which they are created -in the manifest by exporting CDIST_ORDER_DEPENDENCY. - --------------------------------------------------------------------------------- - -# Tells cdist to execute all types in the order in which they are created ... -export CDIST_ORDER_DEPENDENCY=on -__sample_type 1 -require="__some_type_somewhere/id" __sample_type 2 -__example_type 23 -# Now this types are executed in the creation order until the variable is unset -unset CDIST_ORDER_DEPENDENCY -# all now following types cdist makes the order .. -__not_in_order_type 42 - -# how it works : -# this lines above are translated to: -__sample_type 1 -require="__some_type_somewhere/id __sample_type/1" __sample_type 2 -require="__sample_type/2" __example_type 23 -__not_in_order_type 42 - --------------------------------------------------------------------------------- +THIS IS A BETA FEATURE AND MAY BE REMOVED OR CHANGED AT ANY TIME. @@ -223,6 +210,30 @@ CDIST_ALLOW_OVERRIDE=yes __user foobar --password 'some_other_hash' # and stay at the original value of /home/foobarexample -------------------------------------------------------------------------------- +Dependencies defined by execution order work as following: + +-------------------------------------------------------------------------------- + +# Tells cdist to execute all types in the order in which they are created ... +export CDIST_ORDER_DEPENDENCY=on +__sample_type 1 +require="__some_type_somewhere/id" __sample_type 2 +__example_type 23 +# Now this types are executed in the creation order until the variable is unset +unset CDIST_ORDER_DEPENDENCY +# all now following types cdist makes the order .. +__not_in_order_type 42 + +# how it works : +# this lines above are translated to: +__sample_type 1 +require="__some_type_somewhere/id __sample_type/1" __sample_type 2 +require="__sample_type/2" __example_type 23 +__not_in_order_type 42 + +-------------------------------------------------------------------------------- + + SEE ALSO -------- @@ -232,5 +243,5 @@ SEE ALSO COPYING ------- -Copyright \(C) 2010-2012 Nico Schottelius. Free use of this software is +Copyright \(C) 2010-2014 Nico Schottelius. Free use of this software is granted under the terms of the GNU General Public License version 3 (GPLv3). From 49764ae5c77953273e801b928bdb126b01320eec Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Thu, 6 Feb 2014 15:58:25 +0100 Subject: [PATCH 47/60] ++changes Signed-off-by: Nico Schottelius --- docs/changelog | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/docs/changelog b/docs/changelog index e07f14ff..120d8e87 100644 --- a/docs/changelog +++ b/docs/changelog @@ -5,6 +5,9 @@ Changelog * Exception: No braces means author == Nico Schottelius +3.0.7: + * Core: Add support for in order execution (Daniel Heule) + 3.0.6: 2014-02-06 * New Type: __apt_key (Steven Armstrong) * New Type: __apt_key_uri (Steven Armstrong) @@ -17,13 +20,11 @@ Changelog * Type __package_zypper: Use default parameters (Daniel Heule) * Type __user_groups: Use default parameters (Daniel Heule) - 3.0.5: 2014-02-05 * Core: Introduce override concept (Daniel Heule) * Type __process: Make --state absent work (Steven Armstrong) * Documentation: Update documentation for environment variables - 3.0.4: 2014-01-29 * Core: Ignore install types in config mode * Documentation: Update reference (files path in object space) @@ -32,7 +33,6 @@ Changelog * Type __debconf_set_selections: Support --file - to read from stdin * Type __jail: Fix jaildir parameter handling (Jake Guffey) - 3.0.3: 2014-01-22 * Core: Enhance error message when requirement is missing object id * Core: Add environment variable to select shell for executing scripts (Daniel Heule) @@ -45,7 +45,6 @@ Changelog * Type __zypper_repo: Use default paremeters (Daniel Heule) * Type __zypper_service: Use default paremeters (Daniel Heule) - 3.0.2: 2014-01-19 * Documentation: Document all messages sent by types (Daniel Heule) * New Type: __block (Steven Armstrong) @@ -53,7 +52,6 @@ Changelog * Type __cron: Replace existing entry when changing it (Daniel Heule) * Type __ssh_authorized_keys: Use new type __block (Steven Armstrong) - 3.0.1: 2014-01-14 * Core: Copy only files, not directories (Steven Armstrong) * Core: Allow hostnames to start with / From 52e2017d8feedfd035838a6c186c119fa713cf88 Mon Sep 17 00:00:00 2001 From: Daniel Heule Date: Thu, 6 Feb 2014 16:03:07 +0100 Subject: [PATCH 48/60] CDIST_ALLOW_OVERRIDE -> CDIST_OVERRIDE as requested by nico --- cdist/emulator.py | 4 ++-- docs/man/man7/cdist-manifest.text | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/cdist/emulator.py b/cdist/emulator.py index 4f91cd8e..1e8701cf 100644 --- a/cdist/emulator.py +++ b/cdist/emulator.py @@ -145,14 +145,14 @@ class Emulator(object): if value is not None: self.parameters[key] = value - if self.cdist_object.exists and not 'CDIST_ALLOW_OVERRIDE' in os.environ: + if self.cdist_object.exists and not 'CDIST_OVERRIDE' in os.environ: if self.cdist_object.parameters != self.parameters: raise cdist.Error("Object %s already exists with conflicting parameters:\n%s: %s\n%s: %s" % (self.cdist_object.name, " ".join(self.cdist_object.source), self.cdist_object.parameters, self.object_source, self.parameters) ) else: if self.cdist_object.exists: - self.log.debug('Object %s override forced with CDIST_ALLOW_OVERRIDE',self.cdist_object.name) + self.log.debug('Object %s override forced with CDIST_OVERRIDE',self.cdist_object.name) self.cdist_object.create(True) else: self.cdist_object.create() diff --git a/docs/man/man7/cdist-manifest.text b/docs/man/man7/cdist-manifest.text index 7f1b95dc..cfbd8bea 100644 --- a/docs/man/man7/cdist-manifest.text +++ b/docs/man/man7/cdist-manifest.text @@ -133,7 +133,7 @@ OVERRIDES --------- In some special cases, you would like to create an already defined object with different parameters. In normal situations this leads to an error in cdist. -If you whish, you can setup the environment variable CDIST_ALLOW_OVERRIDE +If you whish, you can setup the environment variable CDIST_OVERRIDE (any value or even empty is ok) to tell cdist, that this object override is wanted and should be accepted. ATTENTION: Only use this feature if you are 100% sure in which order @@ -190,7 +190,7 @@ __user foobar --password 'some_fancy_hash' --home /home/foobarexample __user foobar --password 'some_other_hash' # this tells cdist, that you know that this is an override and should be accepted -CDIST_ALLOW_OVERRIDE=yes __user foobar --password 'some_other_hash' +CDIST_OVERRIDE=yes __user foobar --password 'some_other_hash' # its only an override, means the parameter --home is not touched # and stay at the original value of /home/foobarexample -------------------------------------------------------------------------------- From 2fa174f6ead4c4fb81af2b8618f9c668723f2789 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Thu, 6 Feb 2014 17:02:14 +0100 Subject: [PATCH 49/60] update link to ungleich Signed-off-by: Nico Schottelius --- docs/web/cdist/support.mdwn | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/web/cdist/support.mdwn b/docs/web/cdist/support.mdwn index 7515070d..39388c5a 100644 --- a/docs/web/cdist/support.mdwn +++ b/docs/web/cdist/support.mdwn @@ -20,6 +20,6 @@ you can join the ### Commercial support You can request commercial support for cdist from -[my company](http://firma.schottelius.org/english/). +[my company](http://www.ungleich.ch/english/). [[!tag cdist unix]] From 717e21da6c6a93fa77c3da65641b217718d464bd Mon Sep 17 00:00:00 2001 From: Daniel Heule Date: Fri, 7 Feb 2014 00:28:02 +0100 Subject: [PATCH 50/60] initial update for override unittests --- cdist/test/emulator/__init__.py | 30 +++++++++++++++++++++++++++++- 1 file changed, 29 insertions(+), 1 deletion(-) diff --git a/cdist/test/emulator/__init__.py b/cdist/test/emulator/__init__.py index 8c2dcd72..d2bf4cf2 100644 --- a/cdist/test/emulator/__init__.py +++ b/cdist/test/emulator/__init__.py @@ -100,6 +100,7 @@ class EmulatorTestCase(test.CdistTestCase): argv = ['__file', '/tmp/foobar'] self.env['require'] = '__file/etc/*' emu = emulator.Emulator(argv, env=self.env) + emu.run() # if we get here all is fine @@ -129,6 +130,33 @@ class AutoRequireEmulatorTestCase(test.CdistTestCase): expected = ['__planet/Saturn', '__moon/Prometheus'] self.assertEqual(sorted(cdist_object.autorequire), sorted(expected)) +class OverrideTestCase(test.CdistTestCase): + + def setUp(self): + self.temp_dir = self.mkdtemp() + handle, self.script = self.mkstemp(dir=self.temp_dir) + os.close(handle) + base_path = self.temp_dir + + self.local = local.Local( + target_host=self.target_host, + base_path=base_path, + exec_path=test.cdist_exec_path, + add_conf_dirs=[conf_dir]) + self.local.create_files_dirs() + + self.manifest = core.Manifest(self.target_host, self.local) + self.env = self.manifest.env_initial_manifest(self.script) + + def tearDown(self): + shutil.rmtree(self.temp_dir) + + def test_override(self): + argv = ['__file', '/tmp/foobar'] + self.env['require'] = '__file/etc/*' + emu = emulator.Emulator(argv, env=self.env) + # if we get here all is fine + class ArgumentsTestCase(test.CdistTestCase): @@ -182,7 +210,7 @@ class ArgumentsTestCase(test.CdistTestCase): object_id = 'some-id' value = 'some value' argv = [type_name, object_id, '--required1', value, '--required2', value] - print(self.env) +# print(self.env) os.environ.update(self.env) emu = emulator.Emulator(argv) emu.run() From f163b327205949f584cb90730be1276e0f1d2265 Mon Sep 17 00:00:00 2001 From: Daniel Heule Date: Fri, 7 Feb 2014 13:28:22 +0100 Subject: [PATCH 51/60] first try of a test --- cdist/test/emulator/__init__.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/cdist/test/emulator/__init__.py b/cdist/test/emulator/__init__.py index d2bf4cf2..57874f9d 100644 --- a/cdist/test/emulator/__init__.py +++ b/cdist/test/emulator/__init__.py @@ -100,7 +100,6 @@ class EmulatorTestCase(test.CdistTestCase): argv = ['__file', '/tmp/foobar'] self.env['require'] = '__file/etc/*' emu = emulator.Emulator(argv, env=self.env) - emu.run() # if we get here all is fine @@ -155,6 +154,11 @@ class OverrideTestCase(test.CdistTestCase): argv = ['__file', '/tmp/foobar'] self.env['require'] = '__file/etc/*' emu = emulator.Emulator(argv, env=self.env) + emu.run() + argv = ['__file', '/tmp/foobar'] + self.env['require'] = '__file/etc/*' + emu = emulator.Emulator(argv, env=self.env) + emu.run() # if we get here all is fine From 60c53e213c6961ea7d19731df2a0309095d5897c Mon Sep 17 00:00:00 2001 From: Daniel Heule Date: Fri, 7 Feb 2014 14:24:12 +0100 Subject: [PATCH 52/60] testcases emulator.OverrideTestCase, with some minor bugfixes to make test work as expected ... --- cdist/emulator.py | 3 +-- cdist/test/cdist_object/__init__.py | 4 ++-- cdist/test/cdist_type/__init__.py | 4 ++-- cdist/test/emulator/__init__.py | 15 +++++++++++---- 4 files changed, 16 insertions(+), 10 deletions(-) diff --git a/cdist/emulator.py b/cdist/emulator.py index 7fd89110..c910531c 100644 --- a/cdist/emulator.py +++ b/cdist/emulator.py @@ -130,7 +130,6 @@ class Emulator(object): self.args = parser.parse_args(self.argv[1:]) self.log.debug('Args: %s' % self.args) - def setup_object(self): # Setup object_id - FIXME: unset / do not setup anymore! if not self.cdist_type.is_singleton: @@ -146,7 +145,7 @@ class Emulator(object): if value is not None: self.parameters[key] = value - if self.cdist_object.exists and not 'CDIST_OVERRIDE' in os.environ: + if self.cdist_object.exists and not 'CDIST_OVERRIDE' in self.env: if self.cdist_object.parameters != self.parameters: raise cdist.Error("Object %s already exists with conflicting parameters:\n%s: %s\n%s: %s" % (self.cdist_object.name, " ".join(self.cdist_object.source), self.cdist_object.parameters, self.object_source, self.parameters) diff --git a/cdist/test/cdist_object/__init__.py b/cdist/test/cdist_object/__init__.py index 54ecf637..0e2da103 100644 --- a/cdist/test/cdist_object/__init__.py +++ b/cdist/test/cdist_object/__init__.py @@ -58,10 +58,10 @@ class ObjectClassTestCase(test.CdistTestCase): def test_list_type_names(self): type_names = list(cdist.core.CdistObject.list_type_names(object_base_path)) - self.assertEqual(type_names, ['__first', '__second', '__third']) + self.assertEqual(sorted(type_names), ['__first', '__second', '__third']) def test_list_objects(self): - found_objects = list(core.CdistObject.list_objects(object_base_path, type_base_path)) + found_objects = sorted(list(core.CdistObject.list_objects(object_base_path, type_base_path))) self.assertEqual(found_objects, self.expected_objects) def test_create_singleton(self): diff --git a/cdist/test/cdist_type/__init__.py b/cdist/test/cdist_type/__init__.py index 79f824d3..36a524b4 100644 --- a/cdist/test/cdist_type/__init__.py +++ b/cdist/test/cdist_type/__init__.py @@ -34,7 +34,7 @@ class TypeTestCase(test.CdistTestCase): def test_list_type_names(self): base_path = op.join(fixtures, 'list_types') type_names = core.CdistType.list_type_names(base_path) - self.assertEqual(type_names, ['__first', '__second', '__third']) + self.assertEqual(sorted(type_names), ['__first', '__second', '__third']) def test_list_types(self): base_path = op.join(fixtures, 'list_types') @@ -44,7 +44,7 @@ class TypeTestCase(test.CdistTestCase): core.CdistType(base_path, '__second'), core.CdistType(base_path, '__third'), ] - self.assertEqual(types, types_expected) + self.assertEqual(sorted(types), types_expected) def test_only_one_instance(self): base_path = fixtures diff --git a/cdist/test/emulator/__init__.py b/cdist/test/emulator/__init__.py index 57874f9d..95c189d6 100644 --- a/cdist/test/emulator/__init__.py +++ b/cdist/test/emulator/__init__.py @@ -2,6 +2,7 @@ # # 2010-2011 Steven Armstrong (steven-cdist at armstrong.cc) # 2012-2013 Nico Schottelius (nico-cdist at schottelius.org) +# 2014 Daniel Heule (hda at sfs.biz) # # This file is part of cdist. # @@ -150,16 +151,22 @@ class OverrideTestCase(test.CdistTestCase): def tearDown(self): shutil.rmtree(self.temp_dir) - def test_override(self): + def test_override_negative(self): argv = ['__file', '/tmp/foobar'] - self.env['require'] = '__file/etc/*' emu = emulator.Emulator(argv, env=self.env) emu.run() + argv = ['__file', '/tmp/foobar','--mode','404'] + emu = emulator.Emulator(argv, env=self.env) + self.assertRaises(cdist.Error, emu.run) + + def test_override_feature(self): argv = ['__file', '/tmp/foobar'] - self.env['require'] = '__file/etc/*' emu = emulator.Emulator(argv, env=self.env) emu.run() - # if we get here all is fine + argv = ['__file', '/tmp/foobar','--mode','404'] + self.env['CDIST_OVERRIDE'] = 'on' + emu = emulator.Emulator(argv, env=self.env) + emu.run() class ArgumentsTestCase(test.CdistTestCase): From f87fc63a7960a7efe42d354d64c3cfaf97c47942 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Sat, 8 Feb 2014 00:13:33 +0100 Subject: [PATCH 53/60] cdist 3.0.7 Signed-off-by: Nico Schottelius --- docs/changelog | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/docs/changelog b/docs/changelog index 120d8e87..2bbe4edf 100644 --- a/docs/changelog +++ b/docs/changelog @@ -5,8 +5,9 @@ Changelog * Exception: No braces means author == Nico Schottelius -3.0.7: - * Core: Add support for in order execution (Daniel Heule) +3.0.7: 2014-02-08 + * Core: Allow dependencies to be created based execution order (Daniel Heule) + * Core: Add tests for override (Daniel Heule) 3.0.6: 2014-02-06 * New Type: __apt_key (Steven Armstrong) From 77df0ae324c95874f543bba213a54723771d2271 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Sat, 8 Feb 2014 00:14:42 +0100 Subject: [PATCH 54/60] update reference Signed-off-by: Nico Schottelius --- docs/man/cdist-reference.text.sh | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/docs/man/cdist-reference.text.sh b/docs/man/cdist-reference.text.sh index 5de59eab..88a002df 100755 --- a/docs/man/cdist-reference.text.sh +++ b/docs/man/cdist-reference.text.sh @@ -239,6 +239,9 @@ require:: CDIST_ALLOW_OVERRIDE:: Allow overwriting type parameters (see cdist-manifest(7)) +CDIST_ORDER_DEPENDENCY:: + Create dependencies based on the execution order (see cdist-manifest(7)) + SEE ALSO -------- - cdist(1) @@ -246,6 +249,6 @@ SEE ALSO COPYING ------- -Copyright \(C) 2011-2013 Nico Schottelius. Free use of this software is +Copyright \(C) 2011-2014 Nico Schottelius. Free use of this software is granted under the terms of the GNU General Public License version 3 (GPLv3). eof From 4cca5930718c7584cde02a392c55e26c79342aee Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Sat, 8 Feb 2014 00:44:47 +0100 Subject: [PATCH 55/60] do not package .swp files (fixes #269) Signed-off-by: Nico Schottelius --- setup.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/setup.py b/setup.py index 32d734b8..c484a269 100644 --- a/setup.py +++ b/setup.py @@ -1,6 +1,7 @@ from distutils.core import setup import cdist import os +import re def data_finder(data_dir): entries = [] @@ -10,6 +11,11 @@ def data_finder(data_dir): if name == ".gitignore": continue + # Skip vim swp files + swpfile = re.search(r'^\..*\.swp$', name) + if swpfile: + continue + entry = os.path.join(data_dir, name) if os.path.isdir(entry): entries.extend(data_finder(entry)) From 2dd2f5593f5c32f0a0286d1b5ded27a623ee7b22 Mon Sep 17 00:00:00 2001 From: Daniel Heule Date: Sun, 9 Feb 2014 17:10:43 +0100 Subject: [PATCH 56/60] bugfixes for issue 161 and FIXME: also check that there is no object ID when type is singleton? --- cdist/core/cdist_object.py | 5 ++++- cdist/test/cdist_object/__init__.py | 11 +++++++++++ 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/cdist/core/cdist_object.py b/cdist/core/cdist_object.py index b17bd339..e8c58a67 100644 --- a/cdist/core/cdist_object.py +++ b/cdist/core/cdist_object.py @@ -121,7 +121,8 @@ class CdistObject(object): return os.path.join(type_name, object_id) def validate_object_id(self): - # FIXME: also check that there is no object ID when type is singleton? + if self.cdist_type.is_singleton and self.object_id: + raise IllegalObjectIdError('singleton objects can\'t have a object_id') """Validate the given object_id and raise IllegalObjectIdError if it's not valid. """ @@ -130,6 +131,8 @@ class CdistObject(object): raise IllegalObjectIdError(self.object_id, 'object_id may not contain \'%s\'' % OBJECT_MARKER) if '//' in self.object_id: raise IllegalObjectIdError(self.object_id, 'object_id may not contain //') + if self.object_id == '.': + raise IllegalObjectIdError(self.object_id, 'object_id may not be a .') # If no object_id and type is not singleton => error out if not self.object_id and not self.cdist_type.is_singleton: diff --git a/cdist/test/cdist_object/__init__.py b/cdist/test/cdist_object/__init__.py index 0e2da103..7396bc57 100644 --- a/cdist/test/cdist_object/__init__.py +++ b/cdist/test/cdist_object/__init__.py @@ -94,6 +94,17 @@ class ObjectIdTestCase(test.CdistTestCase): core.CdistObject(cdist_type, object_base_path, illegal_object_id) # if we get here, the test passed + def test_object_id_contains_only_dot(self): + cdist_type = core.CdistType(type_base_path, '__third') + illegal_object_id = '.' + with self.assertRaises(core.IllegalObjectIdError): + core.CdistObject(cdist_type, object_base_path, illegal_object_id) + + def test_object_id_on_singleton_type(self): + cdist_type = core.CdistType(type_base_path, '__test_singleton') + illegal_object_id = 'object_id' + with self.assertRaises(core.IllegalObjectIdError): + core.CdistObject(cdist_type, object_base_path, illegal_object_id) class ObjectTestCase(test.CdistTestCase): From a5426ff4b5054561367b005d0c4a98536b1832d2 Mon Sep 17 00:00:00 2001 From: Daniel Heule Date: Sun, 9 Feb 2014 17:43:31 +0100 Subject: [PATCH 57/60] completed copyright infos ... --- cdist/test/cdist_object/__init__.py | 1 + 1 file changed, 1 insertion(+) diff --git a/cdist/test/cdist_object/__init__.py b/cdist/test/cdist_object/__init__.py index 7396bc57..28f2455b 100644 --- a/cdist/test/cdist_object/__init__.py +++ b/cdist/test/cdist_object/__init__.py @@ -2,6 +2,7 @@ # # 2010-2011 Steven Armstrong (steven-cdist at armstrong.cc) # 2012 Nico Schottelius (nico-cdist at schottelius.org) +# 2014 Daniel Heule (hda at sfs.biz) # # This file is part of cdist. # From b4373b91b345d19765ad8ea493c7f71ffa5f3526 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Mon, 10 Feb 2014 07:22:57 +0100 Subject: [PATCH 58/60] add document to describe the flow when installing Signed-off-by: Nico Schottelius --- docs/gfx/instalation-using-preos.odg | Bin 0 -> 15330 bytes 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 docs/gfx/instalation-using-preos.odg diff --git a/docs/gfx/instalation-using-preos.odg b/docs/gfx/instalation-using-preos.odg new file mode 100644 index 0000000000000000000000000000000000000000..6424bbc5f35165e4f10c26bd488bf9b667b0c028 GIT binary patch literal 15330 zcmd73Wq2IPvMnlE3>GspgGClIGc!Y5%*+fHGc#ID7Ff*8%*@OTPoDke&fI-xpLfpp z{@m!VtFx-LR#jz|GGj$Y$Vq~Lq5uIw0s(#bCMJ{xLf1nL1O)W^{c#A$($o^*;A#WV zx3RG>HPm-7wYH*nvNEEx*0(pcr?a*JSQ%LxI$8p(9O#Vg^leN`4ejOrAcTa3{Dbg= zj9@Sr#bG63#Tv!MGulEHvPWnZMrnke z&wfypDc?oZm)^#>`{(C-yQ?j8jZHHcn?OnW2x3#Qb8d1#dF!+E!0}3)16|z|v>5eW z)+J8$sXcKc6iydBl>FArzL^!_OgmEJUZ4yZ9 ze7*A#%iO0(r~9#CTyboPOwk!*v9q&*@EuBHfpW7vhs+7LxOOU{s19EGS9zaCZ3Q5l zJvh_I9z?())HZbQR-jphrGZ0+W~cB}WZct!a$2MGZjKT8nd-I^dQ!_hp26O)uVTI} zXj}sByt5ah#dG<^V|f~*3_QxuET!g=pDIe=h6QN>g0W_76|=E85;=A#uMvNfUTrDLP!v8;=vt7*Yy)jh7SyA_)j4^Z z>Oev4`)-88>>ilsQs$!nj2#NLCU;3|f^PS&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Date: Mon, 10 Feb 2014 07:32:58 +0100 Subject: [PATCH 59/60] ++changes Signed-off-by: Nico Schottelius --- docs/changelog | 3 +++ 1 file changed, 3 insertions(+) diff --git a/docs/changelog b/docs/changelog index 2bbe4edf..6aef1891 100644 --- a/docs/changelog +++ b/docs/changelog @@ -5,6 +5,9 @@ Changelog * Exception: No braces means author == Nico Schottelius +3.0.8: + * Core: Enhance object id verification (Daniel Heule) + 3.0.7: 2014-02-08 * Core: Allow dependencies to be created based execution order (Daniel Heule) * Core: Add tests for override (Daniel Heule) From 4efe8553da4ccf4ec58197bb1422eefa9713e908 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Mon, 10 Feb 2014 21:40:11 +0100 Subject: [PATCH 60/60] run apt-get clean before creating preos Signed-off-by: Nico Schottelius --- cdist/preos.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/cdist/preos.py b/cdist/preos.py index 347b0cba..ff157f5b 100644 --- a/cdist/preos.py +++ b/cdist/preos.py @@ -162,6 +162,10 @@ cp -L "$src" "$real_dst" fd.write(val) os.chmod(filename, stat.S_IRUSR | stat.S_IXUSR) + def remove_archives(self, base_dir): + cmd = [ "chroot", self.target_dir, "/usr/bin/apt-get", "clean" ] + subprocess.check_call(cmd) + def create_kernel(self): dst = os.path.join(self.out_dir, "kernel") srcglob = glob.glob("%s/boot/vmlinuz-*" % self.target_dir) @@ -270,6 +274,9 @@ cp -L "$src" "$real_dst" if args.config: self.config() + # Cleanup archives before creating any image + self.remove_archives() + # Output pxe files if args.pxe_boot_dir: self.create_pxe(args.pxe_boot_dir)