Remove image-server installation method
Was used by Steve with a "semi-proprietary" service at some hoster which does no more use it (with Xen). According to Steve nobody else used it so we can rip out this unneeded legacy code. This also reverts the last commit.
This commit is contained in:
@@ -154,7 +154,6 @@ xen-create-image - Easily create new Xen instances with networking and OpenSSH.
|
||||
* rpmstrap (deprecated)
|
||||
* tar (needs --install-source=tarball.tar)
|
||||
* copy (needs --install-source=/path/to/copy/from)
|
||||
* image-server
|
||||
|
||||
(Default value for Debian and Ubuntu: debootstrap)
|
||||
|
||||
@@ -1706,18 +1705,16 @@ E_OR
|
||||
if ( defined( $CONFIG{ 'install-method' } ) )
|
||||
{
|
||||
foreach my $recognised (
|
||||
qw/ copy debootstrap image-server rinse rpmstrap tar /)
|
||||
qw/ copy debootstrap rinse rpmstrap tar /)
|
||||
{
|
||||
$valid = 1
|
||||
if ( lc( $CONFIG{ 'install-method' } ) eq lc($recognised) );
|
||||
}
|
||||
|
||||
#
|
||||
# If we have "copy", "image-server", or "tar" method
|
||||
# then make sure we have a source.
|
||||
# If we have "copy", or "tar" method then make sure we have a source.
|
||||
#
|
||||
if ( ( lc( $CONFIG{ 'install-method' } ) eq "copy" ) ||
|
||||
( lc( $CONFIG{ 'install-method' } ) eq "image-server" ) ||
|
||||
( lc( $CONFIG{ 'install-method' } ) eq "tar" ) )
|
||||
{
|
||||
|
||||
@@ -3230,7 +3227,6 @@ sub installSystem
|
||||
# And where from, if relevant.
|
||||
#
|
||||
if ( ( lc( $CONFIG{ 'install-method' } ) eq "copy" ) ||
|
||||
( lc( $CONFIG{ 'install-method' } ) eq "image-server" ) ||
|
||||
( lc( $CONFIG{ 'install-method' } ) eq "tar" ) )
|
||||
{
|
||||
logprint("(Source: $CONFIG{'install-source'})\n");
|
||||
|
||||
@@ -135,9 +135,6 @@ my %dispatch = (
|
||||
"debootstrap" => { sub => \&do_debootstrap,
|
||||
needBinary => "/usr/sbin/debootstrap",
|
||||
},
|
||||
"image-server" => { sub => \&do_image_server,
|
||||
needURL => 1,
|
||||
},
|
||||
"rinse" => { sub => \&do_rinse,
|
||||
needBinary => "/usr/sbin/rinse",
|
||||
},
|
||||
@@ -756,164 +753,6 @@ sub do_debootstrap
|
||||
|
||||
|
||||
|
||||
=begin doc
|
||||
|
||||
Install a system using the image-server.
|
||||
|
||||
Note: NON-Advertised ....
|
||||
|
||||
=end doc
|
||||
|
||||
=cut
|
||||
|
||||
sub do_image_server
|
||||
{
|
||||
|
||||
#
|
||||
# Load the modules we require.
|
||||
#
|
||||
my $test = 'use LWP::UserAgent; use CGI;';
|
||||
|
||||
#
|
||||
# Test loading the module, if it fails then
|
||||
# we must abort. We don't want to insist the module
|
||||
# is installed since that adds to the dependencies
|
||||
# which users will not require for the typical installation
|
||||
# method(s).
|
||||
#
|
||||
eval($test);
|
||||
if ($@)
|
||||
{
|
||||
die "The module LWP::UserAgent wasn't found...\n";
|
||||
}
|
||||
|
||||
|
||||
#
|
||||
# The number of attempts to request the image from our
|
||||
# image server, and the time to sleep between them.
|
||||
#
|
||||
my $attempts = 30;
|
||||
my $sleep = 30;
|
||||
|
||||
|
||||
#
|
||||
# Build up the request we're going to send.
|
||||
#
|
||||
my $request = $CONFIG{ 'install-source' } . "/create.cgi?submit=1";
|
||||
|
||||
#
|
||||
# Some parameters are hard-wired.
|
||||
#
|
||||
$request .= "&arch=amd64";
|
||||
$request .= "&root_device=/dev/sda";
|
||||
$request .= "&ip1=" . $ENV{ 'ip1' };
|
||||
$request .= "&dist=" . CGI::escapeHTML( $CONFIG{ 'dist' } );
|
||||
$request .= "&hostname=" . CGI::escapeHTML( $CONFIG{ 'hostname' } );
|
||||
|
||||
#
|
||||
# We only care about some keys
|
||||
#
|
||||
foreach my $k (qw/ dhcp broadcast gateway netmask /)
|
||||
{
|
||||
|
||||
# Skip values which aren't defined.
|
||||
next unless defined $ENV{ $k };
|
||||
|
||||
# CGI encode.
|
||||
my $val = CGI::escapeHTML( $ENV{ $k } );
|
||||
|
||||
# Add on to the request
|
||||
$request .= "&$k=$val";
|
||||
}
|
||||
|
||||
|
||||
#
|
||||
# Create a new user agent.
|
||||
#
|
||||
my $ua = LWP::UserAgent->new;
|
||||
$ua->timeout(10);
|
||||
$ua->env_proxy;
|
||||
|
||||
#
|
||||
# Do the creation step
|
||||
#
|
||||
my $response = $ua->get($request);
|
||||
if ( $response->is_success )
|
||||
{
|
||||
my $content = $response->content;
|
||||
|
||||
if ( $content =~ /fetch.cgi\?session=([^"]+)"/ )
|
||||
{
|
||||
my $session = $1;
|
||||
my $new = $CONFIG{ 'install-source' };
|
||||
$new .= "/fetch.cgi?session=$session";
|
||||
my $attempt = 1;
|
||||
|
||||
# Make sure we don't wait indefinitely.
|
||||
while ( $attempt < $attempts )
|
||||
{
|
||||
$CONFIG{ 'verbose' } && print "Request: [$attempt/$attempts]\n";
|
||||
|
||||
#
|
||||
# Make a request to see if our tar file is ready yet.
|
||||
#
|
||||
$response = $ua->head($new);
|
||||
if ( $response->is_success )
|
||||
{
|
||||
|
||||
#
|
||||
# Get the headers
|
||||
#
|
||||
my $header = $response->headers();
|
||||
my $type = $header->{ 'content-type' };
|
||||
|
||||
#
|
||||
# OK our file is correct.
|
||||
#
|
||||
if ( $type =~ /tar/ )
|
||||
{
|
||||
|
||||
#
|
||||
# Download it to the installation root.
|
||||
#
|
||||
$ua->get( $new,
|
||||
":content_file" => $CONFIG{ 'location' } .
|
||||
"/$session.tar" );
|
||||
|
||||
#
|
||||
# If it worked .. then untar, remove, and return.
|
||||
#
|
||||
system(
|
||||
"cd $CONFIG{'location'} && tar --numeric-owner -xf $session.tar && rm -f $CONFIG{'location'}/$session.tar"
|
||||
);
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
sleep($sleep);
|
||||
$attempt += 1;
|
||||
|
||||
}
|
||||
print("ERROR: Timeout waiting for image to be ready.");
|
||||
return 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
print(
|
||||
"ERROR: Failed to find session. Received this:\n$content\n");
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
print( "ERROR: Submitting the image create request failed:\n" .
|
||||
$response->status_line );
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
=begin doc
|
||||
|
||||
Install a new distribution of GNU/Linux using the rinse tool.
|
||||
|
||||
1
debian/changelog
vendored
1
debian/changelog
vendored
@@ -39,7 +39,6 @@ xen-tools (4.2~rc1-1) UNRELEASED; urgency=low
|
||||
#566683, #550590, LP: #538917, #484098)
|
||||
* Downgrade reiserfsprogs and xfsprogs to Suggests. (Closes: #561618,
|
||||
LP: #80233)
|
||||
* Added "Suggests: libwww-perl" (needed if --image-server is used)
|
||||
* Bump Standards-Version to 3.8.4 (no changes necessary)
|
||||
* Bump Debhelper Compatibility to 7
|
||||
- Replace "dh_clean -k" by "dh_prep"
|
||||
|
||||
2
debian/control
vendored
2
debian/control
vendored
@@ -12,7 +12,7 @@ Package: xen-tools
|
||||
Architecture: all
|
||||
Depends: debootstrap, perl-modules, libtext-template-perl, libconfig-inifiles-perl, libfile-slurp-perl, ${misc:Depends}
|
||||
Recommends: xen-hypervisor-amd64 | xen-hypervisor-i386 | xen-hypervisor-i386-pae, rinse, xen-shell, libexpect-perl
|
||||
Suggests: reiserfsprogs, xfsprogs, xen-utils, libwww-perl
|
||||
Suggests: reiserfsprogs, xfsprogs, xen-utils
|
||||
Description: Tools to manage Xen virtual servers
|
||||
This package contains tools to manage Debian based Xen virtual servers.
|
||||
.
|
||||
|
||||
@@ -119,7 +119,7 @@ _xen_create_image()
|
||||
return 0
|
||||
;;
|
||||
--install-method)
|
||||
COMPREPLY=( $( compgen -W 'copy debootstrap image-server rpmstrap tar' -- "${COMP_WORDS[COMP_CWORD]}" ) )
|
||||
COMPREPLY=( $( compgen -W 'copy debootstrap rpmstrap tar' -- "${COMP_WORDS[COMP_CWORD]}" ) )
|
||||
return 0
|
||||
;;
|
||||
--ip)
|
||||
|
||||
Reference in New Issue
Block a user