@@ -67,7 +67,7 @@ def _control_component(self, cmds):
67
67
def create_component (self , staged_component_path , application_name , component , properties ):
68
68
logging .debug ("create_component: %s %s %s" , application_name , json .dumps (component ), properties )
69
69
distro = platform .dist ()
70
- redhat = distro [0 ] == 'redhat'
70
+ usesSystemd = distro [0 ] in ( 'redhat' , 'centos' )
71
71
remote_component_tmp_path = '%s/%s/%s' % (
72
72
'/tmp/%s' % self ._namespace , application_name , component ['component_name' ])
73
73
remote_component_install_path = '%s/%s/%s' % (
@@ -102,8 +102,7 @@ def create_component(self, staged_component_path, application_name, component, p
102
102
103
103
this_dir = os .path .dirname (os .path .realpath (__file__ ))
104
104
copy (os .path .join (this_dir , 'yarn-kill.py' ), staged_component_path )
105
- distro = platform .dist ()
106
- if redhat :
105
+ if usesSystemd :
107
106
service_script = 'systemd.service.tpl' if java_app else 'systemd.service.py.tpl'
108
107
service_script_install_path = '/usr/lib/systemd/system/%s.service' % service_name
109
108
else :
@@ -155,7 +154,7 @@ def create_component(self, staged_component_path, application_name, component, p
155
154
logging .debug ("uninstall commands: %s" , undo_commands )
156
155
157
156
start_commands = []
158
- if redhat :
157
+ if usesSystemd :
159
158
start_commands .append ('sudo systemctl daemon-reload\n ' )
160
159
start_commands .append ('sudo service %s start\n ' % service_name )
161
160
logging .debug ("start commands: %s" , start_commands )
0 commit comments