Skip to content

Commit 84b6649

Browse files
authored
Merge pull request #31 from donaldh/develop
Check for CentOS when choosing systemd
2 parents a940e32 + b7cb38e commit 84b6649

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

api/src/main/resources/plugins/sparkStreaming.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ def _control_component(self, cmds):
6767
def create_component(self, staged_component_path, application_name, component, properties):
6868
logging.debug("create_component: %s %s %s", application_name, json.dumps(component), properties)
6969
distro = platform.dist()
70-
redhat = distro[0] == 'redhat'
70+
usesSystemd = distro[0] in ('redhat', 'centos')
7171
remote_component_tmp_path = '%s/%s/%s' % (
7272
'/tmp/%s' % self._namespace, application_name, component['component_name'])
7373
remote_component_install_path = '%s/%s/%s' % (
@@ -102,8 +102,7 @@ def create_component(self, staged_component_path, application_name, component, p
102102

103103
this_dir = os.path.dirname(os.path.realpath(__file__))
104104
copy(os.path.join(this_dir, 'yarn-kill.py'), staged_component_path)
105-
distro = platform.dist()
106-
if redhat:
105+
if usesSystemd:
107106
service_script = 'systemd.service.tpl' if java_app else 'systemd.service.py.tpl'
108107
service_script_install_path = '/usr/lib/systemd/system/%s.service' % service_name
109108
else:
@@ -155,7 +154,7 @@ def create_component(self, staged_component_path, application_name, component, p
155154
logging.debug("uninstall commands: %s", undo_commands)
156155

157156
start_commands = []
158-
if redhat:
157+
if usesSystemd:
159158
start_commands.append('sudo systemctl daemon-reload\n')
160159
start_commands.append('sudo service %s start\n' % service_name)
161160
logging.debug("start commands: %s", start_commands)

0 commit comments

Comments
 (0)