forked from ungleich-public/cdist
		
	Merge branch 'master' of https://github.com/telmich/cdist into bugfix_type__key_value
Conflicts: cdist/conf/type/__key_value/gencode-remote
This commit is contained in:
		
				commit
				
					
						a94de8fae4
					
				
			
		
					 9 changed files with 35 additions and 20 deletions
				
			
		| 
						 | 
					@ -25,7 +25,7 @@ destination="/$__object_id"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
os=$("$__explorer/os")
 | 
					os=$("$__explorer/os")
 | 
				
			||||||
case "$os" in
 | 
					case "$os" in
 | 
				
			||||||
   "freebsd")
 | 
					   "freebsd"|"openbsd")
 | 
				
			||||||
      # FIXME: should be something like this based on man page, but can not test
 | 
					      # FIXME: should be something like this based on man page, but can not test
 | 
				
			||||||
      stat -f "type: %ST
 | 
					      stat -f "type: %ST
 | 
				
			||||||
owner: %Du %Su
 | 
					owner: %Du %Su
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -41,7 +41,7 @@ __iptables_rule established  --rule "-A INPUT -m state --state RELATED,ESTABLISH
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# Some service rules
 | 
					# Some service rules
 | 
				
			||||||
__iptables_rule http  --rule "-A INPUT -p tcp --dport 80 -j ACCEPT"
 | 
					__iptables_rule http  --rule "-A INPUT -p tcp --dport 80 -j ACCEPT"
 | 
				
			||||||
__iptables_rule ssh   --rule "-A INPUT -p tcp --dport 80 -j ACCEPT"
 | 
					__iptables_rule ssh   --rule "-A INPUT -p tcp --dport 22 -j ACCEPT"
 | 
				
			||||||
__iptables_rule https --rule "-A INPUT -p tcp --dport 443 -j ACCEPT"
 | 
					__iptables_rule https --rule "-A INPUT -p tcp --dport 443 -j ACCEPT"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# Ensure some rules are not present anymore
 | 
					# Ensure some rules are not present anymore
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1,7 +1,7 @@
 | 
				
			||||||
#!/bin/sh
 | 
					#!/bin/sh
 | 
				
			||||||
#
 | 
					#
 | 
				
			||||||
# 2011 Steven Armstrong (steven-cdist at armstrong.cc)
 | 
					# 2011 Steven Armstrong (steven-cdist at armstrong.cc)
 | 
				
			||||||
# 2012 Nico Schottelius (nico-cdist at schottelius.org)
 | 
					# 2012-2014 Nico Schottelius (nico-cdist at schottelius.org)
 | 
				
			||||||
# 2014 Daniel Heule     (hda at sfs.biz)
 | 
					# 2014 Daniel Heule     (hda at sfs.biz)
 | 
				
			||||||
#
 | 
					#
 | 
				
			||||||
# This file is part of cdist.
 | 
					# This file is part of cdist.
 | 
				
			||||||
| 
						 | 
					@ -19,7 +19,6 @@
 | 
				
			||||||
# You should have received a copy of the GNU General Public License
 | 
					# You should have received a copy of the GNU General Public License
 | 
				
			||||||
# along with cdist. If not, see <http://www.gnu.org/licenses/>.
 | 
					# along with cdist. If not, see <http://www.gnu.org/licenses/>.
 | 
				
			||||||
#
 | 
					#
 | 
				
			||||||
#set -x
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
state_should="$(cat "$__object/parameter/state")"
 | 
					state_should="$(cat "$__object/parameter/state")"
 | 
				
			||||||
| 
						 | 
					@ -48,7 +47,7 @@ case "$state_should" in
 | 
				
			||||||
                # nothing to do
 | 
					                # nothing to do
 | 
				
			||||||
            ;;
 | 
					            ;;
 | 
				
			||||||
            wrongformat|wrongvalue|present)
 | 
					            wrongformat|wrongvalue|present)
 | 
				
			||||||
                echo removed >> "$__messages_out"
 | 
					                echo "remove" >> "$__messages_out"
 | 
				
			||||||
            ;;
 | 
					            ;;
 | 
				
			||||||
            *)
 | 
					            *)
 | 
				
			||||||
                echo "Unknown explorer state: $state_is" >&2
 | 
					                echo "Unknown explorer state: $state_is" >&2
 | 
				
			||||||
| 
						 | 
					@ -59,13 +58,13 @@ case "$state_should" in
 | 
				
			||||||
    present)
 | 
					    present)
 | 
				
			||||||
        case "$state_is" in
 | 
					        case "$state_is" in
 | 
				
			||||||
            nosuchfile)
 | 
					            nosuchfile)
 | 
				
			||||||
                echo created >> "$__messages_out"
 | 
					                echo "create" >> "$__messages_out"
 | 
				
			||||||
            ;;
 | 
					            ;;
 | 
				
			||||||
            absent)
 | 
					            absent)
 | 
				
			||||||
                echo inserted >> "$__messages_out"
 | 
					                echo "insert" >> "$__messages_out"
 | 
				
			||||||
            ;;
 | 
					            ;;
 | 
				
			||||||
            wrongformated|wrongvalue)
 | 
					            wrongformated|wrongvalue)
 | 
				
			||||||
                echo changed >> "$__messages_out"
 | 
					                echo "change" >> "$__messages_out"
 | 
				
			||||||
            ;;
 | 
					            ;;
 | 
				
			||||||
            present)
 | 
					            present)
 | 
				
			||||||
                # nothing to do
 | 
					                # nothing to do
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -47,13 +47,13 @@ exact_delimiter::
 | 
				
			||||||
 | 
					
 | 
				
			||||||
MESSAGES
 | 
					MESSAGES
 | 
				
			||||||
--------
 | 
					--------
 | 
				
			||||||
removed::
 | 
					remove::
 | 
				
			||||||
    Line with key was removed
 | 
					    Removed existing key and value
 | 
				
			||||||
inserted::
 | 
					insert::
 | 
				
			||||||
    A new line was inserted
 | 
					    Added key and value
 | 
				
			||||||
changed::
 | 
					change::
 | 
				
			||||||
    An existing line was changed
 | 
					    Changed value of existing key
 | 
				
			||||||
created::
 | 
					create::
 | 
				
			||||||
    A new line was inserted in a new file
 | 
					    A new line was inserted in a new file
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -50,8 +50,11 @@ fi
 | 
				
			||||||
 | 
					
 | 
				
			||||||
pkg_version="$(cat "$__object/explorer/pkg_version")"
 | 
					pkg_version="$(cat "$__object/explorer/pkg_version")"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# TODO: Shouldn't be hardcoded
 | 
					if [ -f "$__object/parameter/pkg_path" ]; then                                  
 | 
				
			||||||
echo export PKG_PATH=ftp://ftp.openbsd.org/pub/OpenBSD/$os_version/packages/$machine/
 | 
					  pkg_path="$(cat "$__object/parameter/pkg_path")"                              
 | 
				
			||||||
 | 
					else
 | 
				
			||||||
 | 
					  pkg_path="ftp://ftp.openbsd.org/pub/OpenBSD/$os_version/packages/$machine/"
 | 
				
			||||||
 | 
					fi                                                                              
 | 
				
			||||||
 | 
					
 | 
				
			||||||
if [ "$pkg_version" ]; then
 | 
					if [ "$pkg_version" ]; then
 | 
				
			||||||
    state_is="present"
 | 
					    state_is="present"
 | 
				
			||||||
| 
						 | 
					@ -65,6 +68,7 @@ case "$state_should" in
 | 
				
			||||||
    present)
 | 
					    present)
 | 
				
			||||||
        # use this because pkg_add doesn't properly handle errors
 | 
					        # use this because pkg_add doesn't properly handle errors
 | 
				
			||||||
        cat << eof
 | 
					        cat << eof
 | 
				
			||||||
 | 
					export PKG_PATH="$pkg_path"                                              
 | 
				
			||||||
status=\$(pkg_add "$pkgopts" "$name--$flavor")
 | 
					status=\$(pkg_add "$pkgopts" "$name--$flavor")
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# no error
 | 
					# no error
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -29,6 +29,8 @@ flavor::
 | 
				
			||||||
state::
 | 
					state::
 | 
				
			||||||
    Either "present" or "absent", defaults to "present"
 | 
					    Either "present" or "absent", defaults to "present"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					pkg_path::
 | 
				
			||||||
 | 
					    Manually specify a PKG_PATH to add packages from.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
EXAMPLES
 | 
					EXAMPLES
 | 
				
			||||||
--------
 | 
					--------
 | 
				
			||||||
| 
						 | 
					@ -45,6 +47,10 @@ __package_pkg_openbsd python --state present --name python2
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# Remove obsolete package
 | 
					# Remove obsolete package
 | 
				
			||||||
__package_pkg_openbsd puppet --state absent
 | 
					__package_pkg_openbsd puppet --state absent
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					# Add a package using a particular mirror
 | 
				
			||||||
 | 
					__package_pkg_openbsd bash \
 | 
				
			||||||
 | 
					  --pkg_path http://openbsd.mirrorcatalogs.com/snapshots/packages/amd64
 | 
				
			||||||
--------------------------------------------------------------------------------
 | 
					--------------------------------------------------------------------------------
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1,3 +1,4 @@
 | 
				
			||||||
name
 | 
					name
 | 
				
			||||||
flavor
 | 
					flavor
 | 
				
			||||||
state
 | 
					state
 | 
				
			||||||
 | 
					pkg_path
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -26,9 +26,10 @@ os="$($__explorer/os)"
 | 
				
			||||||
# Default to using shadow passwords
 | 
					# Default to using shadow passwords
 | 
				
			||||||
database="shadow"
 | 
					database="shadow"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
if [ "$os" = "freebsd" ]; then
 | 
					case "$os" in
 | 
				
			||||||
   database="passwd"
 | 
					  "freebsd"|"openbsd")  database="passwd";;
 | 
				
			||||||
fi
 | 
					esac
 | 
				
			||||||
 | 
					  
 | 
				
			||||||
 | 
					
 | 
				
			||||||
getent "$database" "$name" || true
 | 
					getent "$database" "$name" || true
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -8,6 +8,10 @@ Changelog
 | 
				
			||||||
next:
 | 
					next:
 | 
				
			||||||
	* Type __git: Pass onwer/group/mode values to __directory
 | 
						* Type __git: Pass onwer/group/mode values to __directory
 | 
				
			||||||
	* Type __ssh_authorized_keys: Allow managing existing keys (Steven Armstrong)
 | 
						* Type __ssh_authorized_keys: Allow managing existing keys (Steven Armstrong)
 | 
				
			||||||
 | 
						* Type __iptable_rule: Fix example documentation (Antoine Catton)
 | 
				
			||||||
 | 
						* Type __file: Enhance OpenBSD Support (og)
 | 
				
			||||||
 | 
						* Type __package_pkg_openbsd: Allow to change PKG_PATH (og)
 | 
				
			||||||
 | 
						* Type __user: Enhance OpenBSD Support (og)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
3.0.9: 2014-02-14
 | 
					3.0.9: 2014-02-14
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue