Generate an openrc for convenience
This will write the file to the current directory. Change-Id: Ib10eb970c7fdbfd826ec3c792d21a3ddf197199b
This commit is contained in:
3
.gitignore
vendored
3
.gitignore
vendored
@@ -55,3 +55,6 @@ ChangeLog
|
||||
|
||||
# Vagrant
|
||||
.vagrant
|
||||
|
||||
# generated openrc
|
||||
openrc
|
||||
24
deployment_files/openrc.j2
Normal file
24
deployment_files/openrc.j2
Normal file
@@ -0,0 +1,24 @@
|
||||
export OS_PROJECT_DOMAIN_ID=default
|
||||
export OS_USER_DOMAIN_ID=default
|
||||
|
||||
if [[ -n "$1" ]]; then
|
||||
OS_USERNAME=$1
|
||||
fi
|
||||
if [[ -n "$2" ]]; then
|
||||
OS_PROJECT_NAME=$2
|
||||
fi
|
||||
|
||||
export OS_PROJECT_NAME=${OS_PROJECT_NAME:-admin}
|
||||
export OS_USERNAME=${OS_USERNAME:-admin}
|
||||
|
||||
if [ $OS_USERNAME == "admin" ]; then
|
||||
export OS_PASSWORD={{ keystone_admin_password }}
|
||||
fi
|
||||
|
||||
export OS_AUTH_URL=http://{{ kolla_internal_address }}:{{ keystone_admin_port }}
|
||||
export OS_REGION_NAME={{ openstack_region_name }}
|
||||
|
||||
export NOVA_VERSION=${NOVA_VERSION:-1.1}
|
||||
export COMPUTE_API_VERSION=${COMPUTE_API_VERSION:-$NOVA_VERSION}
|
||||
export CINDER_VERSION=${CINDER_VERSION:-2}
|
||||
export OS_VOLUME_API_VERSION=${OS_VOLUME_API_VERSION:-$CINDER_VERSION}
|
||||
@@ -347,6 +347,16 @@ class KollaWorker(object):
|
||||
with open(dest_file, 'w') as f:
|
||||
f.write(content)
|
||||
|
||||
def write_openrc(self):
|
||||
# write an openrc to the base_dir for convience.
|
||||
openrc_file = os.path.join(self.base_dir,
|
||||
'deployment_files',
|
||||
'openrc.j2')
|
||||
content = jinja_render(openrc_file, self.required_vars)
|
||||
with open('openrc', 'w') as f:
|
||||
f.write(content)
|
||||
LOG.info('Written OpenStack env to "openrc"')
|
||||
|
||||
def cleanup(self):
|
||||
"""Remove temp files"""
|
||||
shutil.rmtree(self.temp_dir)
|
||||
@@ -409,6 +419,7 @@ def main():
|
||||
|
||||
kolla.setup_working_dir()
|
||||
kolla.write_to_zookeeper()
|
||||
kolla.write_openrc()
|
||||
kolla.start()
|
||||
|
||||
# kolla.cleanup()
|
||||
|
||||
Reference in New Issue
Block a user