mirror of https://github.com/ansible/ansible.git
Allow `$` & `~` inside paths in galaxy roles (#72966)
ansible-galaxy currently behaves bad then a role to be installed contains ~ or $ at any place in the path of a file in that role. It extracts the parent directory of the offending path level as an empty file. This explodes if that directory contains anything else. Change this behaviour. `~` is now allowed allowed when it is not a full level (Yes: `some~thing/`, no: `~/`). The code should get refactoring in an other PR.pull/73455/head
parent
a9b5bebab3
commit
1c83672532
@ -0,0 +1,2 @@
|
|||||||
|
bugfixes:
|
||||||
|
- Allow `~` to be present in file names in galaxy roles (https://github.com/ansible/ansible/issues/72966)
|
||||||
@ -0,0 +1,2 @@
|
|||||||
|
shippable/posix/group4
|
||||||
|
skip/python2.6 # build uses tarfile with features not available until 2.7
|
||||||
@ -0,0 +1 @@
|
|||||||
|
dependencies: [setup_remote_tmp_dir]
|
||||||
@ -0,0 +1,58 @@
|
|||||||
|
- name: Archive directories
|
||||||
|
file:
|
||||||
|
state: directory
|
||||||
|
path: "{{ remote_tmp_dir }}/role.d/{{item}}"
|
||||||
|
loop:
|
||||||
|
- meta
|
||||||
|
- tasks
|
||||||
|
|
||||||
|
- name: Metadata file
|
||||||
|
copy:
|
||||||
|
content: "'galaxy_info': {}"
|
||||||
|
dest: "{{ remote_tmp_dir }}/role.d/meta/main.yml"
|
||||||
|
|
||||||
|
- name: Valid files
|
||||||
|
copy:
|
||||||
|
content: ""
|
||||||
|
dest: "{{ remote_tmp_dir }}/role.d/tasks/{{item}}"
|
||||||
|
loop:
|
||||||
|
- "main.yml"
|
||||||
|
- "valid~file.yml"
|
||||||
|
|
||||||
|
- name: Valid role archive
|
||||||
|
command: "tar cf {{ remote_tmp_dir }}/valid-role.tar {{ remote_tmp_dir }}/role.d"
|
||||||
|
|
||||||
|
- name: Invalid file
|
||||||
|
copy:
|
||||||
|
content: ""
|
||||||
|
dest: "{{ remote_tmp_dir }}/role.d/tasks/~invalid.yml"
|
||||||
|
|
||||||
|
- name: Valid requirements file
|
||||||
|
copy:
|
||||||
|
dest: valid-requirements.yml
|
||||||
|
content: "[{'src': '{{ remote_tmp_dir }}/valid-role.tar', 'name': 'valid-testrole'}]"
|
||||||
|
|
||||||
|
- name: Invalid role archive
|
||||||
|
command: "tar cf {{ remote_tmp_dir }}/invalid-role.tar {{ remote_tmp_dir }}/role.d"
|
||||||
|
|
||||||
|
- name: Invalid requirements file
|
||||||
|
copy:
|
||||||
|
dest: invalid-requirements.yml
|
||||||
|
content: "[{'src': '{{ remote_tmp_dir }}/invalid-role.tar', 'name': 'invalid-testrole'}]"
|
||||||
|
|
||||||
|
- name: Install valid role
|
||||||
|
command: ansible-galaxy install -r valid-requirements.yml
|
||||||
|
|
||||||
|
- name: Uninstall valid role
|
||||||
|
command: ansible-galaxy role remove valid-testrole
|
||||||
|
|
||||||
|
- name: Install invalid role
|
||||||
|
command: ansible-galaxy install -r invalid-requirements.yml
|
||||||
|
ignore_errors: yes
|
||||||
|
register: invalid
|
||||||
|
|
||||||
|
- assert:
|
||||||
|
that: "invalid.rc != 0"
|
||||||
|
|
||||||
|
- name: Uninstall invalid role
|
||||||
|
command: ansible-galaxy role remove invalid-testrole
|
||||||
Loading…
Reference in New Issue