Fix placement_wait_for_service
This fix the indent and volumes of the placement_wait_for_service and the corresponding placement_wait_for_service.py to use the config of the extracted placement service. It also * changes to set placement::keystone::authtoken::auth_url instead of placement::keystone::authtoken::auth_uri as auth_uri is deprecated and not supported by placement::keystone::authtoken. * sets placement::keystone::authtoken::region_name Related-Bug: 1842948 Change-Id: Ic24cf646efdd70ba1dbca42d3408847fe09a6e49
This commit is contained in:
parent
bf60423c0f
commit
d80d948fe7
|
@ -14,7 +14,7 @@
|
||||||
# License for the specific language governing permissions and limitations
|
# License for the specific language governing permissions and limitations
|
||||||
# under the License.
|
# under the License.
|
||||||
|
|
||||||
# shell script to check if nova API DB migrations finished after X attempts.
|
# shell script to check if placement API is up after X attempts.
|
||||||
# Default max is 60 iterations with 10s (default) timeout in between.
|
# Default max is 60 iterations with 10s (default) timeout in between.
|
||||||
|
|
||||||
from __future__ import print_function
|
from __future__ import print_function
|
||||||
|
@ -52,30 +52,32 @@ else:
|
||||||
loglevel = logging.INFO
|
loglevel = logging.INFO
|
||||||
|
|
||||||
logging.basicConfig(stream=sys.stdout, level=loglevel)
|
logging.basicConfig(stream=sys.stdout, level=loglevel)
|
||||||
LOG = logging.getLogger('nova_wait_for_placement_service')
|
LOG = logging.getLogger('placement_wait_for_service')
|
||||||
|
|
||||||
iterations = 60
|
iterations = 60
|
||||||
timeout = 10
|
timeout = 10
|
||||||
nova_cfg = '/etc/nova/nova.conf'
|
placement_cfg = '/etc/placement/placement.conf'
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
if os.path.isfile(nova_cfg):
|
if os.path.isfile(placement_cfg):
|
||||||
try:
|
try:
|
||||||
config.read(nova_cfg)
|
config.read(placement_cfg)
|
||||||
except Exception:
|
except Exception:
|
||||||
LOG.exception('Error while reading nova.conf:')
|
LOG.exception('Error while reading placement.conf:')
|
||||||
else:
|
else:
|
||||||
LOG.error('Nova configuration file %s does not exist', nova_cfg)
|
LOG.error('Placement configuration file %s does not exist',
|
||||||
|
placement_cfg)
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
||||||
# get keystone client with details from [placement] section
|
# get keystone client with details from [keystone_authtoken] section
|
||||||
auth = v3.Password(
|
auth = v3.Password(
|
||||||
user_domain_name=config.get('placement', 'user_domain_name'),
|
user_domain_name=config.get('keystone_authtoken', 'user_domain_name'),
|
||||||
username=config.get('placement', 'username'),
|
username=config.get('keystone_authtoken', 'username'),
|
||||||
password=config.get('placement', 'password'),
|
password=config.get('keystone_authtoken', 'password'),
|
||||||
project_name=config.get('placement', 'project_name'),
|
project_name=config.get('keystone_authtoken', 'project_name'),
|
||||||
project_domain_name=config.get('placement', 'user_domain_name'),
|
project_domain_name=config.get('keystone_authtoken',
|
||||||
auth_url=config.get('placement', 'auth_url') + '/v3')
|
'project_domain_name'),
|
||||||
|
auth_url=config.get('keystone_authtoken', 'auth_url') + '/v3')
|
||||||
sess = session.Session(auth=auth, verify=False)
|
sess = session.Session(auth=auth, verify=False)
|
||||||
keystone = client.Client(session=sess, interface='internal')
|
keystone = client.Client(session=sess, interface='internal')
|
||||||
|
|
||||||
|
@ -88,11 +90,14 @@ if __name__ == '__main__':
|
||||||
placement_service_id = keystone.services.list(
|
placement_service_id = keystone.services.list(
|
||||||
name='placement')[0].id
|
name='placement')[0].id
|
||||||
|
|
||||||
# get placement endpoint (valid_interfaces)
|
# get placement endpoint
|
||||||
|
# Note: puppet-placement does not support setting the interface
|
||||||
|
# until we have https://review.opendev.org/688862.
|
||||||
|
# Lets hard code 'internal' for now.
|
||||||
placement_endpoint_url = keystone.endpoints.list(
|
placement_endpoint_url = keystone.endpoints.list(
|
||||||
service=placement_service_id,
|
service=placement_service_id,
|
||||||
region=config.get('placement', 'region_name'),
|
region=config.get('keystone_authtoken', 'region_name'),
|
||||||
interface=config.get('placement', 'valid_interfaces'))[0].url
|
interface='internal')[0].url
|
||||||
if not placement_endpoint_url:
|
if not placement_endpoint_url:
|
||||||
LOG.error('Failed to get placement service endpoint!')
|
LOG.error('Failed to get placement service endpoint!')
|
||||||
else:
|
else:
|
||||||
|
|
|
@ -116,8 +116,8 @@ outputs:
|
||||||
placement::keystone::authtoken::project_name: 'service'
|
placement::keystone::authtoken::project_name: 'service'
|
||||||
placement::keystone::authtoken::password: {get_param: PlacementPassword}
|
placement::keystone::authtoken::password: {get_param: PlacementPassword}
|
||||||
placement::keystone::authtoken::www_authenticate_uri: {get_param: [EndpointMap, KeystoneInternal, uri_no_suffix]}
|
placement::keystone::authtoken::www_authenticate_uri: {get_param: [EndpointMap, KeystoneInternal, uri_no_suffix]}
|
||||||
placement::keystone::authtoken::auth_uri: {get_param: [EndpointMap, KeystoneInternal, uri_no_suffix]}
|
|
||||||
placement::keystone::authtoken::auth_url: {get_param: [EndpointMap, KeystoneInternal, uri_no_suffix]}
|
placement::keystone::authtoken::auth_url: {get_param: [EndpointMap, KeystoneInternal, uri_no_suffix]}
|
||||||
|
placement::keystone::authtoken::region_name: {get_param: KeystoneRegion}
|
||||||
placement::wsgi::apache::api_port: '8778'
|
placement::wsgi::apache::api_port: '8778'
|
||||||
placement::wsgi::apache::ssl: {get_param: EnableInternalTLS}
|
placement::wsgi::apache::ssl: {get_param: EnableInternalTLS}
|
||||||
# NOTE: bind IP is found in hiera replacing the network name with the local node IP
|
# NOTE: bind IP is found in hiera replacing the network name with the local node IP
|
||||||
|
@ -278,23 +278,28 @@ outputs:
|
||||||
- ''
|
- ''
|
||||||
environment:
|
environment:
|
||||||
KOLLA_CONFIG_STRATEGY: COPY_ALWAYS
|
KOLLA_CONFIG_STRATEGY: COPY_ALWAYS
|
||||||
placement_wait_for_service:
|
placement_wait_for_service:
|
||||||
start_order: 2
|
start_order: 2
|
||||||
image: *placement_api_image
|
image: *placement_api_image
|
||||||
user: root
|
user: root
|
||||||
net: host
|
net: host
|
||||||
privileged: false
|
privileged: false
|
||||||
detach: false
|
detach: false
|
||||||
volumes:
|
volumes:
|
||||||
- /var/lib/container-config-scripts/:/container-config-scripts/:z
|
list_concat:
|
||||||
- /var/lib/config-data/puppet-generated/placement/:/var/lib/kolla/config_files/src:ro
|
- {get_attr: [ContainersCommon, volumes]}
|
||||||
command: "/usr/bin/bootstrap_host_exec placement su placement -s /bin/bash -c '/container-config-scripts/pyshim.sh /container-config-scripts/placement_wait_for_service.py'"
|
- {get_attr: [PlacementLogging, volumes]}
|
||||||
environment:
|
-
|
||||||
__OS_DEBUG:
|
- /var/lib/config-data/placement/etc/my.cnf.d/tripleo.cnf:/etc/my.cnf.d/tripleo.cnf:ro
|
||||||
yaql:
|
- /var/lib/config-data/placement/etc/placement/:/etc/placement/:ro
|
||||||
expression: str($.data.debug)
|
- /var/lib/container-config-scripts/:/container-config-scripts/:z
|
||||||
data:
|
command: "/usr/bin/bootstrap_host_exec placement su placement -s /bin/bash -c '/container-config-scripts/pyshim.sh /container-config-scripts/placement_wait_for_service.py'"
|
||||||
debug: {get_param: Debug}
|
environment:
|
||||||
|
__OS_DEBUG:
|
||||||
|
yaql:
|
||||||
|
expression: str($.data.debug)
|
||||||
|
data:
|
||||||
|
debug: {get_param: Debug}
|
||||||
host_prep_tasks: {get_attr: [PlacementLogging, host_prep_tasks]}
|
host_prep_tasks: {get_attr: [PlacementLogging, host_prep_tasks]}
|
||||||
upgrade_tasks: []
|
upgrade_tasks: []
|
||||||
post_upgrade_tasks:
|
post_upgrade_tasks:
|
||||||
|
|
Loading…
Reference in New Issue