forked from ungleich-public/cdist
		
	remove installed/removed state parameters (2.1 cleanup)
Signed-off-by: Nico Schottelius <nico@brief.schottelius.org>
This commit is contained in:
		
					parent
					
						
							
								9fbdfda302
							
						
					
				
			
			
				commit
				
					
						1b80f2806b
					
				
			
		
					 17 changed files with 6 additions and 91 deletions
				
			
		| 
						 | 
				
			
			@ -18,7 +18,6 @@ REQUIRED PARAMETERS
 | 
			
		|||
-------------------
 | 
			
		||||
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).
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
OPTIONAL PARAMETERS
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -29,18 +29,6 @@ fi
 | 
			
		|||
 | 
			
		||||
state_should="$(cat "$__object/parameter/state")"
 | 
			
		||||
 | 
			
		||||
# Correct pre 2.1 naming - FIXME in 2.1
 | 
			
		||||
case "$state_should" in
 | 
			
		||||
    installed)
 | 
			
		||||
        echo "WARNING:  ${__object_name}: $state_should is deprecated and will be removed in cdist 2.1. Please change to present/absent." >&2
 | 
			
		||||
        state_should="present"
 | 
			
		||||
    ;;
 | 
			
		||||
    removed)
 | 
			
		||||
        echo "WARNING:  ${__object_name}: $state_should is deprecated and will be removed in cdist 2.1. Please change to present/absent." >&2
 | 
			
		||||
        state_should="absent"
 | 
			
		||||
    ;;
 | 
			
		||||
esac
 | 
			
		||||
 | 
			
		||||
# FIXME: use grep directly, state is a list, not a line!
 | 
			
		||||
state_is="$(cat "$__object/explorer/state")"
 | 
			
		||||
case "$state_is" in
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -18,7 +18,6 @@ REQUIRED PARAMETERS
 | 
			
		|||
-------------------
 | 
			
		||||
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).
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
OPTIONAL PARAMETERS
 | 
			
		||||
| 
						 | 
				
			
			@ -50,5 +49,5 @@ SEE ALSO
 | 
			
		|||
 | 
			
		||||
COPYING
 | 
			
		||||
-------
 | 
			
		||||
Copyright \(C) 2011 Nico Schottelius. Free use of this software is
 | 
			
		||||
Copyright \(C) 2011-2012 Nico Schottelius. Free use of this software is
 | 
			
		||||
granted under the terms of the GNU General Public License version 3 (GPLv3).
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -30,18 +30,6 @@ else
 | 
			
		|||
fi
 | 
			
		||||
 | 
			
		||||
state_should="$(cat "$__object/parameter/state")"
 | 
			
		||||
# Correct pre 2.1 naming - FIXME in 2.1
 | 
			
		||||
case "$state_should" in
 | 
			
		||||
    installed)
 | 
			
		||||
        echo "WARNING:  ${__object_name}: $state_should is deprecated and will be removed in cdist 2.1. Please change to present/absent." >&2
 | 
			
		||||
        state_should="present"
 | 
			
		||||
    ;;
 | 
			
		||||
    removed)
 | 
			
		||||
        echo "WARNING:  ${__object_name}: $state_should is deprecated and will be removed in cdist 2.1. Please change to present/absent." >&2
 | 
			
		||||
        state_should="absent"
 | 
			
		||||
    ;;
 | 
			
		||||
esac
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
if grep -q "(installed)" "$__object/explorer/pkg_status"; then
 | 
			
		||||
    state_is="present"
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -17,7 +17,6 @@ REQUIRED PARAMETERS
 | 
			
		|||
-------------------
 | 
			
		||||
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).
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
OPTIONAL PARAMETERS
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -54,4 +54,3 @@ if [ "$state_is" != "$state_should" ]; then
 | 
			
		|||
      ;;
 | 
			
		||||
   esac
 | 
			
		||||
fi
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -32,16 +32,6 @@ else
 | 
			
		|||
fi
 | 
			
		||||
 | 
			
		||||
state_should="$(cat "$__object/parameter/state")"
 | 
			
		||||
case "$state_should" in
 | 
			
		||||
    installed)
 | 
			
		||||
        echo "WARNING:  ${__object_name}: $state_should is deprecated and will be removed in cdist 2.1. Please change to present/absent." >&2       
 | 
			
		||||
        state_should="present"
 | 
			
		||||
    ;;  
 | 
			
		||||
    removed)
 | 
			
		||||
        echo "WARNING:  ${__object_name}: $state_should is deprecated and will be removed in cdist 2.1. Please change to present/absent." >&2       
 | 
			
		||||
        state_should="absent"
 | 
			
		||||
    ;;  
 | 
			
		||||
esac
 | 
			
		||||
 | 
			
		||||
pkg_version="$(cat "$__object/explorer/pkg_version")"
 | 
			
		||||
if [ -z "$pkg_version" ]; then
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -18,7 +18,6 @@ REQUIRED PARAMETERS
 | 
			
		|||
-------------------
 | 
			
		||||
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).
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
OPTIONAL PARAMETERS
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -133,4 +133,3 @@ fi
 | 
			
		|||
 | 
			
		||||
# Debug
 | 
			
		||||
#set +x
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -39,16 +39,16 @@ EXAMPLES
 | 
			
		|||
 | 
			
		||||
--------------------------------------------------------------------------------
 | 
			
		||||
# Ensure zsh is installed
 | 
			
		||||
__package_pkg_freebsd zsh --state installed
 | 
			
		||||
__package_pkg_freebsd zsh --state present
 | 
			
		||||
 | 
			
		||||
# Ensure vim is installed, use flavor no_x11
 | 
			
		||||
__package_pkg_freebsd vim --state installed --flavor no_x11
 | 
			
		||||
__package_pkg_freebsd vim --state present --flavor no_x11
 | 
			
		||||
 | 
			
		||||
# If you don't want to follow pythonX packages, but always use python
 | 
			
		||||
__package_pkg_freebsd python --state installed --name python2
 | 
			
		||||
__package_pkg_freebsd python --state present --name python2
 | 
			
		||||
 | 
			
		||||
# Remove obsolete package
 | 
			
		||||
__package_pkg_freebsd puppet --state removed
 | 
			
		||||
__package_pkg_freebsd puppet --state absent
 | 
			
		||||
--------------------------------------------------------------------------------
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -43,17 +43,6 @@ else
 | 
			
		|||
fi
 | 
			
		||||
 | 
			
		||||
state_should="$(cat "$__object/parameter/state")"
 | 
			
		||||
# Correct pre 2.1 naming - FIXME in 2.1
 | 
			
		||||
case "$state_should" in
 | 
			
		||||
    installed)
 | 
			
		||||
        echo "WARNING:  ${__object_name}: $state_should is deprecated and will be removed in cdist 2.1. Please change to present/absent." >&2
 | 
			
		||||
        state_should="present"
 | 
			
		||||
    ;;
 | 
			
		||||
    removed)
 | 
			
		||||
        echo "WARNING:  ${__object_name}: $state_should is deprecated and will be removed in cdist 2.1. Please change to present/absent." >&2
 | 
			
		||||
        state_should="absent"
 | 
			
		||||
    ;;
 | 
			
		||||
esac
 | 
			
		||||
 | 
			
		||||
pkg_version="$(cat "$__object/explorer/pkg_version")"
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -17,7 +17,6 @@ REQUIRED PARAMETERS
 | 
			
		|||
-------------------
 | 
			
		||||
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).
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
OPTIONAL PARAMETERS
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -28,17 +28,6 @@ else
 | 
			
		|||
fi
 | 
			
		||||
 | 
			
		||||
state_should="$(cat "$__object/parameter/state")"
 | 
			
		||||
# Correct pre 2.1 naming - FIXME in 2.1
 | 
			
		||||
case "$state_should" in
 | 
			
		||||
    installed)
 | 
			
		||||
        echo "WARNING:  ${__object_name}: $state_should is deprecated and will be removed in cdist 2.1. Please change to present/absent." >&2
 | 
			
		||||
        state_should="present"
 | 
			
		||||
    ;;
 | 
			
		||||
    removed)
 | 
			
		||||
        echo "WARNING:  ${__object_name}: $state_should is deprecated and will be removed in cdist 2.1. Please change to present/absent." >&2
 | 
			
		||||
        state_should="absent"
 | 
			
		||||
    ;;
 | 
			
		||||
esac
 | 
			
		||||
 | 
			
		||||
if grep -q true "$__object/explorer/pkg_status"; then
 | 
			
		||||
    state_is="present"
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -17,7 +17,6 @@ REQUIRED PARAMETERS
 | 
			
		|||
-------------------
 | 
			
		||||
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).
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
OPTIONAL PARAMETERS
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -28,16 +28,6 @@ else
 | 
			
		|||
fi
 | 
			
		||||
 | 
			
		||||
state_should="$(cat "$__object/parameter/state")"
 | 
			
		||||
case "$state_should" in
 | 
			
		||||
    installed)
 | 
			
		||||
        echo "WARNING:  ${__object_name}: $state_should is deprecated and will be removed in cdist 2.1. Please change to present/absent." >&2       
 | 
			
		||||
        state_should="present"
 | 
			
		||||
    ;;
 | 
			
		||||
    removed)
 | 
			
		||||
        echo "WARNING:  ${__object_name}: $state_should is deprecated and will be removed in cdist 2.1. Please change to present/absent." >&2       
 | 
			
		||||
        state_should="absent"
 | 
			
		||||
    ;;
 | 
			
		||||
esac
 | 
			
		||||
 | 
			
		||||
if grep -q -E "(centos|redhat|amazon)" "$__global/explorer/os"; then
 | 
			
		||||
    opts="-y --quiet"
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -19,7 +19,6 @@ REQUIRED PARAMETERS
 | 
			
		|||
-------------------
 | 
			
		||||
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).
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
OPTIONAL PARAMETERS
 | 
			
		||||
| 
						 | 
				
			
			@ -51,5 +50,5 @@ SEE ALSO
 | 
			
		|||
 | 
			
		||||
COPYING
 | 
			
		||||
-------
 | 
			
		||||
Copyright \(C) 2011 Nico Schottelius. Free use of this software is
 | 
			
		||||
Copyright \(C) 2011-2012 Nico Schottelius. Free use of this software is
 | 
			
		||||
granted under the terms of the GNU General Public License version 3 (GPLv3).
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -26,16 +26,6 @@ else
 | 
			
		|||
fi
 | 
			
		||||
 | 
			
		||||
state_should="$(cat "$__object/parameter/state")"
 | 
			
		||||
case "$state_should" in
 | 
			
		||||
    running)
 | 
			
		||||
        echo "WARNING:  ${__object_name}: $state_should is deprecated and will be removed in cdist 2.1. Please change to present/absent." >&2       
 | 
			
		||||
        state_should="present"
 | 
			
		||||
    ;;  
 | 
			
		||||
    stopped)
 | 
			
		||||
        echo "WARNING:  ${__object_name}: $state_should is deprecated and will be removed in cdist 2.1. Please change to present/absent." >&2       
 | 
			
		||||
        state_should="absent"
 | 
			
		||||
    ;;  
 | 
			
		||||
esac
 | 
			
		||||
 | 
			
		||||
runs="$(cat "$__object/explorer/runs")"
 | 
			
		||||
if [ "$runs" ]; then
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue