diff --git a/roles/common/files/pip_check_requirements_upgrades.sh b/roles/common/files/pip_check_requirements_upgrades.sh index 9d721287bebd8400ec0b811d2f31ee871a399b81..965b4034b5777e9ee32a39f15746fdde0c63bf37 100755 --- a/roles/common/files/pip_check_requirements_upgrades.sh +++ b/roles/common/files/pip_check_requirements_upgrades.sh @@ -122,24 +122,24 @@ fi # Set-up functions for printing coloured messages. function debug() { if [[ $debug != 0 ]]; then - echo "${_text_bold}${_text_blue}[DEBUG]${_text_reset}" "$@" + echo -e "${_text_bold}${_text_blue}[DEBUG]${_text_reset}" "$@" fi } function info() { - echo "${_text_bold}${_text_white}[INFO] ${_text_reset}" "$@" + echo -e "${_text_bold}${_text_white}[INFO] ${_text_reset}" "$@" } function success() { - echo "${_text_bold}${_text_green}[OK] ${_text_reset}" "$@" + echo -e "${_text_bold}${_text_green}[OK] ${_text_reset}" "$@" } function warning() { - echo "${_text_bold}${_text_yellow}[WARN] ${_text_reset}" "$@" + echo -e "${_text_bold}${_text_yellow}[WARN] ${_text_reset}" "$@" } function error() { - echo "${_text_bold}${_text_red}[ERROR]${_text_reset}" "$@" >&2 + echo -e "${_text_bold}${_text_red}[ERROR]${_text_reset}" "$@" >&2 } # Clean-up command for temporary files. @@ -147,7 +147,7 @@ function on_exit() { debug "Cleaning-up temporary file: $tmp_current" [[ -f $tmp_current ]] && rm "$tmp_current" - debug "Cleaning-up temporayr file: $tmp_new" + debug "Cleaning-up temporary file: $tmp_new" [[ -f $tmp_new ]] && rm "$tmp_new" } trap on_exit EXIT @@ -247,11 +247,16 @@ for environment in "$config_dir"/*; do # Deploy the existing requirements file and the new one. sed -e 's/[[:blank:]]*#.*//' "$req_txt" | grep -v "^$" | sort -u > "$tmp_current" - if ! pip-compile --no-header --no-annotate --no-index --output-file "$tmp_new" "$req_in" > /dev/null; then + if ! pip-compile --upgrade --dry-run --no-header --no-annotate --no-index "$req_in" 2>&1 | \ + grep -v 'Dry-run' | sed -e 's/[[:blank:]]*#.*//' | grep -v "^$" | \ + sort -u > "$tmp_new" ; then error "Failed while running pip-compile command against (see error stack trace above): $req_in" continue fi + debug "Current requirements:\n$(cat "$tmp_current")" + debug "New requirements:\n$(cat "$tmp_new")" + # Run diff, storing the output and result. diff=$(diff -u "$tmp_current" "$tmp_new") result="$?" diff --git a/testsite/playbooks/roles/wsgihello2/files/requirements.in b/testsite/playbooks/roles/wsgihello2/files/requirements.in index 909e5cedddcd1f546d649d1de0db0fffc46c7e50..50e81ced2918547e2b4a687115e84a9fa79657af 100644 --- a/testsite/playbooks/roles/wsgihello2/files/requirements.in +++ b/testsite/playbooks/roles/wsgihello2/files/requirements.in @@ -1 +1,3 @@ -ipcalc \ No newline at end of file +django-apptemplates +ipcalc +django~=1.8.0 diff --git a/testsite/playbooks/roles/wsgihello2/files/requirements.txt b/testsite/playbooks/roles/wsgihello2/files/requirements.txt index 7412659c9362e6db6bd7864a0e83e9201fc95722..4718881b5fb6ca3d34cfd0fbf089b399b0222d29 100644 --- a/testsite/playbooks/roles/wsgihello2/files/requirements.txt +++ b/testsite/playbooks/roles/wsgihello2/files/requirements.txt @@ -1 +1,3 @@ +django-apptemplates==1.2 ipcalc==1.1.3 +django==1.8.16 diff --git a/testsite/playbooks/roles/wsgihello2/meta/main.yml b/testsite/playbooks/roles/wsgihello2/meta/main.yml index 8d3aae6fc26cfe0a749d1bea1c439afe2d96c951..ed06a8e101af83879303edad2eb96fb7a9f2c770 100644 --- a/testsite/playbooks/roles/wsgihello2/meta/main.yml +++ b/testsite/playbooks/roles/wsgihello2/meta/main.yml @@ -13,7 +13,7 @@ dependencies: environment_variables: WEBSITE_NAME: "Majic Ansible Roles Test Site" wsgi_requirements: - - futures==3.0.1 + - futures==3.1.1 - gunicorn==19.6.0 - role: database db_name: wsgi_{{ testsite_domain_underscores }}