Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Open sidebar
emulab
emulab-devel
Commits
0612de16
Commit
0612de16
authored
Nov 09, 2009
by
Gary Wong
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Allow the user to specify their own SSH key file.
parent
77a7a4cf
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
29 additions
and
5 deletions
+29
-5
protogeni/test/createsliver.py
protogeni/test/createsliver.py
+29
-5
No files found.
protogeni/test/createsliver.py
View file @
0612de16
...
...
@@ -36,6 +36,8 @@ def Usage():
-f file, --certificate=file read SSL certificate from file
[default: ~/.ssl/encrypted.pem]
-h, --help show options and usage
-k keyfile, --keys=keyfile read SSH keys from file
[default: query from SA]
-n name, --slicename=name specify human-readable name of slice
[default: mytestslice]
-p file, --passphrase=file read passphrase from file
...
...
@@ -53,6 +55,19 @@ for arg in sys.argv[:]:
sys
.
argv
.
remove
(
arg
)
update
=
True
# Gah. This case is even uglier, since we need to remove both the
# option and its mandator parameter. Don't bother addressing the
# case where the user specifies -k more than once: they are being silly.
keyfile
=
""
for
i
in
range
(
len
(
sys
.
argv
)
):
if
sys
.
argv
[
i
]
==
"-k"
or
(
len
(
sys
.
argv
[
i
]
)
>=
3
and
"--key"
.
find
(
sys
.
argv
[
i
]
)
==
0
):
if
i
+
1
>=
len
(
sys
.
argv
):
Usage
()
sys
.
exit
(
1
)
keyfile
=
sys
.
argv
[
i
+
1
]
sys
.
argv
[
i
:
i
+
2
]
=
[];
break
execfile
(
"test-common.py"
)
if
len
(
args
)
>
1
:
...
...
@@ -84,11 +99,20 @@ print "Got my SA credential"
#
params
=
{}
params
[
"credential"
]
=
mycredential
rval
,
response
=
do_method
(
"sa"
,
"GetKeys"
,
params
)
if
rval
:
Fatal
(
"Could not get my keys"
)
pass
mykeys
=
response
[
"value"
]
if
keyfile
==
""
:
rval
,
response
=
do_method
(
"sa"
,
"GetKeys"
,
params
)
if
rval
:
Fatal
(
"Could not get my keys"
)
pass
mykeys
=
response
[
"value"
]
else
:
mykeys
=
[]
f
=
open
(
keyfile
)
for
keyline
in
f
:
if
re
.
match
(
r
"\s*#"
,
keyline
):
continue
mykeys
.
append
(
{
'type'
:
'ssh'
,
'key'
:
keyline
}
)
f
.
close
()
if
debug
:
print
str
(
mykeys
)
#
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment