Add usage description, --bugs
This commit is contained in:
parent
5766e65b20
commit
d28748618d
2 changed files with 13 additions and 5 deletions
|
@ -49,3 +49,9 @@ Creating a new account object:
|
||||||
ungleich account --create-user <username> --name <firstname> --lastname <lastname> --email <email>
|
ungleich account --create-user <username> --name <firstname> --lastname <lastname> --email <email>
|
||||||
|
|
||||||
```
|
```
|
||||||
|
|
||||||
|
### Usage: SSH Key
|
||||||
|
|
||||||
|
```
|
||||||
|
ungleich sshkey --key raul.ascencio --host dev.raul.ungleich.cloud
|
||||||
|
```
|
||||||
|
|
|
@ -22,8 +22,8 @@ class SSHKey(object):
|
||||||
required=True)
|
required=True)
|
||||||
self.parser['sshkey'].add_argument('--key-dir',
|
self.parser['sshkey'].add_argument('--key-dir',
|
||||||
help='Directory holding keys',
|
help='Directory holding keys',
|
||||||
default=os.path.join(os.environ['HOME'], "vcs/ungleich-ssh-keys/"),
|
default=os.path.join(os.environ['HOME'], "vcs/ungleich-ssh-keys/current"),
|
||||||
required=false)
|
required=False)
|
||||||
self.parser['sshkey'].add_argument('--host',
|
self.parser['sshkey'].add_argument('--host',
|
||||||
help='Host to use',
|
help='Host to use',
|
||||||
required=True)
|
required=True)
|
||||||
|
@ -38,12 +38,14 @@ class SSHKey(object):
|
||||||
print("Not yet supported to delete, sorry :-)")
|
print("Not yet supported to delete, sorry :-)")
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
||||||
keyfile = os.path.join(args.keydir, "{}.pub".format(args.key))
|
keyfile = os.path.join(args.key_dir, "{}.pub".format(args.key))
|
||||||
|
|
||||||
if not os.path.exists(keyfile):
|
if not os.path.exists(keyfile):
|
||||||
print("Key for {} does not exist in {}. Aborting".format(args.key, args.keydir))
|
print("Key for {} does not exist in {}. Aborting".format(args.key, args.key_dir))
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
||||||
cmd = 'cat {} | ssh {} "mkdir -p ~/.ssh; cat >> ~/.ssh/authorized_keys"'.format(keyfile, args.host)
|
cmd = 'cat {} | ssh {}@{} "mkdir -p ~/.ssh; cat >> ~/.ssh/authorized_keys"'.format(keyfile,
|
||||||
|
args.user,
|
||||||
|
args.host)
|
||||||
|
|
||||||
subprocess.run(cmd, shell=True)
|
subprocess.run(cmd, shell=True)
|
||||||
|
|
Loading…
Reference in a new issue