Skip to content

Commit d223063

Browse files
author
Sheng Yang
committed
Baremetal: Fix permission deny to ipmi.py
The file cloudstack-oss.asf/client/target/cloud-client-ui-4.2.0-SNAPSHOT/WEB-INF/classes/scripts/util/ipmi.py is not mark as executible, so we cannot execute it directly. Involve "/usr/bin/python" for it. The position of python file maybe different in the different machines.
1 parent fe32dc7 commit d223063

1 file changed

Lines changed: 19 additions & 9 deletions

File tree

‎plugins/hypervisors/baremetal/src/com/cloud/baremetal/networkservice/BareMetalResourceBase.java‎

Lines changed: 19 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -183,60 +183,70 @@ public boolean configure(String name, Map<String, Object> params) throws Configu
183183
if (scriptPath == null) {
184184
throw new ConfigurationException("Cannot find ping script " + scriptPath);
185185
}
186-
_pingCommand = new Script2(scriptPath, s_logger);
186+
String pythonPath = "/usr/bin/python";
187+
_pingCommand = new Script2(pythonPath, s_logger);
188+
_pingCommand.add(scriptPath);
187189
_pingCommand.add("ping");
188190
_pingCommand.add("hostname=" + _ip);
189191
_pingCommand.add("usrname=" + _username);
190192
_pingCommand.add("password=" + _password, ParamType.PASSWORD);
191193

192-
_setPxeBootCommand = new Script2(scriptPath, s_logger);
194+
_setPxeBootCommand = new Script2(pythonPath, s_logger);
195+
_setPxeBootCommand.add(scriptPath);
193196
_setPxeBootCommand.add("boot_dev");
194197
_setPxeBootCommand.add("hostname=" + _ip);
195198
_setPxeBootCommand.add("usrname=" + _username);
196199
_setPxeBootCommand.add("password=" + _password, ParamType.PASSWORD);
197200
_setPxeBootCommand.add("dev=pxe");
198201

199-
_setDiskBootCommand = new Script2(scriptPath, s_logger);
202+
_setDiskBootCommand = new Script2(pythonPath, s_logger);
203+
_setDiskBootCommand.add(scriptPath);
200204
_setDiskBootCommand.add("boot_dev");
201205
_setDiskBootCommand.add("hostname=" + _ip);
202206
_setDiskBootCommand.add("usrname=" + _username);
203207
_setDiskBootCommand.add("password=" + _password, ParamType.PASSWORD);
204208
_setDiskBootCommand.add("dev=disk");
205209

206-
_rebootCommand = new Script2(scriptPath, s_logger);
210+
_rebootCommand = new Script2(pythonPath, s_logger);
211+
_rebootCommand.add(scriptPath);
207212
_rebootCommand.add("reboot");
208213
_rebootCommand.add("hostname=" + _ip);
209214
_rebootCommand.add("usrname=" + _username);
210215
_rebootCommand.add("password=" + _password, ParamType.PASSWORD);
211216

212-
_getStatusCommand = new Script2(scriptPath, s_logger);
217+
_getStatusCommand = new Script2(pythonPath, s_logger);
218+
_getStatusCommand.add(scriptPath);
213219
_getStatusCommand.add("ping");
214220
_getStatusCommand.add("hostname=" + _ip);
215221
_getStatusCommand.add("usrname=" + _username);
216222
_getStatusCommand.add("password=" + _password, ParamType.PASSWORD);
217223

218-
_powerOnCommand = new Script2(scriptPath, s_logger);
224+
_powerOnCommand = new Script2(pythonPath, s_logger);
225+
_powerOnCommand.add(scriptPath);
219226
_powerOnCommand.add("power");
220227
_powerOnCommand.add("hostname=" + _ip);
221228
_powerOnCommand.add("usrname=" + _username);
222229
_powerOnCommand.add("password=" + _password, ParamType.PASSWORD);
223230
_powerOnCommand.add("action=on");
224231

225-
_powerOffCommand = new Script2(scriptPath, s_logger);
232+
_powerOffCommand = new Script2(pythonPath, s_logger);
233+
_powerOffCommand.add(scriptPath);
226234
_powerOffCommand.add("power");
227235
_powerOffCommand.add("hostname=" + _ip);
228236
_powerOffCommand.add("usrname=" + _username);
229237
_powerOffCommand.add("password=" + _password, ParamType.PASSWORD);
230238
_powerOffCommand.add("action=soft");
231239

232-
_forcePowerOffCommand = new Script2(scriptPath, s_logger);
240+
_forcePowerOffCommand = new Script2(pythonPath, s_logger);
241+
_forcePowerOffCommand.add(scriptPath);
233242
_forcePowerOffCommand.add("power");
234243
_forcePowerOffCommand.add("hostname=" + _ip);
235244
_forcePowerOffCommand.add("usrname=" + _username);
236245
_forcePowerOffCommand.add("password=" + _password, ParamType.PASSWORD);
237246
_forcePowerOffCommand.add("action=off");
238247

239-
_bootOrRebootCommand = new Script2(scriptPath, s_logger);
248+
_bootOrRebootCommand = new Script2(pythonPath, s_logger);
249+
_bootOrRebootCommand.add(scriptPath);
240250
_bootOrRebootCommand.add("boot_or_reboot");
241251
_bootOrRebootCommand.add("hostname=" + _ip);
242252
_bootOrRebootCommand.add("usrname=" + _username);

0 commit comments

Comments
 (0)