Commit 104f3eae authored by Gary Wong's avatar Gary Wong

Committing some of the smaller changes from the code I'm working on. These

parts should be harmless and have little interaction with anything else.
parent 6b02108f
......@@ -487,5 +487,18 @@ sub Store($)
return 0;
}
sub HasPrivilege($$)
{
my ( $self, $p ) = @_;
return 0
if( !defined( $self->{ 'capabilities' } ) );
return 1
if( defined( $self->{ 'capabilities' }->{ "*" } ) );
return defined( $self->{ 'capabilities' }->{ $p } );
}
# _Always_ make sure that this 1 is at the end of the file...
1;
......@@ -151,6 +151,8 @@ tmpfile.flush()
ret = os.spawnlp( os.P_WAIT, XMLSEC1, XMLSEC1, "--sign", "--node-id",
"Sig_ref" + str( id ), "--privkey-pem",
CERTIFICATE + "," + CERTIFICATE, tmpfile.name )
if ret == 127:
print >> sys.stderr, XMLSEC1 + ": invocation error\n"
tmpfile.close()
......
......@@ -28,7 +28,7 @@ passphrase = ""
CONFIGFILE = ".protogeni-config.py"
GLOBALCONF = HOME + "/" + CONFIGFILE
LOCALCONF = CONFIGFILE
EXTRACONF = None
SLICENAME = "mytestslice"
selfcredentialfile = None
......@@ -45,13 +45,15 @@ def Usage():
-h, --help show options and usage
-p file, --passphrase=file read passphrase from file
[default: ~/.ssl/password]
-r file, --read-commands=file specify additional configuration file
-s file, --slicecredentials=file read slice credentials from file
[default: query from SA]"""
try:
opts, args = getopt.getopt( sys.argv[ 1: ], "c:df:hp:s:",
opts, args = getopt.getopt( sys.argv[ 1: ], "c:df:hp:r:s:",
[ "credentials=", "debug", "certificate=",
"help", "passphrase=", "slicecredentials=" ] )
"help", "passphrase=", "read-commands=",
"slicecredentials=" ] )
except getopt.GetoptError, err:
print str( err )
Usage()
......@@ -69,6 +71,8 @@ for opt, arg in opts:
sys.exit( 0 )
elif opt in ( "-p", "--passphrase" ):
PASSPHRASEFILE = arg
elif opt in ( "-r", "--read-commands" ):
EXTRACONF = arg
elif opt in ( "-s", "--slicecredentials" ):
slicecredentialfile = arg
......@@ -84,6 +88,8 @@ if os.path.exists( GLOBALCONF ):
execfile( GLOBALCONF )
if os.path.exists( LOCALCONF ):
execfile( LOCALCONF )
if EXTRACONF and os.path.exists( EXTRACONF ):
execfile( EXTRACONF )
def Fatal(message):
print message
......
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