/usr/lib/python3/dist-packages/maascli/actions/sshkeys_import.py is in python3-maas-client 2.4.0~beta2-6865-gec43e47e6-0ubuntu1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 | # Copyright 2016 Canonical Ltd. This software is licensed under the
# GNU Affero General Public License version 3 (see the file LICENSE).
"""MAAS SSH Keys Import Action."""
__all__ = [
'action_class'
]
import re
from maascli.api import Action
from maascli.command import CommandError
class SSHKeysImportAction(Action):
"""Provides custom logic to the sshkeys import action.
Command: maas username sshkeys import
The import command has the ability to upload the user's SSH Keys.
"""
@staticmethod
def name_value_pair(string):
"""Ensure that `string` is a valid ``name:value`` pair.
When `string` is of the form ``lp:user-id`` or ``gh:user-id``,
this returns a 2-tuple ``sshkeys, string``.
"""
parts = re.split(r'(:)', string, 1)
if len(parts) == 3 or string:
return 'keysource', string
else:
raise CommandError(
"%r is not in a protocol:auth_id or auth_id format." % string)
# Each action sets this variable so the class can be picked up
# by get_action_class.
action_class = SSHKeysImportAction
|