Creates keystonerc_admin for user

- creates keystonerc_admin for user running Packstack
in case OpenStack client host is the host where packstack
is running (eg. all-in-one installation)

Change-Id: I37be40de46f54c78c934a27bc3f5e3c9381e7f19
Fixes: rhbz#964005, rhbz#976394
This commit is contained in:
Martin Magr
2013-09-26 17:20:21 +02:00
parent 8bad2a3b0b
commit bd41088be6
6 changed files with 74 additions and 25 deletions

View File

@@ -3,6 +3,7 @@ Installs and configures an OpenStack Client
"""
import logging
import os
from packstack.installer import validators
from packstack.installer import basedefs, output_messages
@@ -57,16 +58,34 @@ def initSequences(controller):
]
controller.addSequence("Installing OpenStack Client", [], [], osclientsteps)
def createmanifest(config):
client_host = controller.CONF['CONFIG_OSCLIENT_HOST'].strip()
client_host = config['CONFIG_OSCLIENT_HOST'].strip()
manifestfile = "%s_osclient.pp" % client_host
manifestdata = getManifestTemplate("openstack_client.pp")
appendManifestFile(manifestfile, manifestdata)
server = utils.ScriptRunner(client_host)
server.append('echo $HOME')
rc, root_home = server.execute()
root_home = root_home.strip()
msg = ("To use the command line tools you need to source the file "
"%s/keystonerc_admin created on %s")
controller.MESSAGES.append(msg % (root_home.strip(), client_host))
homedir = os.path.expanduser('~')
config['HOME_DIR'] = homedir
uname, gname = utils.get_current_username()
config['NO_ROOT_USER'], config['NO_ROOT_GROUP'] = uname, gname
no_root_allinone = (client_host == utils.get_localhost_ip() and
root_home != homedir)
config['NO_ROOT_USER_ALLINONE'] = no_root_allinone and 'true' or 'false'
manifestdata = getManifestTemplate("openstack_client.pp")
appendManifestFile(manifestfile, manifestdata)
msg = ("File %s/keystonerc_admin has been created on OpenStack client host"
" %s. To use the command line tools you need to source the file.")
controller.MESSAGES.append(msg % (root_home, client_host))
if no_root_allinone:
msg = ("Copy of keystonerc_admin file has been created for non-root "
"user in %s.")
controller.MESSAGES.append(msg % homedir)