forked from ungleich-public/cdist
		
	Merge branch '__package_state_fix' of https://github.com/jdguffey/cdist
This commit is contained in:
		
				commit
				
					
						6eced94035
					
				
			
		
					 43 changed files with 113 additions and 50 deletions
				
			
		| 
						 | 
					@ -16,9 +16,7 @@ It dispatches the actual work to the package system dependant types.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
REQUIRED PARAMETERS
 | 
					REQUIRED PARAMETERS
 | 
				
			||||||
-------------------
 | 
					-------------------
 | 
				
			||||||
state::
 | 
					None
 | 
				
			||||||
    The state the package should be in, either "present" or "absent"
 | 
					 | 
				
			||||||
    (the old values "installed" or "removed" will be removed in cdist 2.1).
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
OPTIONAL PARAMETERS
 | 
					OPTIONAL PARAMETERS
 | 
				
			||||||
| 
						 | 
					@ -35,6 +33,10 @@ type::
 | 
				
			||||||
    e.g. __package_apt for Debian
 | 
					    e.g. __package_apt for Debian
 | 
				
			||||||
         __package_emerge for Gentoo
 | 
					         __package_emerge for Gentoo
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					state::
 | 
				
			||||||
 | 
					    The state the package should be in, either "present" or "absent"
 | 
				
			||||||
 | 
					    (the old values "installed" or "removed" will be removed in cdist 2.1).
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
EXAMPLES
 | 
					EXAMPLES
 | 
				
			||||||
--------
 | 
					--------
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -2,3 +2,4 @@ name
 | 
				
			||||||
version
 | 
					version
 | 
				
			||||||
type
 | 
					type
 | 
				
			||||||
pkgsite
 | 
					pkgsite
 | 
				
			||||||
 | 
					state
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1 +0,0 @@
 | 
				
			||||||
state
 | 
					 | 
				
			||||||
| 
						 | 
					@ -27,7 +27,11 @@ else
 | 
				
			||||||
   name="$__object_id"
 | 
					   name="$__object_id"
 | 
				
			||||||
fi
 | 
					fi
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					if [ -f "$__object/parameter/state" ]; then
 | 
				
			||||||
   state_should="$(cat "$__object/parameter/state")"
 | 
					   state_should="$(cat "$__object/parameter/state")"
 | 
				
			||||||
 | 
					else
 | 
				
			||||||
 | 
					   state_should="present"
 | 
				
			||||||
 | 
					fi
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# Correct pre 2.1 naming - FIXME in 2.1
 | 
					# Correct pre 2.1 naming - FIXME in 2.1
 | 
				
			||||||
case "$state_should" in
 | 
					case "$state_should" in
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -16,9 +16,7 @@ manage packages.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
REQUIRED PARAMETERS
 | 
					REQUIRED PARAMETERS
 | 
				
			||||||
-------------------
 | 
					-------------------
 | 
				
			||||||
state::
 | 
					None
 | 
				
			||||||
    The state the package should be in, either "present" or "absent"
 | 
					 | 
				
			||||||
    (the old values "installed" or "removed" will be removed in cdist 2.1).
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
OPTIONAL PARAMETERS
 | 
					OPTIONAL PARAMETERS
 | 
				
			||||||
| 
						 | 
					@ -26,6 +24,10 @@ OPTIONAL PARAMETERS
 | 
				
			||||||
name::
 | 
					name::
 | 
				
			||||||
   If supplied, use the name and not the object id as the package name.
 | 
					   If supplied, use the name and not the object id as the package name.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					state::
 | 
				
			||||||
 | 
					    The state the package should be in, either "present" or "absent"
 | 
				
			||||||
 | 
					    (the old values "installed" or "removed" will be removed in cdist 2.1).
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
EXAMPLES
 | 
					EXAMPLES
 | 
				
			||||||
--------
 | 
					--------
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1,2 +1,3 @@
 | 
				
			||||||
name
 | 
					name
 | 
				
			||||||
version
 | 
					version
 | 
				
			||||||
 | 
					state
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1 +0,0 @@
 | 
				
			||||||
state
 | 
					 | 
				
			||||||
| 
						 | 
					@ -29,7 +29,11 @@ else
 | 
				
			||||||
    name="$__object_id"
 | 
					    name="$__object_id"
 | 
				
			||||||
fi
 | 
					fi
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					if [ -f "$__object/parameter/state" ]; then
 | 
				
			||||||
   state_should="$(cat "$__object/parameter/state")"
 | 
					   state_should="$(cat "$__object/parameter/state")"
 | 
				
			||||||
 | 
					else
 | 
				
			||||||
 | 
					   state_should="present"
 | 
				
			||||||
 | 
					fi
 | 
				
			||||||
# Correct pre 2.1 naming - FIXME in 2.1
 | 
					# Correct pre 2.1 naming - FIXME in 2.1
 | 
				
			||||||
case "$state_should" in
 | 
					case "$state_should" in
 | 
				
			||||||
    installed)
 | 
					    installed)
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -15,9 +15,7 @@ LuaRocks is a deployment and management system for Lua modules.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
REQUIRED PARAMETERS
 | 
					REQUIRED PARAMETERS
 | 
				
			||||||
-------------------
 | 
					-------------------
 | 
				
			||||||
state::
 | 
					None
 | 
				
			||||||
    The state the package should be in, either "present" or "absent"
 | 
					 | 
				
			||||||
    (the old values "installed" or "removed" will be removed in cdist 2.1).
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
OPTIONAL PARAMETERS
 | 
					OPTIONAL PARAMETERS
 | 
				
			||||||
| 
						 | 
					@ -25,6 +23,10 @@ OPTIONAL PARAMETERS
 | 
				
			||||||
name::
 | 
					name::
 | 
				
			||||||
    If supplied, use the name and not the object id as the package name.
 | 
					    If supplied, use the name and not the object id as the package name.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					state::
 | 
				
			||||||
 | 
					    The state the package should be in, either "present" or "absent"
 | 
				
			||||||
 | 
					    (the old values "installed" or "removed" will be removed in cdist 2.1).
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
EXAMPLES
 | 
					EXAMPLES
 | 
				
			||||||
--------
 | 
					--------
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1 +1,2 @@
 | 
				
			||||||
name
 | 
					name
 | 
				
			||||||
 | 
					state
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1 +0,0 @@
 | 
				
			||||||
state
 | 
					 | 
				
			||||||
| 
						 | 
					@ -28,7 +28,12 @@ else
 | 
				
			||||||
   name="$__object_id"
 | 
					   name="$__object_id"
 | 
				
			||||||
fi
 | 
					fi
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					if [ -f "$__object/parameter/state" ]; then
 | 
				
			||||||
   state_should="$(cat "$__object/parameter/state")"
 | 
					   state_should="$(cat "$__object/parameter/state")"
 | 
				
			||||||
 | 
					else
 | 
				
			||||||
 | 
					   state_should="present"
 | 
				
			||||||
 | 
					fi
 | 
				
			||||||
 | 
					
 | 
				
			||||||
state_is="$(cat "$__object/explorer/pkg_status")"
 | 
					state_is="$(cat "$__object/explorer/pkg_status")"
 | 
				
			||||||
case "$state_is" in
 | 
					case "$state_is" in
 | 
				
			||||||
    absent*)
 | 
					    absent*)
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -15,8 +15,7 @@ opkg is usually used on OpenWRT to manage packages.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
REQUIRED PARAMETERS
 | 
					REQUIRED PARAMETERS
 | 
				
			||||||
-------------------
 | 
					-------------------
 | 
				
			||||||
state::
 | 
					None
 | 
				
			||||||
   The state the package should be in, either "present" or "absent"
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
OPTIONAL PARAMETERS
 | 
					OPTIONAL PARAMETERS
 | 
				
			||||||
| 
						 | 
					@ -24,6 +23,9 @@ OPTIONAL PARAMETERS
 | 
				
			||||||
name::
 | 
					name::
 | 
				
			||||||
   If supplied, use the name and not the object id as the package name.
 | 
					   If supplied, use the name and not the object id as the package name.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					state::
 | 
				
			||||||
 | 
					   The state the package should be in, either "present" or "absent"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
EXAMPLES
 | 
					EXAMPLES
 | 
				
			||||||
--------
 | 
					--------
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1 +1,2 @@
 | 
				
			||||||
name
 | 
					name
 | 
				
			||||||
 | 
					state
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1 +0,0 @@
 | 
				
			||||||
state
 | 
					 | 
				
			||||||
| 
						 | 
					@ -31,7 +31,11 @@ else
 | 
				
			||||||
   name="$__object_id"
 | 
					   name="$__object_id"
 | 
				
			||||||
fi
 | 
					fi
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					if [ -f "$__object/parameter/state" ]; then
 | 
				
			||||||
   state_should="$(cat "$__object/parameter/state")"
 | 
					   state_should="$(cat "$__object/parameter/state")"
 | 
				
			||||||
 | 
					else
 | 
				
			||||||
 | 
					   state_should="present"
 | 
				
			||||||
 | 
					fi
 | 
				
			||||||
case "$state_should" in
 | 
					case "$state_should" in
 | 
				
			||||||
    installed)
 | 
					    installed)
 | 
				
			||||||
        echo "WARNING:  ${__object_name}: $state_should is deprecated and will be removed in cdist 2.1. Please change to present/absent." >&2       
 | 
					        echo "WARNING:  ${__object_name}: $state_should is deprecated and will be removed in cdist 2.1. Please change to present/absent." >&2       
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -16,9 +16,7 @@ packages.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
REQUIRED PARAMETERS
 | 
					REQUIRED PARAMETERS
 | 
				
			||||||
-------------------
 | 
					-------------------
 | 
				
			||||||
state::
 | 
					None
 | 
				
			||||||
    The state the package should be in, either "present" or "absent"
 | 
					 | 
				
			||||||
    (the old values "installed" or "removed" will be removed in cdist 2.1).
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
OPTIONAL PARAMETERS
 | 
					OPTIONAL PARAMETERS
 | 
				
			||||||
| 
						 | 
					@ -26,6 +24,10 @@ OPTIONAL PARAMETERS
 | 
				
			||||||
name::
 | 
					name::
 | 
				
			||||||
    If supplied, use the name and not the object id as the package name.
 | 
					    If supplied, use the name and not the object id as the package name.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					state::
 | 
				
			||||||
 | 
					    The state the package should be in, either "present" or "absent"
 | 
				
			||||||
 | 
					    (the old values "installed" or "removed" will be removed in cdist 2.1).
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
EXAMPLES
 | 
					EXAMPLES
 | 
				
			||||||
--------
 | 
					--------
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1 +1,2 @@
 | 
				
			||||||
name
 | 
					name
 | 
				
			||||||
 | 
					state
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1 +0,0 @@
 | 
				
			||||||
state
 | 
					 | 
				
			||||||
| 
						 | 
					@ -22,7 +22,11 @@
 | 
				
			||||||
#
 | 
					#
 | 
				
			||||||
 | 
					
 | 
				
			||||||
state_is=$(cat "$__object/explorer/state")
 | 
					state_is=$(cat "$__object/explorer/state")
 | 
				
			||||||
state_should=$(cat "$__object/parameter/state")
 | 
					if [ -f "$__object/parameter/state" ]; then
 | 
				
			||||||
 | 
					   state_should="$(cat "$__object/parameter/state")"
 | 
				
			||||||
 | 
					else
 | 
				
			||||||
 | 
					   state_should="present"
 | 
				
			||||||
 | 
					fi
 | 
				
			||||||
 | 
					
 | 
				
			||||||
[ "$state_is" = "$state_should" ] && exit 0
 | 
					[ "$state_is" = "$state_should" ] && exit 0
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -16,8 +16,7 @@ It is also included in the python virtualenv environment.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
REQUIRED PARAMETERS
 | 
					REQUIRED PARAMETERS
 | 
				
			||||||
-------------------
 | 
					-------------------
 | 
				
			||||||
state::
 | 
					None
 | 
				
			||||||
   Either "present" or "absent".
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
OPTIONAL PARAMETERS
 | 
					OPTIONAL PARAMETERS
 | 
				
			||||||
| 
						 | 
					@ -28,6 +27,9 @@ name::
 | 
				
			||||||
pip::
 | 
					pip::
 | 
				
			||||||
    Instead of using pip from PATH, use the specific pip path.
 | 
					    Instead of using pip from PATH, use the specific pip path.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					state::
 | 
				
			||||||
 | 
					   Either "present" or "absent".
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
EXAMPLES
 | 
					EXAMPLES
 | 
				
			||||||
--------
 | 
					--------
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1 +1,2 @@
 | 
				
			||||||
pip
 | 
					pip
 | 
				
			||||||
 | 
					state
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1 +0,0 @@
 | 
				
			||||||
state
 | 
					 | 
				
			||||||
| 
						 | 
					@ -63,7 +63,11 @@ if [ -f "$__object/parameter/pkgsite" ]; then
 | 
				
			||||||
	pkgsite="$(cat "$__object/parameter/pkgsite")"
 | 
						pkgsite="$(cat "$__object/parameter/pkgsite")"
 | 
				
			||||||
fi
 | 
					fi
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					if [ -f "$__object/parameter/state" ]; then
 | 
				
			||||||
   state="$(cat "$__object/parameter/state")"
 | 
					   state="$(cat "$__object/parameter/state")"
 | 
				
			||||||
 | 
					else
 | 
				
			||||||
 | 
					   state="present"
 | 
				
			||||||
 | 
					fi
 | 
				
			||||||
curr_version="$(cat "$__object/explorer/pkg_version")"
 | 
					curr_version="$(cat "$__object/explorer/pkg_version")"
 | 
				
			||||||
add_cmd="pkg_add"
 | 
					add_cmd="pkg_add"
 | 
				
			||||||
rm_cmd="pkg_delete"
 | 
					rm_cmd="pkg_delete"
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -15,8 +15,7 @@ This type is usually used on FreeBSD to manage packages.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
REQUIRED PARAMETERS
 | 
					REQUIRED PARAMETERS
 | 
				
			||||||
-------------------
 | 
					-------------------
 | 
				
			||||||
state::
 | 
					None
 | 
				
			||||||
   Either "present" or "absent".
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
OPTIONAL PARAMETERS
 | 
					OPTIONAL PARAMETERS
 | 
				
			||||||
| 
						 | 
					@ -33,6 +32,9 @@ version::
 | 
				
			||||||
pkgsite::
 | 
					pkgsite::
 | 
				
			||||||
   If supplied, use to install from a specific package repository.
 | 
					   If supplied, use to install from a specific package repository.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					state::
 | 
				
			||||||
 | 
					   Either "present" or "absent".
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
EXAMPLES
 | 
					EXAMPLES
 | 
				
			||||||
--------
 | 
					--------
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -2,3 +2,4 @@ name
 | 
				
			||||||
flavor
 | 
					flavor
 | 
				
			||||||
version
 | 
					version
 | 
				
			||||||
pkgsite
 | 
					pkgsite
 | 
				
			||||||
 | 
					state
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1 +0,0 @@
 | 
				
			||||||
state
 | 
					 | 
				
			||||||
| 
						 | 
					@ -42,7 +42,11 @@ else
 | 
				
			||||||
   name="$__object_id"
 | 
					   name="$__object_id"
 | 
				
			||||||
fi
 | 
					fi
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					if [ -f "$__object/parameter/state" ]; then
 | 
				
			||||||
   state_should="$(cat "$__object/parameter/state")"
 | 
					   state_should="$(cat "$__object/parameter/state")"
 | 
				
			||||||
 | 
					else
 | 
				
			||||||
 | 
					   state_should="present"
 | 
				
			||||||
 | 
					fi
 | 
				
			||||||
# Correct pre 2.1 naming - FIXME in 2.1
 | 
					# Correct pre 2.1 naming - FIXME in 2.1
 | 
				
			||||||
case "$state_should" in
 | 
					case "$state_should" in
 | 
				
			||||||
    installed)
 | 
					    installed)
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -15,9 +15,7 @@ This type is usually used on OpenBSD to manage packages.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
REQUIRED PARAMETERS
 | 
					REQUIRED PARAMETERS
 | 
				
			||||||
-------------------
 | 
					-------------------
 | 
				
			||||||
state::
 | 
					None
 | 
				
			||||||
    The state the package should be in, either "present" or "absent"
 | 
					 | 
				
			||||||
    (the old values "installed" or "removed" will be removed in cdist 2.1).
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
OPTIONAL PARAMETERS
 | 
					OPTIONAL PARAMETERS
 | 
				
			||||||
| 
						 | 
					@ -28,6 +26,10 @@ name::
 | 
				
			||||||
flavor::
 | 
					flavor::
 | 
				
			||||||
    If supplied, use to avoid ambiguity.
 | 
					    If supplied, use to avoid ambiguity.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					state::
 | 
				
			||||||
 | 
					    The state the package should be in, either "present" or "absent"
 | 
				
			||||||
 | 
					    (the old values "installed" or "removed" will be removed in cdist 2.1).
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
EXAMPLES
 | 
					EXAMPLES
 | 
				
			||||||
--------
 | 
					--------
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1,2 +1,3 @@
 | 
				
			||||||
name
 | 
					name
 | 
				
			||||||
flavor
 | 
					flavor
 | 
				
			||||||
 | 
					state
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1 +0,0 @@
 | 
				
			||||||
state
 | 
					 | 
				
			||||||
| 
						 | 
					@ -27,7 +27,11 @@ else
 | 
				
			||||||
    name="$__object_id"
 | 
					    name="$__object_id"
 | 
				
			||||||
fi
 | 
					fi
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					if [ -f "$__object/parameter/state" ]; then
 | 
				
			||||||
   state_should="$(cat "$__object/parameter/state")"
 | 
					   state_should="$(cat "$__object/parameter/state")"
 | 
				
			||||||
 | 
					else
 | 
				
			||||||
 | 
					   state_should="present"
 | 
				
			||||||
 | 
					fi
 | 
				
			||||||
# Correct pre 2.1 naming - FIXME in 2.1
 | 
					# Correct pre 2.1 naming - FIXME in 2.1
 | 
				
			||||||
case "$state_should" in
 | 
					case "$state_should" in
 | 
				
			||||||
    installed)
 | 
					    installed)
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -15,9 +15,7 @@ Rubygems is the default package management system for the Ruby programming langu
 | 
				
			||||||
 | 
					
 | 
				
			||||||
REQUIRED PARAMETERS
 | 
					REQUIRED PARAMETERS
 | 
				
			||||||
-------------------
 | 
					-------------------
 | 
				
			||||||
state::
 | 
					None
 | 
				
			||||||
    The state the package should be in, either "present" or "absent"
 | 
					 | 
				
			||||||
    (the old values "installed" or "removed" will be removed in cdist 2.1).
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
OPTIONAL PARAMETERS
 | 
					OPTIONAL PARAMETERS
 | 
				
			||||||
| 
						 | 
					@ -25,6 +23,10 @@ OPTIONAL PARAMETERS
 | 
				
			||||||
name::
 | 
					name::
 | 
				
			||||||
    If supplied, use the name and not the object id as the package name.
 | 
					    If supplied, use the name and not the object id as the package name.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					state::
 | 
				
			||||||
 | 
					    The state the package should be in, either "present" or "absent"
 | 
				
			||||||
 | 
					    (the old values "installed" or "removed" will be removed in cdist 2.1).
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
EXAMPLES
 | 
					EXAMPLES
 | 
				
			||||||
--------
 | 
					--------
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1 +1,2 @@
 | 
				
			||||||
name
 | 
					name
 | 
				
			||||||
 | 
					state
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1 +0,0 @@
 | 
				
			||||||
state
 | 
					 | 
				
			||||||
| 
						 | 
					@ -27,7 +27,11 @@ else
 | 
				
			||||||
   name="$__object_id"
 | 
					   name="$__object_id"
 | 
				
			||||||
fi
 | 
					fi
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					if [ -f "$__object/parameter/state" ]; then
 | 
				
			||||||
   state_should="$(cat "$__object/parameter/state")"
 | 
					   state_should="$(cat "$__object/parameter/state")"
 | 
				
			||||||
 | 
					else
 | 
				
			||||||
 | 
					   state_should="present"
 | 
				
			||||||
 | 
					fi
 | 
				
			||||||
case "$state_should" in
 | 
					case "$state_should" in
 | 
				
			||||||
    installed)
 | 
					    installed)
 | 
				
			||||||
        echo "WARNING:  ${__object_name}: $state_should is deprecated and will be removed in cdist 2.1. Please change to present/absent." >&2       
 | 
					        echo "WARNING:  ${__object_name}: $state_should is deprecated and will be removed in cdist 2.1. Please change to present/absent." >&2       
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -17,9 +17,7 @@ slightly confusing error message "Error: Nothing to do".
 | 
				
			||||||
 | 
					
 | 
				
			||||||
REQUIRED PARAMETERS
 | 
					REQUIRED PARAMETERS
 | 
				
			||||||
-------------------
 | 
					-------------------
 | 
				
			||||||
state::
 | 
					None
 | 
				
			||||||
    The state the package should be in, either "present" or "absent"
 | 
					 | 
				
			||||||
    (the old values "installed" or "removed" will be removed in cdist 2.1).
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
OPTIONAL PARAMETERS
 | 
					OPTIONAL PARAMETERS
 | 
				
			||||||
| 
						 | 
					@ -27,6 +25,10 @@ OPTIONAL PARAMETERS
 | 
				
			||||||
name::
 | 
					name::
 | 
				
			||||||
    If supplied, use the name and not the object id as the package name.
 | 
					    If supplied, use the name and not the object id as the package name.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					state::
 | 
				
			||||||
 | 
					    The state the package should be in, either "present" or "absent"
 | 
				
			||||||
 | 
					    (the old values "installed" or "removed" will be removed in cdist 2.1).
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
EXAMPLES
 | 
					EXAMPLES
 | 
				
			||||||
--------
 | 
					--------
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1 +1,2 @@
 | 
				
			||||||
name
 | 
					name
 | 
				
			||||||
 | 
					state
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1 +0,0 @@
 | 
				
			||||||
state
 | 
					 | 
				
			||||||
| 
						 | 
					@ -33,7 +33,11 @@ else
 | 
				
			||||||
   name="$__object_id"
 | 
					   name="$__object_id"
 | 
				
			||||||
fi
 | 
					fi
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					if [ -f "$__object/parameter/state" ]; then
 | 
				
			||||||
   state_should="$(cat "$__object/parameter/state")"
 | 
					   state_should="$(cat "$__object/parameter/state")"
 | 
				
			||||||
 | 
					else
 | 
				
			||||||
 | 
					   state_should="present"
 | 
				
			||||||
 | 
					fi
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# Exit if nothing is needed to be done
 | 
					# Exit if nothing is needed to be done
 | 
				
			||||||
[ "$state_is" = "$state_should" ] && exit 0
 | 
					[ "$state_is" = "$state_should" ] && exit 0
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -15,8 +15,7 @@ Zypper is usually used on the SuSE distribution to manage packages.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
REQUIRED PARAMETERS
 | 
					REQUIRED PARAMETERS
 | 
				
			||||||
-------------------
 | 
					-------------------
 | 
				
			||||||
state::
 | 
					None
 | 
				
			||||||
    The state the package should be in, either "present" or "absent"
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
OPTIONAL PARAMETERS
 | 
					OPTIONAL PARAMETERS
 | 
				
			||||||
| 
						 | 
					@ -24,6 +23,9 @@ OPTIONAL PARAMETERS
 | 
				
			||||||
name::
 | 
					name::
 | 
				
			||||||
    If supplied, use the name and not the object id as the package name.
 | 
					    If supplied, use the name and not the object id as the package name.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					state::
 | 
				
			||||||
 | 
					    The state the package should be in, either "present" or "absent"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
EXAMPLES
 | 
					EXAMPLES
 | 
				
			||||||
--------
 | 
					--------
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1 +1,2 @@
 | 
				
			||||||
name
 | 
					name
 | 
				
			||||||
 | 
					state
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1 +0,0 @@
 | 
				
			||||||
state
 | 
					 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue