Commit f77641a1 authored by Leigh B Stoller's avatar Leigh B Stoller
Browse files

Allow -a option (cluster) to be the nickname in addition to URN.

I use this too much to type URNs all the time.
parent 0be7348e
...@@ -47,6 +47,7 @@ my $debug = 0; ...@@ -47,6 +47,7 @@ my $debug = 0;
my $webtask_id; my $webtask_id;
my $webtask; my $webtask;
my $authority; my $authority;
my $aggregate;
# #
# Configure variables # Configure variables
...@@ -129,18 +130,23 @@ my $action = shift(@ARGV); ...@@ -129,18 +130,23 @@ my $action = shift(@ARGV);
# Default to local cluster # Default to local cluster
# #
if (defined($options{"a"})) { if (defined($options{"a"})) {
$authority = APT_Geni::GetAuthority($options{"a"}); if (GeniHRN::IsValid($options{"a"})) {
$aggregate = APT_Aggregate->Lookup($options{"a"});
}
else {
$aggregate = APT_Aggregate->LookupByNickname($options{"a"});
}
} }
else { else {
$authority = APT_Geni::GetAuthority($MYURN); $aggregate = APT_Aggregate->Lookup($MYURN);
} }
if (!defined($authority)) {
fatal("Could not look up authority");
}
my $aggregate = APT_Aggregate->Lookup($authority->urn());
if (!defined($aggregate)) { if (!defined($aggregate)) {
fatal("Could not lookup aggregate"); fatal("Could not lookup aggregate");
} }
$authority = APT_Geni::GetAuthority($aggregate->urn());
if (!defined($authority)) {
fatal("Could not look up authority");
}
# For credentials. # For credentials.
my $this_user = User->ThisUser(); my $this_user = User->ThisUser();
...@@ -453,7 +459,7 @@ sub DoList() ...@@ -453,7 +459,7 @@ sub DoList()
my $userhrn = GeniHRN->new($details->{'user'}); my $userhrn = GeniHRN->new($details->{'user'});
my $geniuser = GeniUser->Lookup($details->{'user'}, 1); my $geniuser = GeniUser->Lookup($details->{'user'}, 1);
if (defined($geniuser) && $geniuser->IsLocal()) { if (defined($geniuser) && $geniuser->IsLocal()) {
print Dumper($geniuser); #print Dumper($geniuser);
$details->{'uid'} = $geniuser->uid(); $details->{'uid'} = $geniuser->uid();
$details->{'uid_idx'} = $geniuser->idx(); $details->{'uid_idx'} = $geniuser->idx();
} }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment