diff options
| author | Andy Ning <andy.ning@windriver.com> | 2014-07-16 11:37:37 -0400 |
|---|---|---|
| committer | Bruce Ashfield <bruce.ashfield@windriver.com> | 2014-07-31 15:15:31 -0400 |
| commit | be2e56c0bbd019e450beca62f1cad13cf5fe37e4 (patch) | |
| tree | 7cbf2f17513a79242709706558af68682100bc00 /meta-openstack/recipes-devtools/python/python-keystone_git.bb | |
| parent | f300718c549178e924699d4b8de7f98a7bad6375 (diff) | |
| download | meta-cloud-services-be2e56c0bbd019e450beca62f1cad13cf5fe37e4.tar.gz | |
Keystone: package service/user additions
Instead of creating tenant/user/role and service/endpoint for all
openstack services in keystone postinstall, now each of the services
creates its own keystone identities by queueing them up in its postinstall
to a file /etc/keystone/service-user-setup. service-user-setup
script, when run as the last postinstall, calls identity.sh with keystone
identity parameters to create necessary identities for the services.
Signed-off-by: Andy Ning <andy.ning@windriver.com>
Diffstat (limited to 'meta-openstack/recipes-devtools/python/python-keystone_git.bb')
| -rw-r--r-- | meta-openstack/recipes-devtools/python/python-keystone_git.bb | 50 |
1 files changed, 36 insertions, 14 deletions
diff --git a/meta-openstack/recipes-devtools/python/python-keystone_git.bb b/meta-openstack/recipes-devtools/python/python-keystone_git.bb index 96ce440..ec5d775 100644 --- a/meta-openstack/recipes-devtools/python/python-keystone_git.bb +++ b/meta-openstack/recipes-devtools/python/python-keystone_git.bb | |||
| @@ -31,6 +31,33 @@ TOKEN_FORMAT ?= "PKI" | |||
| 31 | 31 | ||
| 32 | LDAP_DN ?= "dc=my-domain,dc=com" | 32 | LDAP_DN ?= "dc=my-domain,dc=com" |
| 33 | 33 | ||
| 34 | SERVICECREATE_PACKAGES = "${SRCNAME}-setup" | ||
| 35 | KEYSTONE_HOST="${CONTROLLER_IP}" | ||
| 36 | |||
| 37 | # USERCREATE_PARAM and SERVICECREATE_PARAM contain the list of parameters to be set. | ||
| 38 | # If the flag for a parameter in the list is not set here, the default value will be given to that parameter. | ||
| 39 | # Parameters not in the list will be set to empty. | ||
| 40 | |||
| 41 | USERCREATE_PARAM_${SRCNAME}-setup = "name pass tenant role email" | ||
| 42 | python () { | ||
| 43 | flags = {'name':'${ADMIN_USER}',\ | ||
| 44 | 'pass':'${ADMIN_PASSWORD}',\ | ||
| 45 | 'tenant':'${ADMIN_TENANT}',\ | ||
| 46 | 'role':'${ADMIN_ROLE}',\ | ||
| 47 | 'email':'${ADMIN_USER_EMAIL}',\ | ||
| 48 | } | ||
| 49 | d.setVarFlags("USERCREATE_PARAM_%s-setup" % d.getVar('SRCNAME',True), flags) | ||
| 50 | } | ||
| 51 | SERVICECREATE_PARAM_${SRCNAME}-setup = "name type description region publicurl adminurl internalurl" | ||
| 52 | python () { | ||
| 53 | flags = {'type':'identity',\ | ||
| 54 | 'description':'OpenStack Identity',\ | ||
| 55 | 'publicurl':"'http://${KEYSTONE_HOST}:5000/v2.0'",\ | ||
| 56 | 'adminurl':"'http://${KEYSTONE_HOST}:35357/v2.0'",\ | ||
| 57 | 'internalurl':"'http://${KEYSTONE_HOST}:5000/v2.0'"} | ||
| 58 | d.setVarFlags("SERVICECREATE_PARAM_%s-setup" % d.getVar('SRCNAME',True), flags) | ||
| 59 | } | ||
| 60 | |||
| 34 | do_install_append() { | 61 | do_install_append() { |
| 35 | 62 | ||
| 36 | KEYSTONE_CONF_DIR=${D}${sysconfdir}/keystone | 63 | KEYSTONE_CONF_DIR=${D}${sysconfdir}/keystone |
| @@ -41,7 +68,7 @@ do_install_append() { | |||
| 41 | install -d ${D}${localstatedir}/log/${SRCNAME} | 68 | install -d ${D}${localstatedir}/log/${SRCNAME} |
| 42 | 69 | ||
| 43 | install -m 600 ${WORKDIR}/keystone.conf ${KEYSTONE_CONF_DIR}/ | 70 | install -m 600 ${WORKDIR}/keystone.conf ${KEYSTONE_CONF_DIR}/ |
| 44 | install -m 600 ${WORKDIR}/identity.sh ${KEYSTONE_CONF_DIR}/ | 71 | install -m 755 ${WORKDIR}/identity.sh ${KEYSTONE_CONF_DIR}/ |
| 45 | install -m 600 ${WORKDIR}/openrc ${KEYSTONE_CONF_DIR}/ | 72 | install -m 600 ${WORKDIR}/openrc ${KEYSTONE_CONF_DIR}/ |
| 46 | install -m 600 ${S}/etc/logging.conf.sample ${KEYSTONE_CONF_DIR}/logging.conf | 73 | install -m 600 ${S}/etc/logging.conf.sample ${KEYSTONE_CONF_DIR}/logging.conf |
| 47 | install -m 600 ${S}/etc/policy.json ${KEYSTONE_CONF_DIR}/policy.json | 74 | install -m 600 ${S}/etc/policy.json ${KEYSTONE_CONF_DIR}/policy.json |
| @@ -124,20 +151,15 @@ pkg_postinst_${SRCNAME}-setup () { | |||
| 124 | sleep 2 | 151 | sleep 2 |
| 125 | fi | 152 | fi |
| 126 | 153 | ||
| 127 | sudo -u postgres createdb keystone | 154 | # This is to make sure keystone is configured and running |
| 128 | keystone-manage db_sync | 155 | PIDFILE="/var/run/keystone-all.pid" |
| 129 | keystone-manage pki_setup --keystone-user=root --keystone-group=root | 156 | if [ -z `cat $PIDFILE 2>/dev/null` ]; then |
| 157 | sudo -u postgres createdb keystone | ||
| 158 | keystone-manage db_sync | ||
| 159 | keystone-manage pki_setup --keystone-user=root --keystone-group=root | ||
| 130 | 160 | ||
| 131 | # Create users, services and endpoints | 161 | /etc/init.d/keystone start |
| 132 | /etc/init.d/keystone start | 162 | fi |
| 133 | sleep 2 | ||
| 134 | |||
| 135 | ADMIN_PASSWORD=${ADMIN_PASSWORD} \ | ||
| 136 | SERVICE_PASSWORD=${SERVICE_PASSWORD} \ | ||
| 137 | SERVICE_TENANT_NAME=${SERVICE_TENANT_NAME} \ | ||
| 138 | bash /etc/keystone/identity.sh | ||
| 139 | |||
| 140 | # end python-keystone postinst | ||
| 141 | } | 163 | } |
| 142 | 164 | ||
| 143 | # By default tokens are expired after 1 day so by default we can set | 165 | # By default tokens are expired after 1 day so by default we can set |
