James Cammarata wrote:
> Odd... git-send-email did not send that correctly at all.  Here is the
> correct patch:
>
> ---
> diff --git a/cobbler/action_import.py b/cobbler/action_import.py
> index e4c0836..bf8328c 100644
> --- a/cobbler/action_import.py
> +++ b/cobbler/action_import.py
> @@ -642,6 +642,28 @@ class Importer:
>                 profile.set_virt_type("qemu")
>
>             self.profiles.add(profile,save=True)
> +
> +           # Create a rescue image as well,
> +           # assuming this isn't a xen distro
> +           if name.find("-xen") == -1:
> +               rescue_name = 'rescue-' + name
> +               existing_profile = self.profiles.find(name=rescue_name)
> +
> +               if existing_profile is None:
> +                   print _("- creating new profile: %s") % rescue_name
> +                   profile = self.config.new_profile()
> +               else:
> +                   print _("- modifying existing profile: %s") %
> rescue_name
> +                   profile = existing_profile
> +
> +               profile.set_name(rescue_name)
> +               profile.set_distro(name)
> +               profile.set_virt_type("qemu")
> +               profile.kernel_options['rescue'] = None
> +               profile.kickstart = '/etc/cobbler/pxerescue.ks'
> +
> +               self.profiles.add(profile,save=True)
> +
>             self.api.serialize()
>
>     def get_proposed_name(self,dirname,pxe_arch):
> diff --git a/kickstarts/pxerescue.ks b/kickstarts/pxerescue.ks
> new file mode 100644
> index 0000000..c84962e
> --- /dev/null
> +++ b/kickstarts/pxerescue.ks
> @@ -0,0 +1,15 @@
> +# Rescue Boot Template
> +
> +# Set the language and language support
> +lang en_US
> +langsupport en_US
> +
> +# Set the keyboard
> +keyboard "us"
> +
> +# Network kickstart
> +network --bootproto dhcp
> +
> +# Rescue method (only NFS/FTP/HTTP currently supported)
> +url --url=$tree
> +
>
>
>   

Applied, thanks! This will be very nice to have.

I'm not sure of what the analogs of rescue mode are for SuSE and Debian 
based systems. Do they apply? We could possibly not create them 
depending on the detected/supplied breed setting, or it may just be that 
they require different kernel arguments?

One possible extension of this is something we talked about earlier on 
list... does it make sense to remember a system's old profile when 
rescueing it? Also, does it make sense for profiles to know both their 
profile and also their "rescue" profile? For example, assume the following:

# cobbler profile edit --name=F9-webserver --rescue-profile=rescue-F9-i386
# cobbler system add --name=foo --profile=F9-webserver
# ... time passes ...
# ... something breaks ...
# cobbler system edit --name=foo --rescue-mode=1
# ... power cycle and fix the system ...
# cobbler system edit --name=foo --rescue-mode=0
# ... power cycle the system

I'm not sure if that use case is too much of a stretch or not, it seems 
accessing the PXE menu might be sufficient, but I'd be interested in 
hearing people's thoughts.

--Michael

_______________________________________________
cobbler mailing list
[email protected]
https://fedorahosted.org/mailman/listinfo/cobbler

Reply via email to