Author: eelco
Date: Wed Apr 6 15:53:03 2011
New Revision: 26724
URL: https://svn.nixos.org/websvn/nix/?rev=26724&sc=1
Log:
* Add multipath-tools (specifically, kpartx) to nova-compute's $PATH
so that it can inject SSH keys into disk images.
* Use the injected key if available.
Modified:
nixos/trunk/modules/virtualisation/ec2-data.nix
nixos/trunk/modules/virtualisation/nova.nix
Modified: nixos/trunk/modules/virtualisation/ec2-data.nix
==============================================================================
--- nixos/trunk/modules/virtualisation/ec2-data.nix Wed Apr 6 15:36:49
2011 (r26723)
+++ nixos/trunk/modules/virtualisation/ec2-data.nix Wed Apr 6 15:53:03
2011 (r26724)
@@ -18,18 +18,22 @@
echo "setting host name..."
${pkgs.nettools}/bin/hostname $(${pkgs.curl}/bin/curl
http://169.254.169.254/1.0/meta-data/hostname)
- echo "obtaining SSH key..."
- mkdir -p /root/.ssh
- ${pkgs.curl}/bin/curl --retry 3 --retry-delay 0 --fail \
- -o /root/key.pub \
- http://169.254.169.254/1.0/meta-data/public-keys/0/openssh-key
- if [ $? -eq 0 -a -e /root/key.pub ]; then
- if ! grep -q -f /root/key.pub /root/.ssh/authorized_keys; then
- cat /root/key.pub >> /root/.ssh/authorized_keys
- echo "new key added to authorized_keys"
+ # Don't download the SSH key if it has already been injected
+ # into the image (a Nova feature).
+ if ! [ -e /root/.ssh/authorized_keys ]; then
+ echo "obtaining SSH key..."
+ mkdir -p /root/.ssh
+ ${pkgs.curl}/bin/curl --retry 3 --retry-delay 0 --fail \
+ -o /root/key.pub \
+ http://169.254.169.254/1.0/meta-data/public-keys/0/openssh-key
+ if [ $? -eq 0 -a -e /root/key.pub ]; then
+ if ! grep -q -f /root/key.pub /root/.ssh/authorized_keys;
then
+ cat /root/key.pub >> /root/.ssh/authorized_keys
+ echo "new key added to authorized_keys"
+ fi
+ chmod 600 /root/.ssh/authorized_keys
+ rm -f /root/key.pub
fi
- chmod 600 /root/.ssh/authorized_keys
- rm -f /root/key.pub
fi
# Print the host public key on the console so that the user
Modified: nixos/trunk/modules/virtualisation/nova.nix
==============================================================================
--- nixos/trunk/modules/virtualisation/nova.nix Wed Apr 6 15:36:49 2011
(r26723)
+++ nixos/trunk/modules/virtualisation/nova.nix Wed Apr 6 15:53:03 2011
(r26724)
@@ -104,7 +104,7 @@
path =
[ pkgs.sudo pkgs.vlan pkgs.nettools pkgs.iptables pkgs.qemu_kvm
- pkgs.e2fsprogs pkgs.utillinux
+ pkgs.e2fsprogs pkgs.utillinux pkgs.multipath_tools
];
exec = "${nova}/bin/nova-compute --nodaemon --verbose";
_______________________________________________
nix-commits mailing list
[email protected]
http://mail.cs.uu.nl/mailman/listinfo/nix-commits