Skip to content

Commit

Permalink
Merge pull request #144 from galaxyproject/lint
Browse files Browse the repository at this point in the history
Lint all the things
  • Loading branch information
natefoo authored Jan 4, 2022
2 parents a5c7ec5 + a1c4a9d commit 2b89a7c
Show file tree
Hide file tree
Showing 11 changed files with 58 additions and 45 deletions.
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,11 @@ If using `root-dir`:

### Optional variables ###

The `galaxy_config_perms` option controls the permissions that Galaxy configuration files will be set to. This option
has been added in version 0.9.18 of the role and the default value is `0640` (user read-write, group read-only, other
users have no permissions). **In older versions, the role did not control the permissions of configuration files, so be
aware that your configuration file permissions may change as of 0.9.18 and later.**

**Layout control**

- `galaxy_layout`: available layouts can be found in the [vars/][vars] subdirectory and possible values include:
Expand Down
3 changes: 3 additions & 0 deletions defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,9 @@ galaxy_config_file_template: "{{ galaxy_config_file_basename }}.j2"
galaxy_config_file: "{{ galaxy_config_dir }}/{{ galaxy_config_file_basename }}"
galaxy_app_config_section: "{{ 'galaxy' if galaxy_config_style in ('yaml', 'yml') else 'app:main' }}"

# Galaxy configuration files will be written with these permissions (mode argument to Ansible copy/template module)
galaxy_config_perms: 0640

# The default Galaxy configuration, ensures that Galaxy can find all of the configs if galaxy_config_dir !=
# galaxy_server_dir
galaxy_paste_app_factory: "galaxy.web.buildapp:app_factory"
Expand Down
65 changes: 27 additions & 38 deletions meta/main.yml
Original file line number Diff line number Diff line change
@@ -1,50 +1,39 @@
---
galaxy_info:
namespace: galaxyproject
role_name: galaxy
author: The Galaxy Project
description: Install and manage a Galaxy (http://galaxyproject.org/) server.
company: The Galaxy Project
license: AFL v3.0
min_ansible_version: 2.7
github_branch: main
platforms:
- name: EL
versions:
- all
- name: GenericUNIX
versions:
- all
- any
- name: Fedora
versions:
- all
- name: opensuse
versions:
- all
- name: Amazon
versions:
- all
- name: GenericBSD
versions:
- all
- any
- name: FreeBSD
versions:
- all
- name: Ubuntu
versions:
- all
- name: SLES
versions:
- all
- name: GenericLinux
versions:
- all
- any
- name: Debian
versions:
- all
- name: EL
versions:
- all
- name: GenericUNIX
versions:
- all
- any
- name: Fedora
versions:
- all
- name: Amazon
versions:
- all
- name: Ubuntu
versions:
- all
- name: GenericLinux
versions:
- all
- any
- name: Debian
versions:
- all
galaxy_tags:
- system
- web
- system
- web
dependencies: []
allow_duplicates: yes
5 changes: 3 additions & 2 deletions tasks/_inc_client_build_steps.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
success_msg: "Deconstructed client build is supported"
fail_msg: "Deconstructed client build is not supported for Galaxy version {{ __galaxy_major_version }}, please set 'galaxy_client_make_target'"

- name: Run gulp
- name: Run gulp # noqa no-changed-when
command: yarn run gulp {{ item }}
args:
chdir: "{{ galaxy_server_dir }}/client"
Expand All @@ -29,7 +29,7 @@
VIRTUAL_ENV: "{{ galaxy_venv_dir }}"
NODE_ENV: "{{ galaxy_client_node_env }}"

- name: Run webpack
- name: Run webpack # noqa no-changed-when
command: "yarn run webpack{{ (galaxy_client_node_env == 'production') | ternary('-production', '') }}"
args:
chdir: "{{ galaxy_server_dir }}/client"
Expand All @@ -42,3 +42,4 @@
copy:
content: "{{ __galaxy_current_commit_id }}"
dest: "{{ galaxy_static_dir }}/client_build_hash.txt"
mode: 0644
3 changes: 2 additions & 1 deletion tasks/client.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
copy:
content: "new-unbuilt"
dest: "{{ galaxy_static_dir }}/client_build_hash.txt"
mode: 0644
force: no

- name: Get current client commit id
Expand All @@ -19,7 +20,7 @@
path: "{{ galaxy_server_dir }}/.git"
register: __galaxy_from_git

- name: Get current Galaxy commit id
- name: Get current Galaxy commit id # noqa git-latest
git:
dest: "{{ galaxy_server_dir }}"
repo: "{{ galaxy_repo }}"
Expand Down
2 changes: 2 additions & 0 deletions tasks/download.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
file:
path: "{{ galaxy_server_dir }}"
state: directory
mode: 0755

- name: Install current version of Galaxy
unarchive:
Expand All @@ -26,6 +27,7 @@
file:
path: "{{ galaxy_server_dir }}/{{ galaxy_commit_id }}_receipt"
state: touch
mode: 0644
when: not download_receipt.stat.exists

- name: Include virtualenv setup tasks
Expand Down
4 changes: 2 additions & 2 deletions tasks/layout.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
- name: Include layout vars
include_vars: "layout-{{ galaxy_layout | default('legacy') }}.yml"

- name: Set any unset variables from layout defaults
- name: Set any unset variables from layout defaults # noqa var-naming
set_fact:
"{{ item }}": "{{ lookup('vars', '__' ~ item) }}"
when: item not in vars
Expand Down Expand Up @@ -33,7 +33,7 @@
- job_working_directory
- shed_tool_config_file

- name: Set any unset variables corresponding to Galaxy config options from galaxy_config or layout defaults
- name: Set any unset variables corresponding to Galaxy config options from galaxy_config or layout defaults # noqa var-naming
set_fact:
"{{ 'galaxy_' ~ item }}": "{{ ((galaxy_config | default({}))[galaxy_app_config_section] | default({}))[item] | default(lookup('vars', '__galaxy_' ~ item)) }}"
when: "'galaxy_' ~ item not in vars"
Expand Down
2 changes: 2 additions & 0 deletions tasks/mutable_setup.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,15 @@
src: "{{ item.src }}"
dest: "{{ item.dest }}"
force: no
mode: "{{ galaxy_config_perms }}"
with_items: "{{ galaxy_mutable_config_files }}"

- name: Instantiate mutable configuration templates
template:
src: "{{ item.src }}"
dest: "{{ item.dest }}"
force: no
mode: "{{ galaxy_config_perms }}"
with_items: "{{ galaxy_mutable_config_templates }}"

remote_user: "{{ galaxy_remote_users.galaxy | default(__galaxy_remote_user) }}"
Expand Down
9 changes: 9 additions & 0 deletions tasks/static_setup.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
src: "{{ item.src }}"
dest: "{{ item.dest }}"
backup: "{{ galaxy_backup_configfiles }}"
mode: "{{ galaxy_config_perms }}"
with_items: "{{ galaxy_config_files }}"
notify:
- "{{ galaxy_restart_handler_name }}"
Expand All @@ -22,6 +23,7 @@
src: "{{ item.src }}"
dest: "{{ item.dest }}"
backup: "{{ galaxy_backup_configfiles }}"
mode: "{{ galaxy_config_perms }}"
with_items: "{{ galaxy_config_templates }}"
notify:
- "{{ galaxy_restart_handler_name }}"
Expand All @@ -30,13 +32,15 @@
copy:
src: "{{ galaxy_local_tools_src_dir }}/{{ item }}"
dest: "{{ galaxy_local_tools_dir }}/{{ item }}"
mode: preserve
with_items: "{{ galaxy_local_tools | default([]) }}"
when: galaxy_local_tools is defined

- name: Install local_tool_conf.xml
template:
src: local_tool_conf.xml.j2
dest: "{{ galaxy_config_dir }}/local_tool_conf.xml"
mode: "{{ galaxy_config_perms }}"
when: galaxy_local_tools is defined

- name: Append local_tool_conf.xml to tool_config_file Galaxy config option
Expand All @@ -53,6 +57,7 @@
file:
path: "{{ galaxy_dynamic_job_rules_dir }}/{{ item | dirname }}"
state: directory
mode: 0755
loop_control:
label: "{{ galaxy_dynamic_job_rules_dir }}/{{ item | dirname }}"
with_items: "{{ galaxy_dynamic_job_rules }}"
Expand All @@ -61,13 +66,15 @@
copy:
src: "{{ galaxy_dynamic_job_rules_src_dir }}/{{ item }}"
dest: "{{ galaxy_dynamic_job_rules_dir }}/{{ item }}"
mode: 0644
with_items: "{{ galaxy_dynamic_job_rules }}"
when: not item.endswith(".j2")

- name: Install dynamic job rules (template)
template:
src: "{{ galaxy_dynamic_job_rules_src_dir }}/{{ item }}"
dest: "{{ galaxy_dynamic_job_rules_dir }}/{{ item | regex_replace(regex) }}"
mode: 0644
vars:
regex: '\.j2$'
with_items: "{{ galaxy_dynamic_job_rules }}"
Expand All @@ -78,6 +85,7 @@
content: ""
dest: "{{ galaxy_dynamic_job_rules_dir }}/{{ item | dirname }}/__init__.py"
force: no
mode: 0644
loop_control:
label: "{{ galaxy_dynamic_job_rules_dir }}/{{ ((item | dirname) != '') | ternary ((item | dirname) ~ '/', '') }}__init__.py"
with_items: "{{ galaxy_dynamic_job_rules }}"
Expand Down Expand Up @@ -117,6 +125,7 @@
src: "{{ galaxy_config_file_template }}"
dest: "{{ galaxy_config_file }}"
backup: "{{ galaxy_backup_configfiles }}"
mode: "{{ galaxy_config_perms }}"
notify:
- "{{ galaxy_restart_handler_name }}"

Expand Down
4 changes: 2 additions & 2 deletions tasks/virtualenv.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@
environment:
VIRTUAL_ENV: "{{ galaxy_venv_dir }}"

- name: Ensure pip and setuptools are the latest release
- name: Ensure pip is the desired release
pip:
name: pip
state: latest
state: "{{ galaxy_pip_version | default('latest') }}"
extra_args: "{{ pip_extra_args | default('') }}"
virtualenv: "{{ galaxy_venv_dir }}"
virtualenv_command: "{{ galaxy_virtualenv_command | default(pip_virtualenv_command | default(omit)) }}"
Expand Down
1 change: 1 addition & 0 deletions tests/test_playbook.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
galaxy_root: /srv/galaxy
galaxy_separate_privileges: yes
galaxy_user: galaxy
galaxy_group: galaxy
galaxy_privsep_user: gxpriv
galaxy_config:
galaxy:
Expand Down

0 comments on commit 2b89a7c

Please sign in to comment.