From 017947b01c29657541e684f8f498b6702d914f2e Mon Sep 17 00:00:00 2001 From: Will Kelly Date: Thu, 11 Jul 2013 21:17:46 -0500 Subject: [PATCH 1/3] * Download syslinux from kernel.org --- fetch_images.sh | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/fetch_images.sh b/fetch_images.sh index 01482aa..5f138c7 100755 --- a/fetch_images.sh +++ b/fetch_images.sh @@ -4,12 +4,18 @@ # and initrds from somewhere # I should also be made into a manage.py command +OLDPWD="$PWD" +cd "$(dirname $0)" -wget http://c752981.r81.cf2.rackcdn.com/syslinux-needful.tar.gz -qO- | - tar xzC local/tftproot +echo "Downloading syslinux 6.01" +wget https://www.kernel.org/pub/linux/utils/boot/syslinux/syslinux-6.01.tar.bz2 -qO- | tar xj -mkdir local/tftproot/ubuntu -cd local/tftproot/ubuntu +cd local/tftproot +ln -s ../../syslinux-6.01/bios/core/pxelinux.0 +ln -s ../../syslinux-6.01/bios/com32/menu/menu.c32 +ln -s ../../syslinux-6.01/bios/com32/mboot/mboot.c32 +mkdir ubuntu +cd ubuntu images=( maverick natty oneiric precise) for image in ${images[@]}; do @@ -21,3 +27,4 @@ for image in ${images[@]}; do wget "http://archive.ubuntu.com/ubuntu/dists/${image}/main/installer-amd64/current/images/netboot/ubuntu-installer/amd64/${file}" -q -P ${image}-amd64; done; done; +cd $OLDPWD From 8e06477728071f53bf71ac6b86e9100881c66ea6 Mon Sep 17 00:00:00 2001 From: Will Kelly Date: Thu, 11 Jul 2013 22:15:30 -0500 Subject: [PATCH 2/3] need chain.c32 for local boot --- fetch_images.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/fetch_images.sh b/fetch_images.sh index 5f138c7..c6c4c57 100755 --- a/fetch_images.sh +++ b/fetch_images.sh @@ -14,6 +14,7 @@ cd local/tftproot ln -s ../../syslinux-6.01/bios/core/pxelinux.0 ln -s ../../syslinux-6.01/bios/com32/menu/menu.c32 ln -s ../../syslinux-6.01/bios/com32/mboot/mboot.c32 +ln -s ../../syslinux-6.01/bios/com32/chain/chain.c32 mkdir ubuntu cd ubuntu From 37a00500fd32270af8b08251ffb2f3c2d1f97443 Mon Sep 17 00:00:00 2001 From: Will Kelly Date: Thu, 11 Jul 2013 22:47:32 -0500 Subject: [PATCH 3/3] Use config values for ipmi user and password (fixes issue 22) --- rolemapper/remote.py | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/rolemapper/remote.py b/rolemapper/remote.py index 6fcf62c..b275095 100644 --- a/rolemapper/remote.py +++ b/rolemapper/remote.py @@ -1,14 +1,18 @@ import logging import subprocess - +from views import _get_site_config from django.conf import settings def _build_ipmi_command(host, *args): + config = _get_site_config(host) + user = config.get('ipmi_user', settings.IPMI_USER) + password = config.get('ipmi_password', settings.IPMI_PASSWORD) + return ['/usr/bin/ipmitool', '-H', host.ipmi_ip, - '-U', settings.IPMI_USER, - '-P', settings.IPMI_PASSWORD] + list(args) + '-U', user, + '-P', password] + list(args) def reboot(host): @@ -16,6 +20,8 @@ def reboot(host): # 'cycle' was not sufficient command = _build_ipmi_command(host, 'power', 'reset') logging.info('Rebooting: %s', host.hostname) + logging.debug("Using command %s" % command) + try: subprocess.check_call(command) except Exception: @@ -25,6 +31,7 @@ def reboot(host): def pxe_reboot(host): command = _build_ipmi_command(host, 'chassis', 'bootdev', 'pxe') logging.info('Setting PXE Boot for: %s', host.hostname) + logging.debug("Using command %s" % command) try: subprocess.check_call(command) except Exception: