Skip to content
Permalink
Browse files

Merge branch 'nqb-vagrant-not-mounted'

  • Loading branch information...
drybjed committed Oct 5, 2019
2 parents 57bfb39 + b0d6ef5 commit 20cc7ba4e446269bc90aa04a6c0bdbf7b4c971bf
Showing with 54 additions and 19 deletions.
  1. +9 −0 CHANGELOG.rst
  2. +45 −19 Vagrantfile
@@ -129,6 +129,15 @@ Updates of upstream application versions
- In the :ref:`debops.netbox` role, the NetBox version has been updated to
``v2.6.3``.

Continuous Integration
''''''''''''''''''''''

- The ``$DEBOPS_FROM`` environment variable can be used to select how DebOps
scripts should be installed in the Vagrant environment: either ``devel``
(local build) or ``pypi`` (installation from PyPI repository). This makes
Vagrant environment more useful on Windows hosts, where :file:`/vagrant`
directory is not mounted due to issues with symlinks.

General
'''''''

@@ -21,9 +21,12 @@
# VAGRANT_NODE_BOX="debian/buster64"
# Specify the box to use for nodes.
#
# ANSIBLE_FROM="debian" / ANSIBLE_FROM="pypi" / ANSIBLE_FROM="devel"
# ANSIBLE_FROM="debian" (default) / ANSIBLE_FROM="pypi" / ANSIBLE_FROM="devel"
# Specify the way to install ansible.
#
# DEBOPS_FROM="devel" / DEBOPS_FROM="pypi"
# Specify the way to install debops.
#
# VAGRANT_HOSTNAME="buster"
# Set a custom hostname after the box boots up.
#
@@ -184,6 +187,7 @@ readonly PROVISION_APT_HTTP_PROXY="#{ENV['APT_HTTP_PROXY']}"
readonly PROVISION_APT_HTTPS_PROXY="#{ENV['APT_HTTPS_PROXY']}"
readonly PROVISION_APT_FORCE_NETWORK="#{ENV['APT_FORCE_NETWORK']}"
readonly PROVISION_ANSIBLE_FROM="#{ENV['ANSIBLE_FROM'] || 'debian'}"
readonly PROVISION_DEBOPS_FROM="#{ENV['DEBOPS_FROM'] || 'devel'}"
readonly VAGRANT_PREPARE_BOX="#{ENV['VAGRANT_PREPARE_BOX']}"
# Install the Jane script
@@ -329,6 +333,14 @@ else
ansible_from_devel="${PROVISION_ANSIBLE_FROM}"
fi
debops_from_pypi=""
debops_from_devel=""
if [ "${PROVISION_DEBOPS_FROM}" == "pypi" ] || ! [ -d "/vagrant" ] ; then
debops_from_pypi="debops"
else
debops_from_devel="true"
fi
# Configure Ansible
if ! type ansible > /dev/null 2>&1 ; then
jane notify warning "Ansible not found"
@@ -463,15 +475,17 @@ if [ -z "${JANE_BOX_INIT:-}" ] ; then
# vagrant-libvirt executes virt-sysprep during box packaging.
# virt-sysprep zeroes out files in /usr/local/*, apparently.
# So we need to install PyPI packages on the real box, not the template.
jane notify install "Installing test requirements via PyPI..."
pip3 install netaddr python-ldap dnspython passlib future testinfra ${ansible_from_pypi}
mkdir /tmp/build
rsync -a --exclude '.vagrant' /vagrant/ /tmp/build
cd /tmp/build
make sdist > /dev/null
pip3 install dist/*
cd - > /dev/null
jane notify install "Installing requirements via PyPI..."
pip3 install netaddr python-ldap dnspython passlib future testinfra ${ansible_from_pypi} ${debops_from_pypi}
if [ -n "${debops_from_devel}" ] ; then
mkdir /tmp/build
rsync -a --exclude '.vagrant' /vagrant/ /tmp/build
cd /tmp/build
make sdist > /dev/null
pip3 install dist/*
cd - > /dev/null
fi
jane notify cache "Cleaning up cache directories..."
rm -rf /root/.cache/* /tmp/*
@@ -557,6 +571,7 @@ $provision_controller = <<SCRIPT
set -o nounset -o pipefail -o errexit
readonly PROVISION_ANSIBLE_FROM="#{ENV['ANSIBLE_FROM'] || 'debian'}"
readonly PROVISION_DEBOPS_FROM="#{ENV['DEBOPS_FROM'] || 'devel'}"
jane notify info "Configuring Ansible Controller host..."
@@ -569,22 +584,33 @@ if [ "${PROVISION_ANSIBLE_FROM}" == "pypi" ] ; then
ansible_from_pypi="ansible"
fi
jane notify install "Installing test requirements via PyPI..."
debops_from_pypi=""
debops_from_devel=""
if [ "${PROVISION_DEBOPS_FROM}" == "pypi" ] || ! [ -d "/vagrant" ] ; then
debops_from_pypi="debops"
else
debops_from_devel="true"
fi
jane notify install "Installing requirements via PyPI..."
sudo pip3 install netaddr python-ldap dnspython passlib future testinfra ${ansible_from_pypi}
mkdir /tmp/build
rsync -a --exclude '.vagrant' /vagrant/ /tmp/build
cd /tmp/build
make sdist > /dev/null
sudo pip3 install dist/*
cd - > /dev/null
sudo pip3 install netaddr python-ldap dnspython passlib future testinfra ${ansible_from_pypi} ${debops_from_pypi}
if [ -n "${debops_from_devel}" ] ; then
mkdir /tmp/build
rsync -a --exclude '.vagrant' /vagrant/ /tmp/build
cd /tmp/build
make sdist > /dev/null
sudo pip3 install dist/*
cd - > /dev/null
fi
jane notify cache "Cleaning up cache directories..."
sudo rm -rf /root/.cache/* /tmp/*
if ! [ -e .local/share/debops/debops ] ; then
mkdir -p src .local/share/debops
if [ -d "/vagrant" ] ; then
if [ -n "${debops_from_devel}" ] ; then
jane notify info "Symlinking '/vagrant' to '~vagrant/.local/share/debops/debops'"
ln -s /vagrant .local/share/debops/debops
else

0 comments on commit 20cc7ba

Please sign in to comment.
You can’t perform that action at this time.