summaryrefslogtreecommitdiff
path: root/openstackclient/identity
diff options
context:
space:
mode:
authorJenkins <jenkins@review.openstack.org>2016-06-20 17:26:57 +0000
committerGerrit Code Review <review@openstack.org>2016-06-20 17:26:57 +0000
commitf5ae23ab86c662e2f75952e6aa62c02ab3855b9b (patch)
tree5bee5786f26c329c7dee8847cebc9d11ece1a04f /openstackclient/identity
parenta99b54ef758477376a6254face4ff7fcc698dd8f (diff)
parent047cb6849354f4fdf8d365bd109a0ed56a77d200 (diff)
downloadpython-openstackclient-f5ae23ab86c662e2f75952e6aa62c02ab3855b9b.tar.gz
Merge "Standardize logger usage"
Diffstat (limited to 'openstackclient/identity')
-rw-r--r--openstackclient/identity/v2_0/project.py7
-rw-r--r--openstackclient/identity/v2_0/role.py7
-rw-r--r--openstackclient/identity/v2_0/service.py8
-rw-r--r--openstackclient/identity/v2_0/user.py7
-rw-r--r--openstackclient/identity/v3/domain.py6
-rw-r--r--openstackclient/identity/v3/federation_protocol.py7
-rw-r--r--openstackclient/identity/v3/group.py6
-rw-r--r--openstackclient/identity/v3/identity_provider.py7
-rw-r--r--openstackclient/identity/v3/mapping.py6
-rw-r--r--openstackclient/identity/v3/project.py7
-rw-r--r--openstackclient/identity/v3/role.py6
-rw-r--r--openstackclient/identity/v3/user.py6
12 files changed, 67 insertions, 13 deletions
diff --git a/openstackclient/identity/v2_0/project.py b/openstackclient/identity/v2_0/project.py
index c4f730e0..6c5db13c 100644
--- a/openstackclient/identity/v2_0/project.py
+++ b/openstackclient/identity/v2_0/project.py
@@ -15,6 +15,8 @@
"""Identity v2 Project action implementations"""
+import logging
+
from keystoneauth1 import exceptions as ks_exc
from osc_lib.cli import parseractions
from osc_lib.command import command
@@ -24,6 +26,9 @@ import six
from openstackclient.i18n import _
+LOG = logging.getLogger(__name__)
+
+
class CreateProject(command.ShowOne):
"""Create new project"""
@@ -87,7 +92,7 @@ class CreateProject(command.ShowOne):
identity_client.tenants,
parsed_args.name,
)
- self.log.info(_('Returning existing project %s'), project.name)
+ LOG.info(_('Returning existing project %s'), project.name)
else:
raise e
diff --git a/openstackclient/identity/v2_0/role.py b/openstackclient/identity/v2_0/role.py
index 4c3fe6e2..6d06230c 100644
--- a/openstackclient/identity/v2_0/role.py
+++ b/openstackclient/identity/v2_0/role.py
@@ -15,6 +15,8 @@
"""Identity v2 Role action implementations"""
+import logging
+
from keystoneauth1 import exceptions as ks_exc
from osc_lib.command import command
from osc_lib import exceptions
@@ -24,6 +26,9 @@ import six
from openstackclient.i18n import _
+LOG = logging.getLogger(__name__)
+
+
class AddRole(command.ShowOne):
"""Add role to project:user"""
@@ -94,7 +99,7 @@ class CreateRole(command.ShowOne):
identity_client.roles,
parsed_args.role_name,
)
- self.log.info(_('Returning existing role %s'), role.name)
+ LOG.info(_('Returning existing role %s'), role.name)
else:
raise e
diff --git a/openstackclient/identity/v2_0/service.py b/openstackclient/identity/v2_0/service.py
index c67dede7..df332eb6 100644
--- a/openstackclient/identity/v2_0/service.py
+++ b/openstackclient/identity/v2_0/service.py
@@ -16,6 +16,7 @@
"""Service action implementations"""
import argparse
+import logging
from osc_lib.command import command
from osc_lib import exceptions
@@ -26,6 +27,9 @@ from openstackclient.i18n import _
from openstackclient.identity import common
+LOG = logging.getLogger(__name__)
+
+
class CreateService(command.ShowOne):
"""Create new service"""
@@ -69,8 +73,8 @@ class CreateService(command.ShowOne):
# display deprecation message.
elif type:
name = type_or_name
- self.log.warning(_('The argument --type is deprecated, use service'
- ' create --name <service-name> type instead.'))
+ LOG.warning(_('The argument --type is deprecated, use service'
+ ' create --name <service-name> type instead.'))
# If --name option is present the positional is handled as <type>.
# Making --type optional is new, but back-compatible
elif name:
diff --git a/openstackclient/identity/v2_0/user.py b/openstackclient/identity/v2_0/user.py
index b8bbdaf4..0f327830 100644
--- a/openstackclient/identity/v2_0/user.py
+++ b/openstackclient/identity/v2_0/user.py
@@ -15,6 +15,8 @@
"""Identity v2.0 User action implementations"""
+import logging
+
from keystoneauth1 import exceptions as ks_exc
from osc_lib.command import command
from osc_lib import utils
@@ -23,6 +25,9 @@ import six
from openstackclient.i18n import _
+LOG = logging.getLogger(__name__)
+
+
class CreateUser(command.ShowOne):
"""Create new user"""
@@ -103,7 +108,7 @@ class CreateUser(command.ShowOne):
identity_client.users,
parsed_args.name,
)
- self.log.info(_('Returning existing user %s'), user.name)
+ LOG.info(_('Returning existing user %s'), user.name)
else:
raise e
diff --git a/openstackclient/identity/v3/domain.py b/openstackclient/identity/v3/domain.py
index 8eb7bc91..001d5201 100644
--- a/openstackclient/identity/v3/domain.py
+++ b/openstackclient/identity/v3/domain.py
@@ -15,6 +15,7 @@
"""Identity v3 Domain action implementations"""
+import logging
import sys
from keystoneauth1 import exceptions as ks_exc
@@ -25,6 +26,9 @@ import six
from openstackclient.i18n import _
+LOG = logging.getLogger(__name__)
+
+
class CreateDomain(command.ShowOne):
"""Create new domain"""
@@ -75,7 +79,7 @@ class CreateDomain(command.ShowOne):
if parsed_args.or_show:
domain = utils.find_resource(identity_client.domains,
parsed_args.name)
- self.log.info(_('Returning existing domain %s'), domain.name)
+ LOG.info(_('Returning existing domain %s'), domain.name)
else:
raise e
diff --git a/openstackclient/identity/v3/federation_protocol.py b/openstackclient/identity/v3/federation_protocol.py
index 377ddcce..09480245 100644
--- a/openstackclient/identity/v3/federation_protocol.py
+++ b/openstackclient/identity/v3/federation_protocol.py
@@ -14,6 +14,8 @@
"""Identity v3 Protocols actions implementations"""
+import logging
+
from osc_lib.command import command
from osc_lib import utils
import six
@@ -21,6 +23,9 @@ import six
from openstackclient.i18n import _
+LOG = logging.getLogger(__name__)
+
+
class CreateProtocol(command.ShowOne):
"""Create new federation protocol"""
@@ -145,7 +150,7 @@ class SetProtocol(command.Command):
identity_client = self.app.client_manager.identity
if not parsed_args.mapping:
- self.app.log.error(_("No changes requested"))
+ LOG.error(_("No changes requested"))
return
protocol = identity_client.federation.protocols.update(
diff --git a/openstackclient/identity/v3/group.py b/openstackclient/identity/v3/group.py
index fb0a25b9..8351fe64 100644
--- a/openstackclient/identity/v3/group.py
+++ b/openstackclient/identity/v3/group.py
@@ -15,6 +15,7 @@
"""Group action implementations"""
+import logging
import sys
from keystoneauth1 import exceptions as ks_exc
@@ -26,6 +27,9 @@ from openstackclient.i18n import _
from openstackclient.identity import common
+LOG = logging.getLogger(__name__)
+
+
class AddUserToGroup(command.Command):
"""Add user to group"""
@@ -161,7 +165,7 @@ class CreateGroup(command.ShowOne):
group = utils.find_resource(identity_client.groups,
parsed_args.name,
domain_id=domain)
- self.log.info(_('Returning existing group %s'), group.name)
+ LOG.info(_('Returning existing group %s'), group.name)
else:
raise e
diff --git a/openstackclient/identity/v3/identity_provider.py b/openstackclient/identity/v3/identity_provider.py
index 0b530a26..5c638f9b 100644
--- a/openstackclient/identity/v3/identity_provider.py
+++ b/openstackclient/identity/v3/identity_provider.py
@@ -13,6 +13,8 @@
"""Identity v3 IdentityProvider action implementations"""
+import logging
+
from osc_lib.command import command
from osc_lib import utils
import six
@@ -20,6 +22,9 @@ import six
from openstackclient.i18n import _
+LOG = logging.getLogger(__name__)
+
+
class CreateIdentityProvider(command.ShowOne):
"""Create new identity provider"""
@@ -169,7 +174,7 @@ class SetIdentityProvider(command.Command):
not parsed_args.remote_id and
not parsed_args.remote_id_file and
not parsed_args.description):
- self.log.error(_('No changes requested'))
+ LOG.error(_('No changes requested'))
return (None, None)
# Always set remote_ids if either is passed in
diff --git a/openstackclient/identity/v3/mapping.py b/openstackclient/identity/v3/mapping.py
index 5937474e..74ead228 100644
--- a/openstackclient/identity/v3/mapping.py
+++ b/openstackclient/identity/v3/mapping.py
@@ -16,6 +16,7 @@
"""Identity v3 federation mapping action implementations"""
import json
+import logging
from osc_lib.command import command
from osc_lib import exceptions
@@ -25,6 +26,9 @@ import six
from openstackclient.i18n import _
+LOG = logging.getLogger(__name__)
+
+
class _RulesReader(object):
"""Helper class capable of reading rules from files"""
@@ -159,7 +163,7 @@ class SetMapping(command.Command, _RulesReader):
identity_client = self.app.client_manager.identity
if not parsed_args.rules:
- self.app.log.error(_("No changes requested"))
+ LOG.error(_("No changes requested"))
return
rules = self._read_rules(parsed_args.rules)
diff --git a/openstackclient/identity/v3/project.py b/openstackclient/identity/v3/project.py
index 6145dcf1..4db5bef1 100644
--- a/openstackclient/identity/v3/project.py
+++ b/openstackclient/identity/v3/project.py
@@ -15,6 +15,8 @@
"""Project action implementations"""
+import logging
+
from keystoneauth1 import exceptions as ks_exc
from osc_lib.cli import parseractions
from osc_lib.command import command
@@ -25,6 +27,9 @@ from openstackclient.i18n import _
from openstackclient.identity import common
+LOG = logging.getLogger(__name__)
+
+
class CreateProject(command.ShowOne):
"""Create new project"""
@@ -111,7 +116,7 @@ class CreateProject(command.ShowOne):
project = utils.find_resource(identity_client.projects,
parsed_args.name,
domain_id=domain)
- self.log.info(_('Returning existing project %s'), project.name)
+ LOG.info(_('Returning existing project %s'), project.name)
else:
raise e
diff --git a/openstackclient/identity/v3/role.py b/openstackclient/identity/v3/role.py
index 1bb27585..965ca3f5 100644
--- a/openstackclient/identity/v3/role.py
+++ b/openstackclient/identity/v3/role.py
@@ -15,6 +15,7 @@
"""Identity v3 Role action implementations"""
+import logging
import sys
from keystoneauth1 import exceptions as ks_exc
@@ -26,6 +27,9 @@ from openstackclient.i18n import _
from openstackclient.identity import common
+LOG = logging.getLogger(__name__)
+
+
def _add_identity_and_resource_options_to_parser(parser):
domain_or_project = parser.add_mutually_exclusive_group()
domain_or_project.add_argument(
@@ -165,7 +169,7 @@ class CreateRole(command.ShowOne):
if parsed_args.or_show:
role = utils.find_resource(identity_client.roles,
parsed_args.name)
- self.log.info(_('Returning existing role %s'), role.name)
+ LOG.info(_('Returning existing role %s'), role.name)
else:
raise e
diff --git a/openstackclient/identity/v3/user.py b/openstackclient/identity/v3/user.py
index f916c8fc..b0c80c14 100644
--- a/openstackclient/identity/v3/user.py
+++ b/openstackclient/identity/v3/user.py
@@ -16,6 +16,7 @@
"""Identity v3 User action implementations"""
import copy
+import logging
import sys
from keystoneauth1 import exceptions as ks_exc
@@ -27,6 +28,9 @@ from openstackclient.i18n import _
from openstackclient.identity import common
+LOG = logging.getLogger(__name__)
+
+
class CreateUser(command.ShowOne):
"""Create new user"""
@@ -122,7 +126,7 @@ class CreateUser(command.ShowOne):
user = utils.find_resource(identity_client.users,
parsed_args.name,
domain_id=domain_id)
- self.log.info(_('Returning existing user %s'), user.name)
+ LOG.info(_('Returning existing user %s'), user.name)
else:
raise e