summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYolanda Robla Mota <yroblamo@redhat.com>2016-11-25 18:19:51 +0100
committerYolanda Robla Mota <yroblamo@redhat.com>2016-12-05 12:37:17 +0100
commitb9fb5326fd4789aed2a04b30b0586aa47717d295 (patch)
treed4a16eda1fa1d4c2dc7a0155b2a8ce0f4237be08
parent57a19a7267a8608a434ba05529be9fba297f6027 (diff)
Copy map-services script to tripleo elements
map-services will be removed on dib v2 branch, but tripleo still relies heavily on it. To prevent breakage, copy the script to the internal element using it. In the future, all elements will need to be migrated to new svc-map, but it is a massive change. Change-Id: I9f450de66044123ab07fa498b68f744d1029089a
Notes
Notes (review): Code-Review+2: Juan Antonio Osorio Robles <jaosorior@redhat.com> Workflow+1: Emilien Macchi <emilien@redhat.com> Verified+2: Jenkins Submitted-by: Jenkins Submitted-at: Tue, 20 Dec 2016 16:02:05 +0000 Reviewed-on: https://review.openstack.org/406895 Project: openstack/tripleo-image-elements Branch: refs/heads/master
-rwxr-xr-xelements/os-svc-install/bin/map-services-tripleo95
-rwxr-xr-xelements/os-svc-install/install.d/04-os-svc-install2
2 files changed, 97 insertions, 0 deletions
diff --git a/elements/os-svc-install/bin/map-services-tripleo b/elements/os-svc-install/bin/map-services-tripleo
new file mode 100755
index 0000000..b5622f2
--- /dev/null
+++ b/elements/os-svc-install/bin/map-services-tripleo
@@ -0,0 +1,95 @@
1#!/usr/bin/env python
2# dib-lint: disable=indent
3# Copyright 2012 Hewlett-Packard Development Company, L.P.
4# Copyright 2014 Red Hat, Inc.
5#
6# Licensed under the Apache License, Version 2.0 (the "License"); you may
7# not use this file except in compliance with the License. You may obtain
8# a copy of the License at
9#
10# http://www.apache.org/licenses/LICENSE-2.0
11#
12# Unless required by applicable law or agreed to in writing, software
13# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
14# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
15# License for the specific language governing permissions and limitations
16# under the License.
17
18from __future__ import print_function
19import os
20import sys
21
22# Manually maintained for brevity; consider making this compiled from
23# distromatch or other rich data sources.
24# TripleO service name on the left, Fedora/RHEL on the right.
25service_map = {
26 'apache2': 'httpd',
27 'ceilometer-api': 'openstack-ceilometer-api',
28 'ceilometer-agent-central': 'openstack-ceilometer-central',
29 'ceilometer-agent-compute': 'openstack-ceilometer-compute',
30 'ceilometer-agent-notification': 'openstack-ceilometer-notification',
31 'ceilometer-collector': 'openstack-ceilometer-collector',
32 'cinder-api': 'openstack-cinder-api',
33 'cinder-backup': 'openstack-cinder-backup',
34 'cinder-scheduler': 'openstack-cinder-scheduler',
35 'cinder-volume': 'openstack-cinder-volume',
36 'glance-api': 'openstack-glance-api',
37 'glance-reg': 'openstack-glance-registry',
38 'heat-api': 'openstack-heat-api',
39 'heat-api-cfn': 'openstack-heat-api-cfn',
40 'heat-api-cloudwatch': 'openstack-heat-api-cloudwatch',
41 'heat-engine': 'openstack-heat-engine',
42 'ironic-api': 'openstack-ironic-api',
43 'ironic-conductor': 'openstack-ironic-conductor',
44 'keystone': 'openstack-keystone',
45 'libvirt-bin': 'libvirtd',
46 'mysql': ['mysqld', 'mariadb'],
47 'nova-conductor': 'openstack-nova-conductor',
48 'nova-api': 'openstack-nova-api',
49 'nova-cert': 'openstack-nova-cert',
50 'nova-scheduler': 'openstack-nova-scheduler',
51 'nova-consoleauth': 'openstack-nova-consoleauth',
52 'nova-compute': 'openstack-nova-compute',
53 'nova-novncproxy': 'openstack-nova-novncproxy',
54 'openvswitch-switch': 'openvswitch',
55 'rsync': 'rsyncd',
56 'swift-proxy': 'openstack-swift-proxy',
57 'swift-account': 'openstack-swift-account',
58 'swift-account-auditor': 'openstack-swift-account-auditor',
59 'swift-account-reaper': 'openstack-swift-account-reaper',
60 'swift-account-replicator': 'openstack-swift-account-replicator',
61 'swift-container': 'openstack-swift-container',
62 'swift-container-auditor': 'openstack-swift-container-auditor',
63 'swift-container-replicator': 'openstack-swift-container-replicator',
64 'swift-container-updater': 'openstack-swift-container-updater',
65 'swift-object': 'openstack-swift-object',
66 'swift-object-auditor': 'openstack-swift-object-auditor',
67 'swift-object-replicator': 'openstack-swift-object-replicator',
68 'swift-object-updater': 'openstack-swift-object-updater',
69 'tgt': 'tgtd',
70}
71
72print("WARNING: map-services has been deprecated. "
73 "Please use the svc-map element.", file=sys.stderr)
74
75for arg in sys.argv[1:]:
76 # We need to support the service name being different when installing from
77 # source vs. packages. So, if the requested service file already exists,
78 # just use that.
79 if os.path.exists('/lib/systemd/system/%s.service' % arg):
80 print(arg)
81 else:
82 mapping = service_map.get(arg, arg)
83 # Handle cases where a service may map to multiple names depending on
84 # which specific distribution we're using.
85 if isinstance(mapping, list):
86 for name in mapping:
87 if os.path.exists('/lib/systemd/system/%s.service' % name):
88 print(name)
89 break
90 else:
91 # We didn't find a match for any of the mappings.
92 print(arg)
93 else:
94 print(mapping)
95sys.exit(0)
diff --git a/elements/os-svc-install/install.d/04-os-svc-install b/elements/os-svc-install/install.d/04-os-svc-install
index 07848c3..dbcaaf1 100755
--- a/elements/os-svc-install/install.d/04-os-svc-install
+++ b/elements/os-svc-install/install.d/04-os-svc-install
@@ -5,6 +5,8 @@ install -m 0755 -o root -g root $(dirname $0)/../bin/os-svc-install /usr/local/b
5install -m 0755 -o root -g root $(dirname $0)/../bin/os-svc-daemon /usr/local/bin/os-svc-daemon 5install -m 0755 -o root -g root $(dirname $0)/../bin/os-svc-daemon /usr/local/bin/os-svc-daemon
6install -m 0755 -o root -g root $(dirname $0)/../bin/os-db-create /usr/local/bin/os-db-create 6install -m 0755 -o root -g root $(dirname $0)/../bin/os-db-create /usr/local/bin/os-db-create
7install -m 0755 -o root -g root $(dirname $0)/../bin/os-svc-enable /usr/local/bin/os-svc-enable 7install -m 0755 -o root -g root $(dirname $0)/../bin/os-svc-enable /usr/local/bin/os-svc-enable
8install -m 0755 -o root -g root $(dirname $0)/../bin/map-services-tripleo /usr/local/bin/map-services
9
8if [ "$(dib-init-system)" = "upstart" ] ; then 10if [ "$(dib-init-system)" = "upstart" ] ; then
9 install -m 0755 -o root -g root $(dirname $0)/../bin/os-svc-enable-upstart /usr/local/bin/os-svc-enable-upstart 11 install -m 0755 -o root -g root $(dirname $0)/../bin/os-svc-enable-upstart /usr/local/bin/os-svc-enable-upstart
10 install -m 0644 -o root -g root $(dirname $0)/../upstart/os-svc-enable.conf /etc/init/os-svc-enable.conf 12 install -m 0644 -o root -g root $(dirname $0)/../upstart/os-svc-enable.conf /etc/init/os-svc-enable.conf