]> git.ipfire.org Git - thirdparty/bugzilla.git/commitdiff
fix some recurring vagrant issues with perms, and copy .git into vm
authorDylan William Hardison <dylan@hardison.net>
Mon, 24 Apr 2017 19:51:44 +0000 (15:51 -0400)
committerDylan William Hardison <dylan@hardison.net>
Mon, 24 Apr 2017 19:51:44 +0000 (15:51 -0400)
Vagrantfile
vagrant_support/bmo-checksetup.j2 [new file with mode: 0755]
vagrant_support/bmo-configured [deleted file]
vagrant_support/bmo-generate-data.j2 [new file with mode: 0644]
vagrant_support/bmo-reconfigure.j2 [deleted file]
vagrant_support/checksetup.yml
vagrant_support/playbook.yml

index 88c68d05282b6734927e892c45e99fdf3283f6c2..642fe2f92afe4f8f08dc42ead3c5cdebc6f651a1 100644 (file)
@@ -14,6 +14,19 @@ WEB_CPU      = ENV.fetch "BMO_WEB_CPU",  2
 VENDOR_BUNDLE_URL = ENV.fetch "BMO_BUNDLE_URL",
   'https://moz-devservices-bmocartons.s3.amazonaws.com/bmo/vendor.tar.gz'
 
+RSYNC_ARGS = [
+  '--verbose',
+  '--archive',
+  '--delete',
+  '-z',
+  '--copy-links',
+  '--exclude=local/',
+  '--exclude=data/',
+  '--exclude=template_cache/',
+  '--exclude=localconfig',
+  '--include=.git/'
+]
+
 # All Vagrant configuration is done below. The '2' in Vagrant.configure
 # configures the configuration version (we support older styles for
 # backwards compatibility). Please don't change it unless you know what
@@ -45,12 +58,7 @@ Vagrant.configure('2') do |config|
       guest: 22,
       auto_correct: true
 
-    db.vm.synced_folder '.', '/vagrant', type: 'rsync',
-      rsync__args: ['--verbose', '--archive', '--delete', '-z', '--copy-links',
-                    '--exclude=local/',
-                    '--exclude=data/',
-                    '--exclude=template_cache/',
-                    '--exclude=localconfig']
+    db.vm.synced_folder '.', '/vagrant', type: 'rsync', rsync__args: RSYNC_ARGS
     db.vm.provider 'parallels' do |prl, override|
       override.vm.box = 'parallels/centos-6.8'
     end
@@ -72,12 +80,7 @@ Vagrant.configure('2') do |config|
       auto_correct: true
 
 
-    web.vm.synced_folder '.', '/vagrant', type: 'rsync',
-      rsync__args: ['--verbose', '--archive', '--delete', '-z', '--copy-links',
-                    '--exclude=local/',
-                    '--exclude=data/',
-                    '--exclude=template_cache/',
-                    '--exclude=localconfig']
+    web.vm.synced_folder '.', '/vagrant', type: 'rsync', rsync__args: RSYNC_ARGS
 
     web.vm.provider 'virtualbox' do |v|
       v.memory = WEB_MEM
diff --git a/vagrant_support/bmo-checksetup.j2 b/vagrant_support/bmo-checksetup.j2
new file mode 100755 (executable)
index 0000000..c35a323
--- /dev/null
@@ -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 (executable)
index 4d42157..0000000
+++ /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 (file)
index 0000000..79798ba
--- /dev/null
@@ -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 (executable)
index 77a9d24..0000000
+++ /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 }}'
index 5bac17662150a241d4faa04f53856c13b6398c2c..6b54ef18d3d8617b1c67e84b96f2d9f288fcc99f 100644 (file)
@@ -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
     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
index c8ebff01f7a9d0762ef5bde7f49e677f9726d982..a8deeca27e6997c2060f86d192cc593de517ee6e 100644 (file)
     - 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