Ori.livneh has uploaded a new change for review.
https://gerrit.wikimedia.org/r/55855
Change subject: Customize shell; remove stale LocalSettings.php
......................................................................
Customize shell; remove stale LocalSettings.php
- If auto-generated LocalSettings.php is present, but the database it specifies
is not, assume it is left over from a previous VM instance and re-run
install.php.
- Correct 'mediawiki' in .gitignore to '/mediawiki/', so it doesn't ignore
files in puppet/modules/mediawiki.
- Add color.sh and phpsh.sh to /etc/profile.d: the former specifies a colorful
prompt should be used, and the latter makes phpsh always execute with
/vagrant/mediawiki as its cwd.
- Consume '--debug' flag from the command line; if it is present, pass it on to
Puppet.
- Specify 'Ubuntu_64' os_type to VirtualBox.
Change-Id: Ic989d6b9ff56419ec77b4c6d5d2c8dcf5341a499
---
M .gitignore
M Vagrantfile
A puppet/modules/mediawiki/files/color.sh
A puppet/modules/mediawiki/files/phpsh.sh
M puppet/modules/mediawiki/manifests/init.pp
M puppet/modules/mediawiki/manifests/phpsh.pp
6 files changed, 31 insertions(+), 5 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/mediawiki/vagrant
refs/changes/55/55855/1
diff --git a/.gitignore b/.gitignore
index 5fe9635..aca2ce6 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,4 +1,4 @@
.vagrant
LocalSettings.php
tags
-mediawiki
+/mediawiki/
diff --git a/Vagrantfile b/Vagrantfile
index 55bc87a..4c55edd 100644
--- a/Vagrantfile
+++ b/Vagrantfile
@@ -6,7 +6,6 @@
system( '( nfsstat || nfsiostat ) &>/dev/null' ) and not $?.exitstatus
end
-
Vagrant.configure('2') do |config|
config.vm.hostname = 'mediawiki-vagrant'
@@ -38,7 +37,8 @@
nfs: host_supports_nfs?
config.vm.provider :virtualbox do |vb|
- vb.customize ['modifyvm', :id, '--memory', '512']
+ # See http://www.virtualbox.org/manual/ch08.html for additional
options.
+ vb.customize ['modifyvm', :id, '--memory', '512', '--ostype',
'Ubuntu_64']
end
config.vm.provision :shell do |s|
@@ -50,7 +50,7 @@
puppet.module_path = 'puppet/modules'
puppet.manifests_path = 'puppet/manifests'
puppet.manifest_file = 'site.pp'
- puppet.options = '--verbose' # Add '--debug' for more output
+ puppet.options = ['--verbose', ARGV.delete('--debug')].compact
end
end
diff --git a/puppet/modules/mediawiki/files/color.sh
b/puppet/modules/mediawiki/files/color.sh
new file mode 100755
index 0000000..d6520b3
--- /dev/null
+++ b/puppet/modules/mediawiki/files/color.sh
@@ -0,0 +1,2 @@
+#!/bin/sh
+export force_color_prompt="yes"
diff --git a/puppet/modules/mediawiki/files/phpsh.sh
b/puppet/modules/mediawiki/files/phpsh.sh
new file mode 100644
index 0000000..cb15d1b
--- /dev/null
+++ b/puppet/modules/mediawiki/files/phpsh.sh
@@ -0,0 +1,8 @@
+# Ensure that we're in an interactive bash session.
+[ -z "$BASH_VERSION" -o -z "$PS1" ] && return
+phpsh () {
+ (
+ cd /vagrant/mediawiki
+ command phpsh "$@"
+ )
+}
diff --git a/puppet/modules/mediawiki/manifests/init.pp
b/puppet/modules/mediawiki/manifests/init.pp
index 277e486..4bb7451 100644
--- a/puppet/modules/mediawiki/manifests/init.pp
+++ b/puppet/modules/mediawiki/manifests/init.pp
@@ -22,6 +22,16 @@
ensure => absent,
}
+ # If an auto-generated LocalSettings.php file exists but the database it
+ # refers to is missing, assume it is residual of a discarded instance
and
+ # delete it.
+ exec { 'check-settings':
+ command => 'rm /vagrant/mediawiki/LocalSettings.php 2>/dev/null
|| true',
+ require => [ Package['php5'], Exec['fetch-mediawiki'],
Service['mysql'] ],
+ unless => 'php /vagrant/mediawiki/maintenance/eval.php
<<<"wfGetDB(-1)" &>/dev/null',
+ before => Exec['mediawiki-setup'],
+ }
+
apache::site { 'wiki':
ensure => present,
content => template('mediawiki/mediawiki-apache-site.erb'),
diff --git a/puppet/modules/mediawiki/manifests/phpsh.pp
b/puppet/modules/mediawiki/manifests/phpsh.pp
index d1b775f..df44808 100644
--- a/puppet/modules/mediawiki/manifests/phpsh.pp
+++ b/puppet/modules/mediawiki/manifests/phpsh.pp
@@ -8,10 +8,16 @@
exec { 'pip-install-phpsh':
creates => '/usr/local/bin/phpsh',
command => 'pip install
https://github.com/facebook/phpsh/tarball/master',
- onlyif => 'ping -c1 -W0.5 -q github.com', # only if GitHub is
reachable
+ onlyif => 'ping -c1 -w0.5 -q github.com', # only if GitHub is
reachable
require => Package['php5', 'python-pip'],
}
+ file { '/etc/profile.d/phpsh.sh':
+ ensure => file,
+ mode => '0755',
+ source => 'puppet:///modules/mediawiki/phpsh.sh',
+ }
+
file { '/etc/phpsh':
ensure => directory,
}
--
To view, visit https://gerrit.wikimedia.org/r/55855
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Ic989d6b9ff56419ec77b4c6d5d2c8dcf5341a499
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/vagrant
Gerrit-Branch: master
Gerrit-Owner: Ori.livneh <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits