image: Rename import
This makes the code a little clearer. Change-Id: Ib552d510ca484571e59363ef15fe5e2cc0a2f4e1 Signed-off-by: Stephen Finucane <sfinucan@redhat.com>
This commit is contained in:
parent
85254fbeb4
commit
a538104a94
@ -32,7 +32,7 @@ from osc_lib import utils
|
||||
|
||||
from openstackclient.common import progressbar
|
||||
from openstackclient.i18n import _
|
||||
from openstackclient.identity import common
|
||||
from openstackclient.identity import common as identity_common
|
||||
|
||||
if os.name == "nt":
|
||||
import msvcrt
|
||||
@ -176,14 +176,14 @@ class AddProjectToImage(command.ShowOne):
|
||||
metavar="<project>",
|
||||
help=_("Project to associate with image (ID)"),
|
||||
)
|
||||
common.add_project_domain_option_to_parser(parser)
|
||||
identity_common.add_project_domain_option_to_parser(parser)
|
||||
return parser
|
||||
|
||||
def take_action(self, parsed_args):
|
||||
image_client = self.app.client_manager.image
|
||||
identity_client = self.app.client_manager.identity
|
||||
|
||||
project_id = common.find_project(
|
||||
project_id = identity_common.find_project(
|
||||
identity_client,
|
||||
parsed_args.project,
|
||||
parsed_args.project_domain,
|
||||
@ -396,7 +396,7 @@ class CreateImage(command.ShowOne):
|
||||
"Force the use of glance image import instead of direct upload"
|
||||
),
|
||||
)
|
||||
common.add_project_domain_option_to_parser(parser)
|
||||
identity_common.add_project_domain_option_to_parser(parser)
|
||||
for deadopt in self.deadopts:
|
||||
parser.add_argument(
|
||||
"--%s" % deadopt,
|
||||
@ -449,7 +449,7 @@ class CreateImage(command.ShowOne):
|
||||
kwargs['visibility'] = parsed_args.visibility
|
||||
|
||||
if parsed_args.project:
|
||||
kwargs['owner_id'] = common.find_project(
|
||||
kwargs['owner_id'] = identity_common.find_project(
|
||||
identity_client,
|
||||
parsed_args.project,
|
||||
parsed_args.project_domain,
|
||||
@ -764,7 +764,7 @@ class ListImage(command.Lister):
|
||||
metavar='<project>',
|
||||
help=_("Search by project (admin only) (name or ID)"),
|
||||
)
|
||||
common.add_project_domain_option_to_parser(parser)
|
||||
identity_common.add_project_domain_option_to_parser(parser)
|
||||
parser.add_argument(
|
||||
'--tag',
|
||||
metavar='<tag>',
|
||||
@ -845,7 +845,7 @@ class ListImage(command.Lister):
|
||||
kwargs['tag'] = parsed_args.tag
|
||||
project_id = None
|
||||
if parsed_args.project:
|
||||
project_id = common.find_project(
|
||||
project_id = identity_common.find_project(
|
||||
identity_client,
|
||||
parsed_args.project,
|
||||
parsed_args.project_domain,
|
||||
@ -924,7 +924,7 @@ class ListImageProjects(command.Lister):
|
||||
metavar="<image>",
|
||||
help=_("Image (name or ID)"),
|
||||
)
|
||||
common.add_project_domain_option_to_parser(parser)
|
||||
identity_common.add_project_domain_option_to_parser(parser)
|
||||
return parser
|
||||
|
||||
def take_action(self, parsed_args):
|
||||
@ -962,15 +962,17 @@ class RemoveProjectImage(command.Command):
|
||||
metavar="<project>",
|
||||
help=_("Project to disassociate with image (name or ID)"),
|
||||
)
|
||||
common.add_project_domain_option_to_parser(parser)
|
||||
identity_common.add_project_domain_option_to_parser(parser)
|
||||
return parser
|
||||
|
||||
def take_action(self, parsed_args):
|
||||
image_client = self.app.client_manager.image
|
||||
identity_client = self.app.client_manager.identity
|
||||
|
||||
project_id = common.find_project(
|
||||
identity_client, parsed_args.project, parsed_args.project_domain
|
||||
project_id = identity_common.find_project(
|
||||
identity_client,
|
||||
parsed_args.project,
|
||||
parsed_args.project_domain,
|
||||
).id
|
||||
|
||||
image = image_client.find_image(
|
||||
@ -1175,7 +1177,7 @@ class SetImage(command.Command):
|
||||
metavar="<project>",
|
||||
help=_("Set an alternate project on this image (name or ID)"),
|
||||
)
|
||||
common.add_project_domain_option_to_parser(parser)
|
||||
identity_common.add_project_domain_option_to_parser(parser)
|
||||
for deadopt in self.deadopts:
|
||||
parser.add_argument(
|
||||
"--%s" % deadopt,
|
||||
@ -1247,7 +1249,7 @@ class SetImage(command.Command):
|
||||
)
|
||||
project_id = None
|
||||
if parsed_args.project:
|
||||
project_id = common.find_project(
|
||||
project_id = identity_common.find_project(
|
||||
identity_client,
|
||||
parsed_args.project,
|
||||
parsed_args.project_domain,
|
||||
|
Loading…
x
Reference in New Issue
Block a user