Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
emulab
emulab-devel
Commits
74a40736
Commit
74a40736
authored
Jan 13, 2011
by
Leigh B Stoller
Browse files
Add a Resolve() method, to resolve urns at the authority.
parent
935f3fd0
Changes
1
Hide whitespace changes
Inline
Side-by-side
protogeni/lib/GeniAuthority.pm.in
View file @
74a40736
...
...
@@ -494,6 +494,54 @@ sub Disable($)
return
0
;
}
#
#
Resolve
something
at
an
authority
#
sub
Resolve
($$)
{
my
($
self
,
$
urn
)
=
@
_
;
my
$
manager_version
=
$
self
->
Version
();
return
undef
if
(
!defined($manager_version));
#
#
Need
a
credential
to
make
this
call
.
#
if
(
!defined(Genixmlrpc->GetContext())) {
print
STDERR
"Need an RPC context to generate a self credential
\n
"
;
return
undef
;
}
my
$
context
=
Genixmlrpc
->
GetContext
();
my
$
credential
=
GeniCredential
->
GetSelfCredential
($
self
);
if
(
!defined($credential)) {
print
STDERR
"Could not create self credential for $self
\n
"
;
return
undef
;
}
my
$
method_args
;
if
($
manager_version
==
2.0
)
{
$
method_args
->{
'credentials'
}
=
[$
credential
->
asString
()];
$
method_args
->{
'urn'
}
=
$
urn
;
}
else
{
print
STDERR
"GeniAuthority::Resolve: Unknown version at $self
\n
"
;
return
undef
;
}
my
$
response
=
Genixmlrpc
::
CallMethod
($
self
->
url
(),
undef
,
"Resolve"
,
$
method_args
);
if
(
!defined($response)) {
print
STDERR
"*** Internal error Resolving $urn at $self
\n
"
;
return
undef
;
}
if
($
response
->
code
()
!= GENIRESPONSE_SUCCESS) {
print
STDERR
"Could not resolve $urn at $self Error:"
;
print
STDERR
" "
.
$
response
->
output
()
.
"
\n
"
;
return
undef
;
}
return
$
response
->
value
();
}
#
_Always_
make
sure
that
this
1
is
at
the
end
of
the
file
...
1
;
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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