[Thincrust-devel] [PATCH] Allow the user to pass in --version and --release command line paramneters

David Huff dhuff at redhat.com
Thu Nov 20 19:15:27 UTC 2008


committed to master
-D

Bryan Kearney wrote:
> ---
>  appcreate/appliance.py  |   10 +++++++++-
>  tools/appliance-creator |    9 +++++++++
>  2 files changed, 18 insertions(+), 1 deletions(-)
> 
> diff --git a/appcreate/appliance.py b/appcreate/appliance.py
> index 94edabd..45436af 100644
> --- a/appcreate/appliance.py
> +++ b/appcreate/appliance.py
> @@ -57,6 +57,8 @@ class ApplianceImageCreator(ImageCreator):
>          self.__vcpu = vcpu
>          self.__disk_format = disk_format
>          self.checksum = False
> +        self.appliance_version = None
> +        self.appliance_release = None
>          #self.getsource = False
>          #self.listpkg = False
>          
> @@ -402,7 +404,13 @@ class ApplianceImageCreator(ImageCreator):
>  
>      def _write_image_xml(self):
>          xml = "<image>\n"
> -        xml += "  <name>%s</name>\n" % self.name
> +
> +        name_attributes = ""
> +        if self.appliance_version:
> +            name_attributes += " version='%s'" % self.appliance_version
> +        if self.appliance_release:
> +            name_attributes += " release='%s'" % self.appliance_release
> +        xml += "  <name%s>%s</name>\n" % (name_attributes, self.name)
>          xml += "  <domain>\n"
>          # XXX don't hardcode - determine based on the kernel we installed for grub
>          # baremetal vs xen
> diff --git a/tools/appliance-creator b/tools/appliance-creator
> index cd73247..c305ac7 100755
> --- a/tools/appliance-creator
> +++ b/tools/appliance-creator
> @@ -39,6 +39,10 @@ def parse_options(args):
>                        help="Path to kickstart config file")
>      appopt.add_option("-n", "--name", type="string", dest="name",
>                        help="Appliance name")
> +    appopt.add_option("", "--version", type="string", dest="version",
> +                      help="Appliance version")
> +    appopt.add_option("", "--release", type="string", dest="release",
> +                      help="Appliance release")
>      #appopt.add_option("-a", "--appliance", type="string", dest="type",
>      #                  help="Appliance Type (default: generic)")    
>      #appopt.add_option("-s", "--source", type="string", dest="source",
> @@ -128,6 +132,11 @@ def main():
>      creator = appcreate.ApplianceImageCreator(ks, name, options.disk_format, options.vmem, options.vcpu)
>      creator.tmpdir = options.tmpdir
>      creator.checksum = options.checksum
> +
> +    if options.version:
> +        creator.appliance_version = options.version
> +    if options.release:
> +        creator.appliance_release = options.release
>      #creator.getsource = options.source
>      #creator.lsitpkg = options.pkg
>      




More information about the Thincrust-devel mailing list