Skip to content

Commit

Permalink
Merge branch 'main' into fix_molecule
Browse files Browse the repository at this point in the history
  • Loading branch information
dometto authored May 22, 2024
2 parents 1e3994f + add84c2 commit 81aeff7
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 14 deletions.
27 changes: 15 additions & 12 deletions component.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,15 @@
---
- name: iBridges Sync ResearchCloud Component
hosts: localhost
vars:
_ibridges_user: "{{ ibridges_user | default(ibridges_target_path | regex_search('^\/home\/(.*)\/.*', '\\1') | default([], true) | first ) }}"
_ibridges_group: "{{ ibridges_group | default(ibridges_target_path | regex_search('^\/home\/(.*)\/.*', '\\1') | default([], true) | first ) }}"
_ibridges_paths: "{{ ibridges_irods_path.split(',') }}"
_ibridges_user_from_path: "{{ ibridges_target_path | regex_search('^\/home\/(\\w+)(\/\\w*)?', '\\1') | default([''], true) | first }}"
_ibridges_user: "{{ ibridges_user | default(_ibridges_user_from_path, true) | default('root', true) }}"
_ibridges_group: "{{ ibridges_group | default(_ibridges_user, true) | default('root', true) }}"
_ibridges_custom_pip_location: /usr/local/pip

tasks:
- name: Install ibridges
- name: Install iBridges
pip:
name: ibridges
extra_args: "--target {{ _ibridges_custom_pip_location }}"
Expand All @@ -16,28 +19,28 @@
path: "{{ ibridges_target_path }}/{{ item | basename }}"
state: directory
mode: "0750"
owner: "{{ _ibridges_user | default('root', true) }}"
group: "{{ _ibridges_group | default('root', true) }}"
with_items: "{{ ibridges_irods_path.split(',') }}"
owner: "{{ _ibridges_user }}"
group: "{{ _ibridges_group }}"
with_items: "{{ _ibridges_paths }}"

- name: iBridges sync
ibridges_sync:
mode: down
env: '{{ ibridges_env | regex_replace("\\", "") }}'
env: '{{ ibridges_env | regex_replace("\\", "") | from_yaml }}'
irods_path: "{{ ibridges_irods_path }}"
local_path: "{{ ibridges_target_path }}/{{ item | basename }}"
password: "{{ ibridges_password }}"
check_mode: "{{ ibridges_dry_run | default(false) | bool }}"
with_items: "{{ ibridges_irods_path.split(',') }}"
with_items: "{{ _ibridges_paths }}"
environment:
PYTHON_PATH: "{{ _ibridges_custom_pip_location }}:{{ ansible_env.PYTHONPATH }}"
PYTHONPATH: "{{ _ibridges_custom_pip_location ~ ':' ~ ansible_env.PYTHONPATH if ansible_env['PYTHONPATH'] is defined else _ibridges_custom_pip_location }}"

- name: Change permissions of downloaded files
file:
path: "{{ ibridges_target_path }}/{{ item | basename }}"
state: directory
recurse: true
mode: "0750"
owner: "{{ _ibridges_user | default('root', true) }}"
group: "{{ _ibridges_group | default('root', true) }}"
with_items: "{{ ibridges_irods_path.split(',') }}"
owner: "{{ _ibridges_user }}"
group: "{{ _ibridges_group }}"
with_items: "{{ _ibridges_paths }}"
4 changes: 2 additions & 2 deletions plugins/modules/ibridges_sync.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
env:
description: A dictionary containing all the information about your iRODS environment.
required: false
type: str
type: dict
password:
description: The password to use to connect to iRODS.
required: true
Expand Down Expand Up @@ -121,7 +121,7 @@ def run_module():
)
try:
from ibridges import Session, sync_data, IrodsPath
except:
except ImportError:
module.fail_json(msg="Please install the 'ibridges' python package.", changed=False)

from pathlib import Path
Expand Down

0 comments on commit 81aeff7

Please sign in to comment.