Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Allow puppet scripts to be more customizable

Includes easier bash setup/use, including persistant bash as
shell inside local.pp and better bashrc stuff.
  • Loading branch information...
commit b06d8068303d090ecf8ce9d68bf1dda271ba2217 1 parent 2931eeb
Matthew Riley MacPherson authored
13 puppet/files/home/vagrant/bashrc_vagrant
View
@@ -0,0 +1,13 @@
+# bash aliases
+alias dj="./manage.py"
+alias runserver="dj runserver 0.0.0.0:8000"
+alias rs="runserver"
+alias t="dj test -x --logging-clear-handlers --with-nicedots"
+alias td="FORCE_DB=True t --noinput"
+alias tf="dj test --logging-clear-handlers --with-nicedots --failed"
+alias tp="t --pdb --pdb-failure"
+
+# Customize to your needs...
+export PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/opt/ruby/bin/
+
+cd $HOME/mozillians
1  puppet/manifests/classes/.gitignore
View
@@ -0,0 +1 @@
+local.pp
11 puppet/manifests/classes/dev_hacks.pp
View
@@ -6,6 +6,17 @@
source => "$PROJ_DIR/settings/local.py-dist";
}
+ file { "/home/vagrant/.bashrc_vagrant":
+ ensure => file,
+ source => "$PROJ_DIR/puppet/files/home/vagrant/bashrc_vagrant",
+ owner => "vagrant", group => "vagrant", mode => 0644;
+ }
+
+ # Put our custom bash commands in a separate file.
+ exec { "amend_rc":
+ command => "echo 'if [ -f /home/vagrant/.bashrc_vagrant ] && ! shopt -oq posix; then . /home/vagrant/.bashrc_vagrant; fi' >> /home/vagrant/.bashrc"
+ }
+
file { "/home/vagrant/.zshrc":
ensure => file,
source => "$PROJ_DIR/puppet/files/home/vagrant/zshrc",
20 puppet/manifests/classes/local.pp-dist
View
@@ -0,0 +1,20 @@
+# You can customize this file however you like; it won't be overwritten by
+# vagrant/puppet/git.
+
+# TODO: Have this file have a bunch of variables that are currently in
+# dev-vagrant.pp so you can toggle provisioning steps locally.
+class local {
+
+ # Example: use bash as the default shell instead of zsh with oh-my-zsh.
+ exec { "use_bash":
+ command => "sudo chsh vagrant -s /bin/bash",
+ }
+
+ # Put our custom bash commands in a separate file.
+ # TODO: This is only here because the box wasn't provisioned with this
+ # inside its .bashrc. Next box provision you can remove this.
+ exec { "amend_rc":
+ command => "echo 'if [ -f /home/vagrant/.bashrc_vagrant ] && ! shopt -oq posix; then . /home/vagrant/.bashrc_vagrant; fi' >> /home/vagrant/.bashrc"
+ }
+
+}
19 puppet/manifests/dev-vagrant.pp
View
@@ -12,12 +12,25 @@
$USE_YUM_CACHE_ON_HOST = 0
$USE_SOUTH = 1
+# Set this to zero to reprovision a box from scatch. It will take awhile.
$DONT_REPROVISION = 1
Exec {
path => "/usr/local/bin:/usr/bin:/usr/sbin:/sbin:/bin",
}
+# You can define custom puppet commands to tailor your local development
+# environment to your taste in classes/local.pp. See local.py-dist for an
+# example.
+#
+# When provisioning a new box, don't include your local customizations.
+# TODO: Disable provisioning if local class is defined.
+if defined(local) {
+ include local
+} else {
+ notice("No local.pp found; use classes/local.pp for customizations.")
+}
+
class dev {
class {
init: before => Class[dev_hacks];
@@ -40,6 +53,12 @@
source => "$PROJ_DIR/settings/local.py-dist";
}
+ file { "/home/vagrant/.bashrc_vagrant":
+ ensure => file,
+ source => "$PROJ_DIR/puppet/files/home/vagrant/bashrc_vagrant",
+ owner => "vagrant", group => "vagrant", mode => 0644;
+ }
+
file { "/home/vagrant/.zshrc":
ensure => file,
source => "$PROJ_DIR/puppet/files/home/vagrant/zshrc",
Please sign in to comment.
Something went wrong with that request. Please try again.