Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug fixes (fixes issue 20, fixes issue 22) #24

Merged
merged 3 commits into from
Jul 12, 2013
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 12 additions & 4 deletions fetch_images.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,19 @@
# 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
ln -s ../../syslinux-6.01/bios/com32/chain/chain.c32
mkdir ubuntu
cd ubuntu

images=( maverick natty oneiric precise)
for image in ${images[@]}; do
Expand All @@ -21,3 +28,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
13 changes: 10 additions & 3 deletions rolemapper/remote.py
Original file line number Diff line number Diff line change
@@ -1,21 +1,27 @@
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):
# 'reset' performs a cold reboot, which is necessary for pxe booting to work
# '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:
Expand All @@ -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:
Expand Down