Ask Your Question
0

ERROR (CommandError): No server with a name or ID of

asked 2016-04-05 09:58:10 -0500

ehenira gravatar image

updated 2016-04-07 00:25:45 -0500

Bipin gravatar image

Struggling to locate the file that generates the following CLI command error when attempting to perform an action on a server/VM that does not exist (e.g. pause, lock, reboot):

ERROR (CommandError): No server with a name or ID of '<unknown server name>'

Please reply with the path and name of the file that is generating this error.

thank you.

edit retag flag offensive close merge delete

Comments

Your question is not clear. What you want to achieve ?

Bipin gravatar imageBipin ( 2016-04-07 00:26:09 -0500 )edit

I am trying to locate the python file that is generating this command error.

ehenira gravatar imageehenira ( 2016-04-07 06:41:51 -0500 )edit

1 answer

Sort by ยป oldest newest most voted
0

answered 2016-04-07 16:57:51 -0500

updated 2016-04-07 16:59:13 -0500

Hi, For the comment you made i think you are looking for python-novaclient utils.py: https://github.com/openstack/python-novaclient/blob/stable/liberty/novaclient/utils.py

def find_resource(manager, name_or_id, **find_args):
    """Helper for the _find_* methods."""
    # for str id which is not uuid (for Flavor, Keypair and hypervsior in cells
    # environments search currently)
    if getattr(manager, 'is_alphanum_id_allowed', False):
        try:
            return manager.get(name_or_id)
        except exceptions.NotFound:
            pass
# try to get entity as integer id
try:
    return manager.get(int(name_or_id))
except (TypeError, ValueError, exceptions.NotFound):
    pass

# now try to get entity as uuid
try:
    tmp_id = encodeutils.safe_encode(name_or_id)

    if six.PY3:
        tmp_id = tmp_id.decode()

    uuid.UUID(tmp_id)
    return manager.get(tmp_id)
except (TypeError, ValueError, exceptions.NotFound):
    pass

try:
    try:
        resource = getattr(manager, 'resource_class', None)
        name_attr = resource.NAME_ATTR if resource else 'name'
        kwargs = {name_attr: name_or_id}
        kwargs.update(find_args)
        return manager.find(**kwargs)
    except exceptions.NotFound:
        pass

    # finally try to find entity by human_id
    try:
        return manager.find(human_id=name_or_id, **find_args)
    except exceptions.NotFound:
        msg = (_("No %(class)s with a name or ID of '%(name)s' exists.") %
               {'class': manager.resource_class.__name__.lower(),
                'name': name_or_id})
        raise exceptions.CommandError(msg)
except exceptions.NoUniqueMatch:
    msg = (_("Multiple %(class)s matches found for '%(name)s', use an ID "
             "to be more specific.") %
           {'class': manager.resource_class.__name__.lower(),
            'name': name_or_id})
    raise exceptions.CommandError(msg)

Regards

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Get to know Ask OpenStack

Resources for moderators

Question Tools

1 follower

Stats

Asked: 2016-04-05 09:58:10 -0500

Seen: 647 times

Last updated: Apr 07 '16