[pve-devel] [PATCH container 3/4] Add ssh key setup to create_rootfs
Fabian Grünbichler
f.gruenbichler at proxmox.com
Tue Apr 5 13:17:02 CEST 2016
expose the new post_create_hook parameter in create_rootfs
---
src/PVE/LXC/Create.pm | 9 +++++----
1 file changed, 5 insertions(+), 4 deletions(-)
diff --git a/src/PVE/LXC/Create.pm b/src/PVE/LXC/Create.pm
index 1be3639..6c2c735 100644
--- a/src/PVE/LXC/Create.pm
+++ b/src/PVE/LXC/Create.pm
@@ -134,7 +134,7 @@ sub recover_config {
}
sub restore_and_configure {
- my ($vmid, $archive, $rootdir, $conf, $password, $restore, $no_unpack_error) = @_;
+ my ($vmid, $archive, $rootdir, $conf, $password, $restore, $no_unpack_error, $ssh_keys) = @_;
restore_archive($archive, $rootdir, $conf, $no_unpack_error);
@@ -142,7 +142,7 @@ sub restore_and_configure {
my $lxc_setup = PVE::LXC::Setup->new($conf, $rootdir); # detect OS
PVE::LXC::Config->write_config($vmid, $conf); # safe config (after OS detection)
- $lxc_setup->post_create_hook($password);
+ $lxc_setup->post_create_hook($password, $ssh_keys);
} else {
# restore: try to extract configuration from archive
@@ -191,7 +191,7 @@ sub restore_and_configure {
}
sub create_rootfs {
- my ($storage_cfg, $vmid, $conf, $archive, $password, $restore, $no_unpack_error) = @_;
+ my ($storage_cfg, $vmid, $conf, $archive, $password, $restore, $no_unpack_error, $ssh_keys) = @_;
my $config_fn = PVE::LXC::Config->config_file($vmid);
if (-f $config_fn) {
@@ -221,7 +221,8 @@ sub create_rootfs {
eval {
my $rootdir = PVE::LXC::mount_all($vmid, $storage_cfg, $conf);
- restore_and_configure($vmid, $archive, $rootdir, $conf, $password, $restore, $no_unpack_error);
+ restore_and_configure($vmid, $archive, $rootdir, $conf, $password,
+ $restore, $no_unpack_error, $ssh_keys);
};
my $err = $@;
PVE::LXC::umount_all($vmid, $storage_cfg, $conf, $err ? 1 : 0);
--
2.1.4
More information about the pve-devel
mailing list