Set permissions on existing directory
Previously, an existing directory would not have its permissions modified by the __directory type. This change removes exiting early when $state_is matches $state_should
This commit is contained in:
		
					parent
					
						
							
								77e92ceba9
							
						
					
				
			
			
				commit
				
					
						f16ac1911d
					
				
			
		
					 1 changed files with 6 additions and 4 deletions
				
			
		| 
						 | 
					@ -21,8 +21,6 @@
 | 
				
			||||||
state_should="present"
 | 
					state_should="present"
 | 
				
			||||||
[ -f "$__object/parameter/state" ] && state_should="$(cat "$__object/parameter/state")"
 | 
					[ -f "$__object/parameter/state" ] && state_should="$(cat "$__object/parameter/state")"
 | 
				
			||||||
state_is="$(cat "$__object/explorer/state")"
 | 
					state_is="$(cat "$__object/explorer/state")"
 | 
				
			||||||
[ "$state_should" = "$state_is" ] && exit 0
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
destination="/$__object_id"
 | 
					destination="/$__object_id"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
mkdiropt=""
 | 
					mkdiropt=""
 | 
				
			||||||
| 
						 | 
					@ -32,7 +30,9 @@ recursive=""
 | 
				
			||||||
 | 
					
 | 
				
			||||||
case "$state_should" in
 | 
					case "$state_should" in
 | 
				
			||||||
    present)
 | 
					    present)
 | 
				
			||||||
        echo mkdir $mkdiropt \"$destination\"
 | 
					        if [ "$state_is" != "present" ]; then
 | 
				
			||||||
 | 
					          echo mkdir $mkdiropt \"$destination\"
 | 
				
			||||||
 | 
					        fi
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        # Mode settings
 | 
					        # Mode settings
 | 
				
			||||||
        if [ -f "$__object/parameter/mode" ]; then
 | 
					        if [ -f "$__object/parameter/mode" ]; then
 | 
				
			||||||
| 
						 | 
					@ -50,7 +50,9 @@ case "$state_should" in
 | 
				
			||||||
        fi
 | 
					        fi
 | 
				
			||||||
    ;;
 | 
					    ;;
 | 
				
			||||||
    absent)
 | 
					    absent)
 | 
				
			||||||
        echo rm -rf \"$destination\"
 | 
					        if [ "$state_is" != "absent" ]; then
 | 
				
			||||||
 | 
					          echo rm -rf \"$destination\"
 | 
				
			||||||
 | 
					        fi
 | 
				
			||||||
    ;;
 | 
					    ;;
 | 
				
			||||||
    *)
 | 
					    *)
 | 
				
			||||||
        echo "Unknown state: $state_should" >&2
 | 
					        echo "Unknown state: $state_should" >&2
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue