Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
emulab-devel
Project overview
Project overview
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
111
Issues
111
List
Boards
Labels
Milestones
Merge Requests
4
Merge Requests
4
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
emulab
emulab-devel
Commits
cd24a8fb
Commit
cd24a8fb
authored
Aug 02, 2007
by
David Johnson
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Handle both a primary and secondary delegate account mechanism for use
during rollout.
parent
8abe6b7e
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
75 additions
and
8 deletions
+75
-8
tbsetup/plab/mod_PLC4.py.in
tbsetup/plab/mod_PLC4.py.in
+75
-8
No files found.
tbsetup/plab/mod_PLC4.py.in
View file @
cd24a8fb
...
...
@@ -116,10 +116,11 @@ class NM3agent:
pass
#DEF_NM_DELEGATE_ACCT = "utah_nmcontrol"
DEF_NM_DELEGATE_ACCT
=
"utah_elab_delegate"
#DEF_NM_DELEGATE_KEY = "/root/.ssh/id_rsa"
DEF_NM_DELEGATE_KEY
=
"/root/.ssh/id_rsa.plabdel"
DEF_NM_DELEGATE_ACCT
=
"utah_nmcontrol"
DEF_NM_DELEGATE_KEY
=
"/root/.ssh/id_rsa"
TRY_SECONDARY_DEL_ACCT
=
True
SECONDARY_NM_DELEGATE_ACCT
=
"utah_elab_delegate"
SECONDARY_NM_DELEGATE_KEY
=
"/root/.ssh/id_rsa.plabdel"
DEF_NM_SSHCMD
=
"/usr/bin/ssh -q -oStrictHostKeyChecking=no"
\
" -oPasswordAuthentication=no -l
%
s -i
%
s
%
s"
...
...
@@ -162,6 +163,8 @@ class NM4agent:
pass
def
_xcall
(
self
,
cmd
,
args
=
()):
int_try_secondary
=
False
self
.
_open
()
try
:
if
debug
:
...
...
@@ -169,7 +172,10 @@ class NM4agent:
pass
print
>>
self
.
__agentconn
.
tochild
,
xmlrpclib
.
dumps
(
args
,
cmd
)
self
.
__agentconn
.
tochild
.
close
()
retval
=
xmlrpclib
.
loads
(
self
.
__agentconn
.
fromchild
.
read
())
retval
=
self
.
__agentconn
.
fromchild
.
read
()
#if retval == None or retval == '':
# raise RuntimeError("no response from NM")
retval
=
xmlrpclib
.
loads
(
retval
)
if
debug
:
print
"NM4: xmlrpc response(
%
s/
%
s): '
%
s'"
%
(
self
.
nodeid
,
self
.
IP
,
...
...
@@ -181,9 +187,70 @@ class NM4agent:
pass
self
.
_close
()
except
:
# always close; we can only send one xmlrpc request at a time
self
.
_close
()
raise
if
self
.
__agentconn
.
poll
()
==
-
1
:
# Try waiting for it...
self
.
__agentconn
.
wait
()
pass
# If there's an exception, and if the child process returned 255
# (ssh failure), try forcing legacy (but only try that once, then
# raise)
# NOTE: ssh returns 255 to the shell, but python, or something,
# screws things up so that the low 8 bits get shifted 8 left.
if
self
.
__agentconn
.
poll
()
==
65280
:
print
"Error: SSH failure to
%
s/
%
s"
%
(
self
.
nodeid
,
self
.
IP
)
self
.
_close
()
if
not
TRY_SECONDARY_DEL_ACCT
:
raise
else
:
int_try_secondary
=
True
pass
else
:
# always close; we can only send one xmlrpc request at a time
self
.
_close
()
raise
pass
# If we're still alive now and we saw an ssh error, that means
# we decided to try via the secondary delegate account.
if
int_try_secondary
:
print
"Trying secondary credentials:"
self
.
__agentconn
=
None
self
.
delacct
=
SECONDARY_NM_DELEGATE_ACCT
self
.
delkey
=
SECONDARY_NM_DELEGATE_KEY
self
.
_open
()
try
:
if
debug
:
print
"NM4: xmlrpc send(
%
s/
%
s):
%
s"
\
%
(
self
.
nodeid
,
self
.
IP
,
cmd
)
pass
print
>>
self
.
__agentconn
.
tochild
,
xmlrpclib
.
dumps
(
args
,
cmd
)
self
.
__agentconn
.
tochild
.
close
()
retval
=
self
.
__agentconn
.
fromchild
.
read
()
if
retval
==
None
or
retval
==
''
:
raise
RuntimeError
(
"no response from NM"
)
retval
=
xmlrpclib
.
loads
(
retval
)
if
debug
:
print
"NM4: xmlrpc response(
%
s/
%
s): '
%
s'"
\
%
(
self
.
nodeid
,
self
.
IP
,
str
(
retval
))
pass
self
.
__agentconn
.
wait
()
if
debug
:
print
"NM4: xmlrpc done(
%
s/
%
s)"
%
(
self
.
nodeid
,
self
.
IP
)
pass
self
.
_close
()
except
:
if
self
.
__agentconn
.
poll
()
==
-
1
:
# Try waiting for it...
self
.
__agentconn
.
wait
()
pass
if
self
.
__agentconn
.
poll
()
==
65280
:
print
"Error: SSH failure to
%
s/
%
s"
\
%
(
self
.
nodeid
,
self
.
IP
)
pass
self
.
_close
()
raise
pass
# XXX: we whack the retval to be compat with NMv3
rret
=
retval
[
0
][
0
]
...
...
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