Command for changing logging level.

And pep8 fixing
(suddenly this pull request was rejected by jenkins and pep8.
so this commit also contains some small style changes for pep8.)

Currently the default value for logging is INFO and it is hardcoded.
Additional command will be helpful for debug/development process.

Implements blueprint: logging-level-cli

Change-Id: I1105e3da277e2a948f3ff50b04751169eddf26ed
This commit is contained in:
eldar nugaev 2016-01-12 16:41:24 +00:00
parent b3161b0f39
commit 30dc62614f
4 changed files with 16 additions and 17 deletions

View File

@ -17,7 +17,7 @@ limitations under the License.
import json
import requests
import exceptions
from freezer.apiclient import exceptions
class BackupsManager(object):

View File

@ -16,20 +16,19 @@ limitations under the License.
client interface to the Freezer API
"""
import argparse
import os
import socket
from keystoneclient.auth.identity import v2
from keystoneclient.auth.identity import v3
from keystoneclient import session as ksc_session
from backups import BackupsManager
from registration import RegistrationManager
from jobs import JobManager
from actions import ActionManager
from sessions import SessionManager
from oslo_config import cfg
from freezer.apiclient import actions
from freezer.apiclient import backups
from freezer.apiclient import jobs
from freezer.apiclient import registration
from freezer.apiclient import sessions
from freezer.utils import Namespace
CONF = cfg.CONF
@ -225,11 +224,11 @@ class Client(object):
self._session = session
self.version = version
self.backups = BackupsManager(self, verify=verify)
self.registration = RegistrationManager(self, verify=verify)
self.jobs = JobManager(self, verify=verify)
self.actions = ActionManager(self, verify=verify)
self.sessions = SessionManager(self, verify=verify)
self.backups = backups.BackupsManager(self, verify=verify)
self.registration = registration.RegistrationManager(self, verify=verify)
self.jobs = jobs.JobManager(self, verify=verify)
self.actions = actions.ActionManager(self, verify=verify)
self.sessions = sessions.SessionManager(self, verify=verify)
@cached_property

View File

@ -38,7 +38,7 @@ class ApiClientException(Exception):
message = "[*] Error {0}: {1}".format(
r.status_code,
body['description'])
except:
except Exception:
message = None
return message
@ -55,7 +55,7 @@ class ApiClientException(Exception):
message = "[*] Error {0}: {1}".format(
r.status_code,
r.text)
except:
except Exception:
message = None
return message
@ -65,6 +65,6 @@ class ApiClientException(Exception):
str(r)
try:
self.status_code = r.status_code
except:
except Exception:
self.status_code = None
super(ApiClientException, self).__init__(message)

View File

@ -17,7 +17,7 @@ limitations under the License.
import json
import requests
import exceptions
from freezer.apiclient import exceptions
class SessionManager(object):