Commit 6218e1ab authored by David Johnson's avatar David Johnson

Auto-add user pub keys to openstack admin user.

parent 274e1a8d
......@@ -60,4 +60,9 @@ if [ ${SETUP_FLAT_DATA_NETWORK} -eq 1 ]; then
fi
fi
if [ "$SWAPPER" = "geniuser" ] ; then
echo "*** Importing GENI user keys..."
$DIRNAME/setup-user-info.py
fi
exit 0
#!/usr/bin/env python
import subprocess
from keystoneclient.auth.identity import v2
from keystoneclient import session
from novaclient.client import Client
#import keystoneclient
#import novaclient
with open('/root/setup/settings','r') as file:
content = file.read()
pass
exec(content)
blob = subprocess.check_output(["/usr/bin/geni-get","geni_user"])
if blob.endswith('\n'):
exec("ui = %s" % (blob[0:-1],))
else:
exec("ui = %s" % (blob,))
pass
auth = v2.Password(auth_url='http://controller:5000/v2.0',username='admin',password=ADMIN_PASS,tenant_name='admin')
sess = session.Session(auth=auth)
nova = Client(2,session=sess)
for key in ui[0]['keys']:
posn = key.rindex(' ')
name = key[posn+1:]
rname = ""
for c in name:
if c.isalpha():
rname += c
else:
rname += 'X'
pass
try:
nova.keypairs.create(rname,key)
except:
pass
pass
sys.exit(0)
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