starcluster.commands.downloadimage

Package starcluster :: Package commands :: Module downloadimage |
[hide private]
[frames] | no frames]

# Source Code for Module starcluster.commands.downloadimage

     1  #!/usr/bin/env python
     2
     3  from starcluster.logger import log
     4
     5  from completers import ImageCompleter
     6
     7
     8 -class CmdDownloadImage(ImageCompleter):
     9      """
    10      downloadimage [options] <image_id> <destination_directory>
    11
    12      Download the manifest.xml and all AMI parts for an instance-store AMI
    13
    14      Example:
    15
    16          $ starcluster downloadimage ami-asdfasdf /data/myamis/ami-asdfasdf
    17      """
    18      names = ['downloadimage', 'di']
    19
    20      bucket = None
    21      image_name = None
    22
    23 -    def execute(self, args):
    24          if len(args) != 2:
    25              self.parser.error(
    26                  'you must specify an <image_id> and <destination_directory>')
    27          image_id, destdir = args
    28          self.ec2.download_image_files(image_id, destdir)
    29          log.info("Finished downloading AMI: %s" % image_id)
    30