diff --git a/cleanup/jira_setup_ldap.py b/cleanup/jira_setup_ldap.py index 51d1800..8a1d4b7 100644 --- a/cleanup/jira_setup_ldap.py +++ b/cleanup/jira_setup_ldap.py @@ -217,35 +217,18 @@ def web_delete_by_id( id, path, addl_form_data={} ): return r -def set_banner(): - banner = get_config().get( 'server', 'banner' ) - path = '/secure/admin/EditAnnouncementBanner.jspa' - data = { - 'announcement': banner, - 'bannerVisibility': 'private', - 'Set Banner': 'Set Banner', - 'atl_token': get_atl_token(), - } - r = post_sudo_path( path, data ) - logging.info( 'Banner set!' ) - - -def set_general_config(): - data = { k:v for k,v in get_config().items( 'general config' ) } - # cfg = get_config() - # data = { k:cfg['general config'][k] for k in ( 'baseURL', 'title', 'useGzip' ) } +def setup_ldap(): + data = { k:v for k,v in get_config().items( 'LDAP' ) } # pprint.pprint( data ) data.update( { 'atl_token': get_atl_token(), 'Update': 'Update' } ) - path = '/secure/admin/EditApplicationProperties.jspa' + path = '/plugins/servlet/embedded-crowd/configure/ldap/' r = post_sudo_path( path, data ) def run(): # starttime = time.time() - set_banner() - - set_general_config() + setup_ldap() # elapsed = time.time() - starttime # logging.info( f'Finished in {elapsed} seconds!' ) diff --git a/cleanup/jiractl b/cleanup/jiractl index 9151b53..647908c 100755 --- a/cleanup/jiractl +++ b/cleanup/jiractl @@ -2,9 +2,6 @@ ### VARIABLES -declare -A APPDIR -APPDIR['jira-test']=/usr/services/jira-standalone -APPDIR['jira-dev-m1']=/srv/jira/app ### FUNCTIONS @@ -26,13 +23,15 @@ case "$1" in esac # get host -case "$2" in - jira-test|jira-dev-m1) - host="$2" - appdir="${APPDIR[$host]}" +host="$2" +[[ -z "$host" ]] && die 'Missing host' +case "$host" in + jira-test) + appdir=/usr/services/jira-standalone ;; *) - die 'Missing or unknown host' + appdir=/srv/jira/app + ;; esac # Decide command to run @@ -50,6 +49,9 @@ case "$action" in logsf) cmd="tail -f ${appdir}/logs/catalina.out" ;; + off|power|shutdown) + cmd='shutdown -h now' + ;; esac set -x diff --git a/cleanup/send_migration_file.sh b/cleanup/send_migration_file.sh index b829d87..c7daca8 100644 --- a/cleanup/send_migration_file.sh +++ b/cleanup/send_migration_file.sh @@ -1,7 +1,7 @@ ### VARIABLES SRC_HOST=jira-test SRC_PATH=/usr/services/jirahome/export/projectconfigurator -TGT_HOST=jira-dev-m1 +# TGT_HOST=jira-dev-m1 TGT_PATH=/srv/jira/home/import/projectconfigurator @@ -22,6 +22,12 @@ ask_yes_no() { } +die() { + echo "ERROR: $*" 1>&2 + exit 99 +} + + clean_tgt() { echo "Clean up old files on $TGT_HOST:" ssh $TGT_HOST "sudo find $TGT_PATH -type f -print -delete" @@ -63,7 +69,14 @@ ls_src() { echo } + +get_host() { + TGT_HOST="$1" + [[ -z "$TGT_HOST" ]] && die "Missing target hostname" +} + ### MAIN +get_host "$1" ls_tgt ask_yes_no "Clean target ($TGT_HOST)? " && clean_tgt