'Deploy an instance (from an image) so we can get at its disks.
This isnt necessarily efficient, but is simple since we already have
means to create images.'

def deploy_instance(self):

    if self.__instance:
        print 'Using    existing    instance    {name}'.format(name=self.__instance)
        return
    if (not self.options.image):
        raise ValueError('Neither    --instance    nor    --image    was    specified.')
    instance = 'build-spinnaker-tarball-{unique}'.format(unique=time.strftime('%Y%m%d%H%M%S'))
    print 'Deploying    temporary    instance    {name}'.format(name=instance)
    check_run_quick('gcloud    {account}    compute    instances    create    {name}    --zone={zone}    --project={project}    --image={image}    --image-project={image_project}    --metadata    block-project-ssh-keys=TRUE    --scopes    compute-rw,storage-rw'.format(account=self.__gcloud_account_arg, name=instance, zone=self.__zone, project=self.__project, image=self.options.image, image_project=self.options.image_project), echo=False)
    self.__instance = instance
    print 'Making    snapshot    {name}-snapshot'.format(name=self.__instance)
    print '        Stopping    (to    snapshot)'
    check_run_quick('gcloud    {account}    compute    instances    stop    {name}    --zone={zone}    --project={project}'.format(account=self.__gcloud_account_arg, name=instance, zone=self.__zone, project=self.__project), echo=True)
    print '        Making    snapshot'
    check_run_quick('gcloud    {account}    compute    disks    snapshot    {name}    --zone    {zone}    --project={project}    --snapshot-names    {name}-snapshot'.format(account=self.__gcloud_account_arg, name=instance, zone=self.__zone, project=self.__project), echo=True)
    print '        Restarting'
    check_run_quick('gcloud    {account}    compute    instances    start    {name}    --zone={zone}    --project={project}'.format(account=self.__gcloud_account_arg, name=instance, zone=self.__zone, project=self.__project), echo=True)
    print 'Finished    snapshot'
