diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 233bc80d8f4b0a2ed98f97e33a6269dd6ef0d882..01fddc124d989670b28af4212074fe0183bdbc90 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -16,6 +16,10 @@ files: tests/playbook.yml args: - tests/playbook.yml +- repo: https://github.com/adarnimrod/shell-pre-commit + sha: v0.1.0 + hooks: + - id: shell-lint - repo: https://github.com/willthames/ansible-lint sha: 959ab0f525e9abb19cf75f34381015cf33695f61 hooks: diff --git a/tasks/main.yml b/tasks/main.yml index 7f49dc840a77b68187ff8da2ca176c74299b272a..95b11d37c02c0b511b9ed846179f8a32674869f5 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -11,18 +11,29 @@ - name: APT install prerequisites when: ansible_pkg_mgr == 'apt' apt: - name: python-dev + name: [python-dev, libssl-dev, libffi-dev, build-essential] state: present update_cache: yes cache_valid_time: 3600 +- name: Create virtualenv directory + file: + path: /var/lib/pelican-gitreceive + owner: git + group: git + mode: 0o0700 + state: directory + - name: pip install + become: True + become_user: git with_items: - pelican - - fabric + - Fabric pip: name: '{{ item }}' state: present + virtualenv: /var/lib/pelican-gitreceive - name: Create directory structure file: diff --git a/templates/receiver.sh b/templates/receiver.sh index bf8d7771e990796d9e3b901b04f112fceeea0715..f47885440a0ca1361f37a634c58173882f7ba4e0 100644 --- a/templates/receiver.sh +++ b/templates/receiver.sh @@ -31,6 +31,8 @@ then echo '----> Fetching submodules ...' fetch_submodules fi +echo '----> Activating virtualenv ...' +. /var/lib/pelican-gitreceive/bin/activate echo '----> Building blog ...' fab build echo '----> Copying blog ...' diff --git a/tests/test_pelican-gitreceive.py b/tests/test_pelican-gitreceive.py index 196d591d292405e482845f646fa2435ae16809a7..9f94fd6e6040aa57e7a11426ec4af36ab58c3bcd 100644 --- a/tests/test_pelican-gitreceive.py +++ b/tests/test_pelican-gitreceive.py @@ -9,6 +9,7 @@ def test_git_push(Command, Sudo): push = Command('git -C /root/blog push test') assert push.rc == 0 for message in ['----> Unpacking ...', '----> Fetching submodules ...', + '----> Activating virtualenv ...', '----> Building blog ...', 'Copying blog ...', '----> Cleanup ...', '----> OK.']: assert message in push.stderr