From deb251b167a70935b14ad1031f8d6b6e67e010e4 Mon Sep 17 00:00:00 2001 From: Paul Belanger Date: Fri, 1 May 2020 12:35:02 -0400 Subject: [PATCH] Add support for boto3_install_method: git This brings the role inline with other windmill roles. Change-Id: I18b1d386463f520d781711ce9fee2f3c2e8e6d81 Signed-off-by: Paul Belanger --- .zuul.yaml | 4 ++-- defaults/main.yaml | 6 ++++++ tasks/install/git.yaml | 26 ++++++++++++++++++++++++++ tests/playbooks/run.yaml | 13 +++++++++++++ 4 files changed, 47 insertions(+), 2 deletions(-) create mode 100644 tasks/install/git.yaml diff --git a/.zuul.yaml b/.zuul.yaml index ec6f5e7..8aebd31 100644 --- a/.zuul.yaml +++ b/.zuul.yaml @@ -25,8 +25,8 @@ - job: name: ansible-role-boto3-src parent: ansible-role-boto3-base - # vars: - # boto3_install_method: git + vars: + boto3_install_method: git - job: name: ansible-role-boto3-src-fedora-latest diff --git a/defaults/main.yaml b/defaults/main.yaml index 2e30ca4..6e4d992 100644 --- a/defaults/main.yaml +++ b/defaults/main.yaml @@ -28,6 +28,12 @@ boto3_file_credentials_mode: 0640 boto3_file_credentials_owner: "{{ boto3_user_name }}" boto3_file_credentials_src: root/.aws/credentials.j2 +# tasks/install.yaml +boto3_git_dest: "{{ ansible_user_dir }}/src/github.com/boto/boto3" +boto3_git_uri: https://github.com/boto/boto3 +boto3_git_version: master +# boto3_git_update: + boto3_install_method: pip boto3_pip_name: boto3 diff --git a/tasks/install/git.yaml b/tasks/install/git.yaml new file mode 100644 index 0000000..de39f04 --- /dev/null +++ b/tasks/install/git.yaml @@ -0,0 +1,26 @@ +# Copyright 2020 Red Hat, Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations +# under the License. +--- +- name: Git clone boto3 + git: + dest: "{{ boto3_git_dest }}" + repo: "{{ boto3_git_uri }}" + update: "{{ boto3_git_update|default(omit) }}" + version: "{{ boto3_git_version }}" + +- name: Set boto3_pip_name to local git repo + set_fact: + boto3_pip_name: "file://{{ boto3_git_dest }}" + +- include: pip.yaml diff --git a/tests/playbooks/run.yaml b/tests/playbooks/run.yaml index d43a4f5..c0295a1 100644 --- a/tests/playbooks/run.yaml +++ b/tests/playbooks/run.yaml @@ -34,3 +34,16 @@ - aws_credentials_file_stat.stat.pw_name == 'root' - aws_credentials_file_stat.stat.gr_name == 'root' - aws_credentials_file_stat.stat.mode == '0640' + + - name: Register boto3_git_dest_stat + stat: + path: /home/zuul/src/github.com/boto/boto3 + register: boto3_git_dest_stat + when: boto3_install_method == 'git' + + - name: Assert boto3_git_dest tests + assert: + that: + - boto3_git_dest_stat.stat.exists + - boto3_git_dest_stat.stat.isdir + when: boto3_install_method == 'git'