Merge "Fall back to local upload when there is no glance endpoint"

This commit is contained in:
Zuul 2020-07-23 08:39:44 +00:00 committed by Gerrit Code Review
commit 1c3e5d2be4
1 changed files with 10 additions and 3 deletions

View File

@ -23,6 +23,7 @@ import subprocess
import sys
from glanceclient.common.progressbar import VerboseFileWrapper
from keystoneauth1.exceptions import catalog as exc_catalog
from osc_lib import exceptions
from osc_lib.i18n import _
from prettytable import PrettyTable
@ -378,9 +379,15 @@ class UploadOvercloudImage(command.Command):
'update_existing': parsed_args.update_existing,
'updated': self.updated
}
if parsed_args.local:
return FileImageClientAdapter(parsed_args.local_path, **kwargs)
return GlanceClientAdapter(self.app.client_manager.image, **kwargs)
if not parsed_args.local:
try:
return GlanceClientAdapter(self.app.client_manager.image,
**kwargs)
except exc_catalog.EndpointNotFound:
# Missing endpoint implies local-only upload
pass
return FileImageClientAdapter(parsed_args.local_path, **kwargs)
def _get_environment_var(self, envvar, default, deprecated=[]):
for env_key in deprecated: