emc-xchallenge / nova

OpenStack Compute (Nova)
http://openstack.org
Apache License 2.0
0 stars 3 forks source link

Method should have "self" as first argument #5

Open X-challenge opened 8 years ago

X-challenge commented 8 years ago

Description: In python class methods, it is standard to have 'self' as first argument, but here one method does not have 'self' argument

Project: nova

Project Area: OpenStack nova

Release: Nova

Severity: S3

Full Details: In utils.py, class RootwrapDaemonHelper, function _get_client does not have 'self' argument.

Support Materials:

utils.py class RootwrapDaemonHelper(RootwrapProcessHelper): _clients = {}

@synchronized('daemon-client-lock')
def _get_client(cls, rootwrap_config):           <------shall have self as argument
    try:
        return cls._clients[rootwrap_config]
    except KeyError:
        from oslo_rootwrap import client
        new_client = client.Client([
            "sudo", "nova-rootwrap-daemon", rootwrap_config])
        cls._clients[rootwrap_config] = new_client
        return new_client
jealous commented 8 years ago

It's a class method. For a class method the first parameter should be cls. The problem here is that this method should be decorated with @classmethod.