From 0d714dcec16d9d8760f6656d9be0b29964d51343 Mon Sep 17 00:00:00 2001 From: Dylan William Hardison Date: Mon, 24 Apr 2017 15:51:44 -0400 Subject: fix some recurring vagrant issues with perms, and copy .git into vm --- vagrant_support/bmo-checksetup.j2 | 12 +++++++++++ vagrant_support/bmo-configured | 39 ------------------------------------ vagrant_support/bmo-generate-data.j2 | 4 ++++ vagrant_support/bmo-reconfigure.j2 | 7 ------- vagrant_support/checksetup.yml | 33 +++++++++++++----------------- vagrant_support/playbook.yml | 2 +- 6 files changed, 31 insertions(+), 66 deletions(-) create mode 100755 vagrant_support/bmo-checksetup.j2 delete mode 100755 vagrant_support/bmo-configured create mode 100644 vagrant_support/bmo-generate-data.j2 delete mode 100755 vagrant_support/bmo-reconfigure.j2 (limited to 'vagrant_support') diff --git a/vagrant_support/bmo-checksetup.j2 b/vagrant_support/bmo-checksetup.j2 new file mode 100755 index 000000000..c35a323c3 --- /dev/null +++ b/vagrant_support/bmo-checksetup.j2 @@ -0,0 +1,12 @@ +#!/bin/bash + +cd /vagrant + +if [[ ! -f ~/localconfig || ! -f /data/params ]]; then + perl checksetup.pl /home/vagrant/checksetup_answers.txt + perl checksetup.pl /home/vagrant/checksetup_answers.txt +else + cp ~/localconfig /vagrant + perl checksetup.pl < /dev/null + cp /vagrant/localconfig ~/ +fi diff --git a/vagrant_support/bmo-configured b/vagrant_support/bmo-configured deleted file mode 100755 index 4d421577b..000000000 --- a/vagrant_support/bmo-configured +++ /dev/null @@ -1,39 +0,0 @@ -#!/bin/bash - -if [[ ! -f /vagrant/localconfig ]]; then - echo "missing localconfig" - exit 1 -fi - -if [[ ! -f /vagrant/data/params ]]; then - echo "missing data/params" - exit 1 -fi - -if grep -q "'urlbase' => ''" /vagrant/data/params; then - echo "urlbase not configured" - exit 1; -fi - -if grep -q '$db_host.*localhost' /vagrant/localconfig; then - echo "\$db_host not configured" - exit 1 -fi - -for file in /vagrant/data/params /vagrant/index.cgi; do - info="$(stat -c %U.%G "$file")" - - if [[ $info != "vagrant.apache" ]]; then - echo "wrong file owner: $info $file" - exit 1 - fi -done - -cd /vagrant -sudo -u apache perl -T index.cgi &>/tmp/index.html || exit 1 - -grep -q skin-Dusk /tmp/index.html && exit 1 - -rm /tmp/index.html - -exit 0 diff --git a/vagrant_support/bmo-generate-data.j2 b/vagrant_support/bmo-generate-data.j2 new file mode 100644 index 000000000..79798ba4d --- /dev/null +++ b/vagrant_support/bmo-generate-data.j2 @@ -0,0 +1,4 @@ +#!/bin/bash + +cd /vagrant +perl scripts/generate_bmo_data.pl 'vagrant@{{ WEB_HOSTNAME }}' diff --git a/vagrant_support/bmo-reconfigure.j2 b/vagrant_support/bmo-reconfigure.j2 deleted file mode 100755 index 77a9d2465..000000000 --- a/vagrant_support/bmo-reconfigure.j2 +++ /dev/null @@ -1,7 +0,0 @@ -#!/bin/bash - -cd /vagrant -rm localconfig data/params -perl checksetup.pl /home/vagrant/checksetup_answers.txt -perl checksetup.pl /home/vagrant/checksetup_answers.txt -perl scripts/generate_bmo_data.pl 'vagrant@{{ WEB_HOSTNAME }}' diff --git a/vagrant_support/checksetup.yml b/vagrant_support/checksetup.yml index 5bac17662..6b54ef18d 100644 --- a/vagrant_support/checksetup.yml +++ b/vagrant_support/checksetup.yml @@ -1,8 +1,14 @@ --- -- name: bmo reconfiguration script +- name: bmo checksetup script template: - src: bmo-reconfigure.j2 - dest: /usr/local/bin/bmo-reconfigure + src: bmo-checksetup.j2 + dest: /usr/local/bin/bmo-checksetup + mode: 0755 + +- name: bmo generate data script + template: + src: bmo-generate-data.j2 + dest: /usr/local/bin/bmo-generate-data mode: 0755 - name: bmo checksetup answers @@ -13,22 +19,11 @@ group: vagrant mode: 0644 -- name: copy bmo config checker script - copy: - src: bmo-configured - dest: /usr/local/bin/bmo-configured - mode: 0755 - -- name: 'check bmo config (failure is okay)' - shell: /usr/local/bin/bmo-configured - register: bmo_configured - ignore_errors: true +- name: run checksetup + become: false + shell: sg apache -c '/usr/local/bin/bmo-checksetup' -- name: configure bmo +- name: generate data become: false - shell: sg apache -c '/usr/local/bin/bmo-reconfigure' - when: bmo_configured|failed + shell: sg apache -c '/usr/local/bin/bmo-generate-data' -- name: check bmo config - shell: /usr/local/bin/bmo-configured - when: bmo_configured|failed diff --git a/vagrant_support/playbook.yml b/vagrant_support/playbook.yml index c8ebff01f..a8deeca27 100644 --- a/vagrant_support/playbook.yml +++ b/vagrant_support/playbook.yml @@ -150,7 +150,7 @@ - name: make bmo data dir file: path=/data state=directory owner=vagrant group=apache mode=0775 - - name: fix perms + - name: fix owner of /vagrant file: path=/vagrant state=directory owner=vagrant group=apache recurse=yes - name: add data symlink -- cgit v1.2.3-24-g4f1b