diff --git a/import_users.sh b/import_users.sh index df764c7..db84bb6 100755 --- a/import_users.sh +++ b/import_users.sh @@ -250,11 +250,16 @@ function sync_accounts() { get_sudoers_groups_from_tag iam_users=$(get_clean_iam_users | sort | uniq) - sudo_users=$(get_clean_sudoers_users | sort | uniq) + if [[ -z "${iam_users}" ]] + then + log "we just got back an empty iam_users user list which is likely caused by an IAM outage!" + exit 1 + fi - if [[ -z "${iam_users}" ]] && [[ -z "${sudo_users}" ]] + sudo_users=$(get_clean_sudoers_users | sort | uniq) + if [[ ! -z "${SUDOERS_GROUPS}" ]] && [[ ! "${SUDOERS_GROUPS}" == "##ALL##" ]] && [[ -z "${sudo_users}" ]] then - log "we just got back an empty iam_users and sudo_users user list which is likely caused by an IAM outage!" + log "we just got back an empty sudo_users user list which is likely caused by an IAM outage!" exit 1 fi