From 4ef03f141ce5ed56fb9840a56988b6c2afc0f8aa Mon Sep 17 00:00:00 2001 From: Jan Dittberner Date: Tue, 3 Mar 2020 15:29:19 +0100 Subject: [PATCH 1/7] Update issue and tag URLs for releases Sphinx plugin --- docs/conf.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/conf.py b/docs/conf.py index 96bfdb0..899f675 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -37,8 +37,8 @@ django.setup() extensions = ['releases', 'sphinx.ext.autodoc', 'celery.contrib.sphinx'] # configuration for releases extension -releases_issue_uri = 'https://dev.gnuviech-server.de/gvaldap/ticket/%s' -releases_release_uri = 'https://dev.gnuviech-server.de/gvaldap/browser/?rev=%s' +releases_issue_uri = 'https://git.dittberner.info/gnuviech/gvaldap/issues/%s' +releases_release_uri = 'https://git.dittberner.info/gnuviech/gvaldap/src/tag/%s' # Add any paths that contain templates here, relative to this directory. templates_path = ['_templates'] @@ -54,7 +54,7 @@ master_doc = 'index' # General information about the project. project = u'gvaldap' -copyright = u'2014-2020 Jan Dittberner' +copyright = u'2014-2020, Jan Dittberner' # The version info for the project you're documenting, acts as replacement for # |version| and |release|, also used in various other places throughout the From b54b8577cbefb9f495ee38653eb70e2671762a85 Mon Sep 17 00:00:00 2001 From: Jan Dittberner Date: Tue, 3 Mar 2020 16:14:20 +0100 Subject: [PATCH 2/7] Update Vagrant setup to Debian Buster and Python 3 --- Vagrantfile | 3 ++- docs/changelog.rst | 2 ++ salt/bootstrap.sh | 14 ++++++++------ 3 files changed, 12 insertions(+), 7 deletions(-) diff --git a/Vagrantfile b/Vagrantfile index 64decd5..479db84 100644 --- a/Vagrantfile +++ b/Vagrantfile @@ -2,7 +2,7 @@ # vi: set ft=ruby : Vagrant.configure(2) do |config| - config.vm.box = "debian/stretch64" + config.vm.box = "debian/buster64" config.vm.hostname = "gvaldap.local" config.vm.network "private_network", ip: "172.16.3.3", lxc__bridge_name: 'vlxcbr1' @@ -14,6 +14,7 @@ Vagrant.configure(2) do |config| config.vm.provision :salt do |salt| salt.bootstrap_script = "salt/bootstrap.sh" + salt.bootstrap_options = "-x python3" salt.minion_id = "gvaldap" salt.masterless = true salt.run_highstate = true diff --git a/docs/changelog.rst b/docs/changelog.rst index fe55a8d..9712d6e 100644 --- a/docs/changelog.rst +++ b/docs/changelog.rst @@ -1,6 +1,8 @@ Changelog ========= +* :support:`-` update Vagrant setup to Debian Buster and Python 3 + * :release:`0.6.0 <2020-03-03>` * :support:`-` add Python 3 support * :support:`-` upgrade to Django 2.2.10 diff --git a/salt/bootstrap.sh b/salt/bootstrap.sh index faeed2e..52f5494 100755 --- a/salt/bootstrap.sh +++ b/salt/bootstrap.sh @@ -1,19 +1,21 @@ #!/bin/sh - apt-get update -apt-get install -y python-cryptography +apt-get install -y python3-cryptography + +export salt_bootstrap_url=https://bootstrap.saltstack.com/ # We just download the bootstrap script by default and execute that. if [ -x /usr/bin/fetch ]; then - /usr/bin/fetch -o - https://raw.githubusercontent.com/saltstack/salt-bootstrap/stable/bootstrap-salt.sh | sh -s -- "$@" + /usr/bin/fetch -o - $salt_bootstrap_url | sh -s -- "$@" elif [ -x /usr/bin/curl ]; then - /usr/bin/curl -L https://raw.githubusercontent.com/saltstack/salt-bootstrap/stable/bootstrap-salt.sh | sh -s -- "$@" + /usr/bin/curl -L $salt_bootstrap_url | sh -s -- "$@" else - python \ - -c 'import urllib; print urllib.urlopen("https://raw.githubusercontent.com/saltstack/salt-bootstrap/stable/bootstrap-salt.sh").read()' \ - | sh -s -- "$@" + python3 -c "from urllib.request import urlopen; print(urlopen(\"$salt_bootstrap_url\").read().decode('utf-8'))" | sh -s -- "$@" fi +mkdir -p /etc/salt + cat >/etc/salt/minion < Date: Tue, 3 Mar 2020 22:11:46 +0100 Subject: [PATCH 3/7] Optimize Vagrant setup - define grains to match optimized gvasalt repository - define minion configuration in separate file - drop custome salt/bootstrap.sh - adapt Vagrantfile to use the custom grains file - increase memory size of created VM to allow the salt provisioning to succeed --- Vagrantfile | 6 +++++- salt/bootstrap.sh | 38 -------------------------------------- salt/grains | 14 ++++++++++++++ salt/minion | 11 +++++++++++ 4 files changed, 30 insertions(+), 39 deletions(-) delete mode 100755 salt/bootstrap.sh create mode 100644 salt/grains create mode 100644 salt/minion diff --git a/Vagrantfile b/Vagrantfile index 479db84..3a03a6c 100644 --- a/Vagrantfile +++ b/Vagrantfile @@ -12,8 +12,11 @@ Vagrant.configure(2) do |config| config.vm.synced_folder "../gvasalt/states/", "/srv/salt/" config.vm.synced_folder "../gvasalt/pillar/", "/srv/pillar/" + config.vm.provider :libvirt do |libvirt| + libvirt.memory = 1024 + end + config.vm.provision :salt do |salt| - salt.bootstrap_script = "salt/bootstrap.sh" salt.bootstrap_options = "-x python3" salt.minion_id = "gvaldap" salt.masterless = true @@ -21,5 +24,6 @@ Vagrant.configure(2) do |config| salt.verbose = true salt.colorize = true salt.log_level = "warning" + salt.grains_config = "salt/grains" end end diff --git a/salt/bootstrap.sh b/salt/bootstrap.sh deleted file mode 100755 index 52f5494..0000000 --- a/salt/bootstrap.sh +++ /dev/null @@ -1,38 +0,0 @@ -#!/bin/sh - - -apt-get update -apt-get install -y python3-cryptography - -export salt_bootstrap_url=https://bootstrap.saltstack.com/ - -# We just download the bootstrap script by default and execute that. -if [ -x /usr/bin/fetch ]; then - /usr/bin/fetch -o - $salt_bootstrap_url | sh -s -- "$@" -elif [ -x /usr/bin/curl ]; then - /usr/bin/curl -L $salt_bootstrap_url | sh -s -- "$@" -else - python3 -c "from urllib.request import urlopen; print(urlopen(\"$salt_bootstrap_url\").read().decode('utf-8'))" | sh -s -- "$@" -fi - -mkdir -p /etc/salt - -cat >/etc/salt/minion </etc/salt/grains < Date: Wed, 4 Mar 2020 00:07:58 +0100 Subject: [PATCH 4/7] Make IP address assignment work with libvirt The systemd-networkd script in vmdebootstrap that is used to build the Debian libvirt vagrant boxes is a bit too eager assigning DHCP to network interfaces. This patch changes the network script to only take care of the primary network interface (first non loopback). --- Vagrantfile | 4 +++- change-vmdebootstrap-default-dhcp.sh | 15 +++++++++++++++ 2 files changed, 18 insertions(+), 1 deletion(-) create mode 100644 change-vmdebootstrap-default-dhcp.sh diff --git a/Vagrantfile b/Vagrantfile index 3a03a6c..9c6e103 100644 --- a/Vagrantfile +++ b/Vagrantfile @@ -5,7 +5,7 @@ Vagrant.configure(2) do |config| config.vm.box = "debian/buster64" config.vm.hostname = "gvaldap.local" - config.vm.network "private_network", ip: "172.16.3.3", lxc__bridge_name: 'vlxcbr1' + config.vm.network :private_network, :ip => "172.16.3.3" config.vm.network "forwarded_port", guest: 8000, host: 8001 @@ -16,6 +16,8 @@ Vagrant.configure(2) do |config| libvirt.memory = 1024 end + config.vm.provision :shell, path: "change-vmdebootstrap-default-dhcp.sh" + config.vm.provision :salt do |salt| salt.bootstrap_options = "-x python3" salt.minion_id = "gvaldap" diff --git a/change-vmdebootstrap-default-dhcp.sh b/change-vmdebootstrap-default-dhcp.sh new file mode 100644 index 0000000..384bb39 --- /dev/null +++ b/change-vmdebootstrap-default-dhcp.sh @@ -0,0 +1,15 @@ +#!/bin/sh + +set -e + +debootstrap_network=/etc/systemd/network/99-dhcp.network + +if grep -q '^Name=\\*' "${debootstrap_network}"; then + primary_nic=$(ls -1 /sys/class/net | grep -v lo |sort | head -1) + sed -i "s/^Name=e\\*/Name=${primary_nic})/" \ + "${debootstrap_network}" + systemctl restart systemd-networkd.service + echo "Changed systemd network configuration" +else + echo "Systemd network configuration has already been changed" +fi From 11b6051bc0b2cc29b25531c497b574ac66fb6577 Mon Sep 17 00:00:00 2001 From: Jan Dittberner Date: Wed, 4 Mar 2020 00:27:49 +0100 Subject: [PATCH 5/7] Fix typo in change-vmdebootstrap-default-dhcp.sh --- change-vmdebootstrap-default-dhcp.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/change-vmdebootstrap-default-dhcp.sh b/change-vmdebootstrap-default-dhcp.sh index 384bb39..a5f3c38 100644 --- a/change-vmdebootstrap-default-dhcp.sh +++ b/change-vmdebootstrap-default-dhcp.sh @@ -6,7 +6,7 @@ debootstrap_network=/etc/systemd/network/99-dhcp.network if grep -q '^Name=\\*' "${debootstrap_network}"; then primary_nic=$(ls -1 /sys/class/net | grep -v lo |sort | head -1) - sed -i "s/^Name=e\\*/Name=${primary_nic})/" \ + sed -i "s/^Name=e\\*/Name=${primary_nic}/" \ "${debootstrap_network}" systemctl restart systemd-networkd.service echo "Changed systemd network configuration" From 562ae2a61a99c59f9d23b936394747d7910572e8 Mon Sep 17 00:00:00 2001 From: Jan Dittberner Date: Wed, 4 Mar 2020 17:20:59 +0100 Subject: [PATCH 6/7] Move some grains to pillars --- salt/grains | 4 ---- 1 file changed, 4 deletions(-) diff --git a/salt/grains b/salt/grains index 5434112..71f25e7 100644 --- a/salt/grains +++ b/salt/grains @@ -1,11 +1,7 @@ gnuviechadmin: user: vagrant group: vagrant - amqpuser: ldap - appname: gvaldap checkout: /vagrant - fullname: LDAP - giturl: gituser@nextgit.gnuviech-server.de:gnuviech/gvaldap.git home: /home/vagrant update_git: False roles: From 190e6e2a4b4fdf54574f2edb392eab0e8308002f Mon Sep 17 00:00:00 2001 From: Jan Dittberner Date: Mon, 6 Apr 2020 19:44:33 +0200 Subject: [PATCH 7/7] Bump version, update changelog --- docs/changelog.rst | 1 + gvaldap/gvaldap/__init__.py | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/docs/changelog.rst b/docs/changelog.rst index 9712d6e..255365d 100644 --- a/docs/changelog.rst +++ b/docs/changelog.rst @@ -1,6 +1,7 @@ Changelog ========= +* :release:`0.7.0 <2020-04-06>` * :support:`-` update Vagrant setup to Debian Buster and Python 3 * :release:`0.6.0 <2020-03-03>` diff --git a/gvaldap/gvaldap/__init__.py b/gvaldap/gvaldap/__init__.py index 3204c6a..ded3538 100644 --- a/gvaldap/gvaldap/__init__.py +++ b/gvaldap/gvaldap/__init__.py @@ -1,7 +1,7 @@ """ This is the gvaldap project module. """ -__version__ = "0.6.0" +__version__ = "0.7.0" from ldaptasks.celery import app as celery_app