Skip to content

Commit

Permalink
Fix git service folder create task
Browse files Browse the repository at this point in the history
The attempt to resolve the issue of a pre-existing
link in the place of the directory
( https://review.openstack.org/367563 ) did not work
as the file module requires a source and dest when
implementing a link.

This patch separates the task and only executes the
directory create if there is no link in place.

As per ansible/ansible-lint#161
the mode for all directories is set to include a leading
zero to ensure that it's enforced as octal.

Change-Id: I27a64e8edaee1f652a4b3a95d05941df34824660
  • Loading branch information
Jesse Pretorius committed Sep 9, 2016
1 parent 53f6852 commit f1705ac
Showing 1 changed file with 20 additions and 9 deletions.
29 changes: 20 additions & 9 deletions tasks/repo_post_install.yml
Expand Up @@ -49,24 +49,19 @@
- repo-key
- repo-key-create

- name: Check if the git folder exists already
stat:
path: "{{ repo_service_home_folder }}/repo/openstackgit"
register: _git_folder

- name: File and directory setup (non-root user)
file:
path: "{{ item.path }}"
state: "{{ item.state }}"
owner: "{{ repo_service_user_name }}"
group: "{{ repo_service_group_name }}"
mode: "{{ item.mode | default('2755') }}"
mode: "{{ item.mode | default('02755') }}"
with_items:
- path: "{{ repo_service_home_folder }}"
state: "directory"
- path: "{{ repo_service_home_folder }}/.ssh"
state: "directory"
mode: "2700"
mode: "02700"
- path: "{{ repo_service_home_folder }}/repo"
state: "directory"
- path: "{{ repo_service_home_folder }}/repo/links"
Expand All @@ -75,13 +70,29 @@
state: "directory"
- path: "{{ repo_service_home_folder }}/repo/os-releases/{{ openstack_release }}"
state: "directory"
- path: "{{ repo_service_home_folder }}/repo/openstackgit"
state: "{{ (_git_folder.stat.exists and _git_folder.stat.islnk) | ternary('link', 'directory') }}"
- path: "{{ repo_service_home_folder }}/repo/pools"
state: "directory"
tags:
- pkg-repo-dirs

- name: Check if the git folder exists already
stat:
path: "{{ repo_service_home_folder }}/repo/openstackgit"
register: _git_folder
tags:
- pkg-repo-dirs

- name: Git service data folder setup
file:
path: "{{ repo_service_home_folder }}/repo/openstackgit"
state: "directory"
owner: "{{ repo_service_user_name }}"
group: "{{ repo_service_group_name }}"
mode: "02755"
when: not _git_folder.stat.exists or (_git_folder.stat.exists and not _git_folder.stat.islnk)
tags:
- pkg-repo-dirs

- name: File and directory setup (root user)
file:
path: "{{ item.path }}"
Expand Down

0 comments on commit f1705ac

Please sign in to comment.