Commit 5d4b3bdb authored by Antoine Millet's avatar Antoine Millet
Browse files

[bug#3913] Changed logging call with string formatting.

parent a09f9132
Loading
Loading
Loading
Loading
+3 −3
Original line number Diff line number Diff line
@@ -47,11 +47,11 @@ class CCServer(object):
        sock.listen(CCServer.LISTEN_BACKLOG)

        if certfile:
            logging.info('SSL Certificate: %s' % certfile)
            logging.info('SSL Certificate: %s', certfile)
        if keyfile:
            logging.info('SSL Key: %s' % certfile)
            logging.info('SSL Key: %s', certfile)

        logging.info('Started to listen on %s port %s' % (address, port))
        logging.info('Started to listen on %s port %s', address, port)

        self.objects = ObjectsDB(self)

+8 −8
Original line number Diff line number Diff line
@@ -95,7 +95,7 @@ class CCConf(object):
        filename = os.path.join(self._path, '%s.json' % login)
        if os.path.isfile(filename):
            conf = json.load(open(filename, 'r'))
            logging.debug('Getting configuration %s: %s' % (filename, conf))
            logging.debug('Getting configuration %s: %s', filename, conf)
            return conf
        else:
            raise CCConf.UnknownAccount('%s is not a file' % filename)
@@ -110,7 +110,7 @@ class CCConf(object):
        '''

        filename = os.path.join(self._path, '%s.json' % login)
        logging.debug('Writing configuration %s: %s' % (filename, conf))
        logging.debug('Writing configuration %s: %s', filename, conf)
        if os.path.isfile(filename) ^ create:
            json.dump(conf, open(filename, 'w'))
        else:
@@ -231,7 +231,7 @@ class CCConf(object):
            is_valid = auth(password, password_wo_method) == passwd_conf
        else:
            logging.warning('Bad authentication method for %s: '
                            '%s' % (login, m.group('method')))
                            '%s', login, m.group('method'))
        if is_valid:
            return conf['role']
        else:
@@ -264,8 +264,8 @@ class CCConf(object):
        :raise CCConf.UnknownAccount: if user login is unknown
        '''

        logging.debug('Added tag %s:%s for %s account' % (tag_name, tag_value,
                                                          login))
        logging.debug('Added tag %s:%s for %s account',
                      tag_name, tag_value, login)
        conf = self._get_conf(login)
        conf['tags'][tag_name] = tag_value
        self._set_conf(login, conf)
@@ -280,7 +280,7 @@ class CCConf(object):
        :raise CCConf.UnknownAccount: if user login is unknown
        '''

        logging.debug('Removed tag %s for %s account' % (login, tag))
        logging.debug('Removed tag %s for %s account', login, tag)
        conf = self._get_conf(login)
        if tag in conf['tags']:
            del conf['tags'][tag]
@@ -295,7 +295,7 @@ class CCConf(object):
        :raise CCConf.UnknownAccount: if user login is unknown
        '''

        logging.debug('Removed %s account' % login)
        logging.debug('Removed %s account', login)
        filename = os.path.join(self._path, '%s.json' % login)
        if os.path.exists(filename):
            os.remove(filename)
@@ -313,7 +313,7 @@ class CCConf(object):
        :raise CCConf.AlreadyExistingAccount: if the login is already
        '''

        logging.debug('Creating %s account with role %s' % (login, role))
        logging.debug('Creating %s account with role %s', login, role)
        filename = os.path.join(self._path, '%s.json' % login)
        if os.path.exists(filename):
            raise CCConf.AlreadyExistingAccount('%s found' % filename)
+4 −4
Original line number Diff line number Diff line
@@ -48,7 +48,7 @@ class CCHandler(RpcHandler):
            # Filter the private members access:
            raise KeyError('Remote name %s is private.' % repr(name))
        else:
            logging.debug('Called %s.%s' % (self.__class__.__name__, name))
            logging.debug('Called %s.%s', self.__class__.__name__, name)
            return super(CCHandler, self).__getitem__(name)


@@ -131,7 +131,7 @@ class CliHandler(OnlineCCHandler):
        '''

        self._check(conn, 'list', query)
        logging.debug('Executed list function with query %s' % query)
        logging.debug('Executed list function with query %s', query)
        return self._server.list(query)

    def _vm_action(self, query, method, *args, **kwargs):
@@ -470,8 +470,8 @@ class WelcomeHandler(CCHandler):
                    raise AuthenticationError('Account is closed')

        if role is None:
            logging.info('New authentication from %s: '
                         'failure' % login.encode('ascii', 'ignore'))
            logging.info('New authentication from %s: failure',
                         login.encode('ascii', 'ignore'))
            raise AuthenticationError('Bad login/password')
        else:
            # If authentication is a success, try to register the client: