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
112
Issues
112
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
18464a25
Commit
18464a25
authored
May 23, 2012
by
Leigh Stoller
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add -x option to export to protogeni users (protogeni_export) by
having ptopgen put it into the advertisement.
parent
f3360423
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
24 additions
and
3 deletions
+24
-3
utils/grantimage.in
utils/grantimage.in
+24
-3
No files found.
utils/grantimage.in
View file @
18464a25
#!/usr/bin/perl -w
#!/usr/bin/perl -w
#
#
# EMULAB-COPYRIGHT
# EMULAB-COPYRIGHT
# Copyright (c) 2003-201
1
University of Utah and the Flux Group.
# Copyright (c) 2003-201
2
University of Utah and the Flux Group.
# All rights reserved.
# All rights reserved.
#
#
use
strict
;
use
strict
;
...
@@ -13,7 +13,7 @@ use Getopt::Std;
...
@@ -13,7 +13,7 @@ use Getopt::Std;
#
#
sub
usage
()
sub
usage
()
{
{
print
STDERR
"
Usage: grantimage [-r] [-w]
";
print
STDERR
"
Usage: grantimage [-r] [-w]
[-x]
";
print
STDERR
"
[-g <gid> | -u <uid> | -a] <imageid>
\n
";
print
STDERR
"
[-g <gid> | -u <uid> | -a] <imageid>
\n
";
print
STDERR
"
grantimage -l <imageid>
\n
";
print
STDERR
"
grantimage -l <imageid>
\n
";
print
STDERR
"
-h This message
\n
";
print
STDERR
"
-h This message
\n
";
...
@@ -23,15 +23,17 @@ sub usage()
...
@@ -23,15 +23,17 @@ sub usage()
print
STDERR
"
-u Grant access to a specific user
\n
";
print
STDERR
"
-u Grant access to a specific user
\n
";
print
STDERR
"
-g Grant access to a specific group (project)
\n
";
print
STDERR
"
-g Grant access to a specific group (project)
\n
";
print
STDERR
"
-a Grant global read-only access
\n
";
print
STDERR
"
-a Grant global read-only access
\n
";
print
STDERR
"
-x Also grant access to protogeni users
\n
";
exit
(
-
1
);
exit
(
-
1
);
}
}
my
$optlist
=
"
hg:dnru:wla
";
my
$optlist
=
"
hg:dnru:wla
x
";
my
$impotent
=
0
;
my
$impotent
=
0
;
my
$debug
=
0
;
my
$debug
=
0
;
my
$revoke
=
0
;
my
$revoke
=
0
;
my
$writable
=
0
;
my
$writable
=
0
;
my
$listonly
=
0
;
my
$listonly
=
0
;
my
$global
=
0
;
my
$global
=
0
;
my
$protogeni
=
0
;
my
$gid
;
my
$gid
;
my
$uid
;
my
$uid
;
my
$target
;
my
$target
;
...
@@ -105,6 +107,9 @@ if (defined($options{d})) {
...
@@ -105,6 +107,9 @@ if (defined($options{d})) {
if
(
defined
(
$options
{
w
}))
{
if
(
defined
(
$options
{
w
}))
{
$writable
=
1
;
$writable
=
1
;
}
}
if
(
defined
(
$options
{
x
}))
{
$protogeni
=
1
;
}
if
(
defined
(
$options
{
g
}))
{
if
(
defined
(
$options
{
g
}))
{
$gid
=
$options
{
g
};
$gid
=
$options
{
g
};
}
}
...
@@ -176,6 +181,11 @@ elsif ($global) {
...
@@ -176,6 +181,11 @@ elsif ($global) {
if
(
defined
(
$osinfo
))
{
if
(
defined
(
$osinfo
))
{
$osinfo
->
Update
({"
shared
"
=>
$val
})
==
0
$osinfo
->
Update
({"
shared
"
=>
$val
})
==
0
or
fatal
("
Could not update shared flag
");
or
fatal
("
Could not update shared flag
");
if
(
$protogeni
)
{
$osinfo
->
Update
({"
protogeni_export
"
=>
'
1
'})
==
0
or
fatal
("
Could not update protogeni flag
");
}
}
}
else
{
else
{
fatal
("
Could not lookup OSinfo for
$image
");
fatal
("
Could not lookup OSinfo for
$image
");
...
@@ -189,6 +199,17 @@ elsif ($revoke) {
...
@@ -189,6 +199,17 @@ elsif ($revoke) {
else
{
else
{
$image
->
GrantAccess
(
$target
,
$writable
)
==
0
$image
->
GrantAccess
(
$target
,
$writable
)
==
0
or
fatal
("
Could not grant permission for
$target
");
or
fatal
("
Could not grant permission for
$target
");
if
(
$image
->
ezid
()
&&
$protogeni
)
{
my
$osinfo
=
OSinfo
->
Lookup
(
$image
->
imageid
());
if
(
defined
(
$osinfo
))
{
$osinfo
->
Update
({"
protogeni_export
"
=>
'
1
'})
==
0
or
fatal
("
Could not update protogeni flag
");
}
else
{
fatal
("
Could not lookup OSinfo for
$image
");
}
}
}
}
exit
(
0
);
exit
(
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