mirror of
				https://github.com/zulip/zulip.git
				synced 2025-11-04 05:53:43 +00:00 
			
		
		
		
	puppet: Only execute setup-apt-repo if necessary.
This means that in steady-state, `zulip-puppet-apply` is expected to produce no changes or commands to execute. The verification step of `setup-apt-repo` is quite fast, so this cleans up the output for very little cost.
This commit is contained in:
		
				
					committed by
					
						
						Tim Abbott
					
				
			
			
				
	
			
			
			
						parent
						
							5a22e73cc6
						
					
				
				
					commit
					d15e6990e5
				
			@@ -2,5 +2,6 @@ class zulip::apt_repository {
 | 
				
			|||||||
  $setup_apt_repo_file = "${::zulip_scripts_path}/lib/setup-apt-repo"
 | 
					  $setup_apt_repo_file = "${::zulip_scripts_path}/lib/setup-apt-repo"
 | 
				
			||||||
  exec{'setup_apt_repo':
 | 
					  exec{'setup_apt_repo':
 | 
				
			||||||
    command => "bash -c '${setup_apt_repo_file}'",
 | 
					    command => "bash -c '${setup_apt_repo_file}'",
 | 
				
			||||||
 | 
					    unless  => "bash -c '${setup_apt_repo_file} --verify'",
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -4,6 +4,22 @@ set -e
 | 
				
			|||||||
set -u
 | 
					set -u
 | 
				
			||||||
set -o pipefail
 | 
					set -o pipefail
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					verify=false
 | 
				
			||||||
 | 
					args="$(getopt -o '' --long verify -- "$@")"
 | 
				
			||||||
 | 
					eval "set -- $args"
 | 
				
			||||||
 | 
					while true; do
 | 
				
			||||||
 | 
					    case "$1" in
 | 
				
			||||||
 | 
					        --verify)
 | 
				
			||||||
 | 
					            verify=true
 | 
				
			||||||
 | 
					            shift
 | 
				
			||||||
 | 
					            ;;
 | 
				
			||||||
 | 
					        --)
 | 
				
			||||||
 | 
					            shift
 | 
				
			||||||
 | 
					            break
 | 
				
			||||||
 | 
					            ;;
 | 
				
			||||||
 | 
					    esac
 | 
				
			||||||
 | 
					done
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# Ensure the directory for LAST_DEPENDENCIES_HASH exists
 | 
					# Ensure the directory for LAST_DEPENDENCIES_HASH exists
 | 
				
			||||||
mkdir -p /var/lib/zulip
 | 
					mkdir -p /var/lib/zulip
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -21,6 +37,8 @@ LAST_DEPENDENCIES_HASH="$(cat "$DEPENDENCIES_HASH_FILE")"
 | 
				
			|||||||
# (apt keys, code, etc.)  changed.
 | 
					# (apt keys, code, etc.)  changed.
 | 
				
			||||||
if [ "$DEPENDENCIES_HASH" = "$LAST_DEPENDENCIES_HASH" ]; then
 | 
					if [ "$DEPENDENCIES_HASH" = "$LAST_DEPENDENCIES_HASH" ]; then
 | 
				
			||||||
    exit 0
 | 
					    exit 0
 | 
				
			||||||
 | 
					elif [ "$verify" == true ]; then
 | 
				
			||||||
 | 
					    exit 1
 | 
				
			||||||
fi
 | 
					fi
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# Ensure that the sources file exists
 | 
					# Ensure that the sources file exists
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user