From 0eaa4195aa9876ff3a7604fbc7a04c2b3875c680 Mon Sep 17 00:00:00 2001 From: Andrea Dell'Amico Date: Thu, 22 Sep 2016 17:10:25 +0200 Subject: [PATCH] library/roles/R/tasks/r-installation.yml: Change the packages installation script because the plugins list is now a dictionary. --- R/tasks/r-installation.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/R/tasks/r-installation.yml b/R/tasks/r-installation.yml index f7fef96..1340978 100644 --- a/R/tasks/r-installation.yml +++ b/R/tasks/r-installation.yml @@ -48,9 +48,9 @@ when: r_plugins_from_sources is defined tags: [ 'r_software', 'r_pkg', 'r_plugins', 'r_plugins_version' ] -- name: Install R packages from the cran sources repo, latest available version. First try +- name: Install R packages from the cran sources repo or from an alternative repository, latest available version. First try command: > - Rscript --slave --no-save --no-restore-history -e "if (! ('{{ item }}' %in% installed.packages()[,'Package'])) { install.packages(pkgs='{{ item }}', repos=c('{{ r_cran_mirror_site }}/')); print('Added'); } else { print('Already installed'); }" + Rscript --slave --no-save --no-restore-history -e "if (! ('{{ item.name }}' %in% installed.packages()[,'Package'])) { install.packages(pkgs='{{ item.name }}', repos=c('{{ item.repo | default ('https://cloud.r-project.org') }}/')); print('Added'); } else { print('Already installed'); }" register: install_plugins_result failed_when: "install_plugins_result.rc != 0 or 'had non-zero exit status' in install_plugins_result.stderr" changed_when: "'Added' in install_plugins_result.stdout" @@ -86,9 +86,9 @@ when: r_plugins_install_specific_source tags: [ 'r_software', 'r_pkg', 'r_plugins', 'r_plugins_version' ] -- name: Install R packages from the cran sources repo, latest available version. Second try +- name: Install R packages from the cran sources repo or from an alternative repository, latest available version. Second try command: > - Rscript --slave --no-save --no-restore-history -e "if (! ('{{ item }}' %in% installed.packages()[,'Package'])) { install.packages(pkgs='{{ item }}', repos=c('{{ r_cran_mirror_site }}/')); print('Added'); } else { print('Already installed'); }" + Rscript --slave --no-save --no-restore-history -e "if (! ('{{ item.name }}' %in% installed.packages()[,'Package'])) { install.packages(pkgs='{{ item.name }}', repos=c('{{ item.repo | default ('https://cloud.r-project.org') }}/')); print('Added'); } else { print('Already installed'); }" register: install_plugins_result failed_when: "install_plugins_result.rc != 0 or 'had non-zero exit status' in install_plugins_result.stderr" changed_when: "'Added' in install_plugins_result.stdout"