mirror of
https://github.com/apache/cloudstack.git
synced 2025-11-03 04:12:31 +01:00
CLOUDSTACK-8607 - Changed update script to return exit code based on the result
- Changed location of the update_host_passwd script - Updated the patch files for XenServer - Updated the script path on LibvirtComputing class - Removed the hostIP from the LibvirtUpdateHostPasswordCommandWrapper execute() method
This commit is contained in:
parent
6c92ccf8d1
commit
efa34361df
@ -523,7 +523,7 @@ public class LibvirtComputingResource extends ServerResourceBase implements Serv
|
||||
}
|
||||
|
||||
protected String getDefaultHypervisorScriptsDir() {
|
||||
return "scripts/vm/hypervisor/kvm";
|
||||
return "scripts/vm/hypervisor";
|
||||
}
|
||||
|
||||
protected String getDefaultKvmScriptsDir() {
|
||||
|
||||
@ -36,12 +36,11 @@ public final class LibvirtUpdateHostPasswordCommandWrapper extends CommandWrappe
|
||||
|
||||
@Override
|
||||
public Answer execute(final UpdateHostPasswordCommand command, final LibvirtComputingResource libvirtComputingResource) {
|
||||
final String hostIp = command.getHostIp();
|
||||
final String username = command.getUsername();
|
||||
final String newPassword = command.getNewPassword();
|
||||
|
||||
final Script script = new Script(libvirtComputingResource.getUpdateHostPasswdPath(), TIMEOUT, s_logger);
|
||||
script.add(hostIp, username, newPassword);
|
||||
script.add(username, newPassword);
|
||||
final String result = script.execute();
|
||||
|
||||
if (result != null) {
|
||||
|
||||
@ -43,6 +43,7 @@ public final class CitrixUpdateHostPasswordCommandWrapper extends CommandWrapper
|
||||
final String newPassword = command.getNewPassword();
|
||||
|
||||
final StringBuffer cmdLine = new StringBuffer();
|
||||
cmdLine.append("sh /opt/cloud/bin/");
|
||||
cmdLine.append(VRScripts.UPDATE_HOST_PASSWD);
|
||||
cmdLine.append(' ');
|
||||
cmdLine.append(username);
|
||||
|
||||
@ -18,7 +18,11 @@
|
||||
|
||||
username=$1
|
||||
new_passwd=$2
|
||||
expected="successfully."
|
||||
result=`echo -e "$new_passwd\n$new_passwd" | passwd --stdin $username | grep successfully | awk '{ print $6 }'`
|
||||
|
||||
echo -e "$new_passwd\n$new_passwd" | passwd --stdin $username
|
||||
|
||||
return $?;
|
||||
if [ $result = $expected ]; then
|
||||
exit 0
|
||||
else
|
||||
exit 1
|
||||
fi
|
||||
@ -1,24 +0,0 @@
|
||||
#!/bin/bash
|
||||
# Licensed to the Apache Software Foundation (ASF) under one
|
||||
# or more contributor license agreements. See the NOTICE file
|
||||
# distributed with this work for additional information
|
||||
# regarding copyright ownership. The ASF licenses this file
|
||||
# to you under the Apache License, Version 2.0 (the
|
||||
# "License"); you may not use this file except in compliance
|
||||
# with the License. You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing,
|
||||
# software distributed under the License is distributed on an
|
||||
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
# KIND, either express or implied. See the License for the
|
||||
# specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
username=$1
|
||||
new_passwd=$2
|
||||
|
||||
echo -e "$new_passwd\n$new_passwd" | passwd --stdin $username
|
||||
|
||||
return $?;
|
||||
@ -58,3 +58,4 @@ router_proxy.sh=../../../../network/domr/,0755,/opt/cloud/bin
|
||||
cloudstack_plugins.conf=..,0644,/etc/xensource
|
||||
cloudstack_pluginlib.py=..,0755,/etc/xapi.d/plugins
|
||||
cloudlog=..,0644,/etc/logrotate.d
|
||||
update_host_passwd.sh=../..,0755,/opt/cloud/bin
|
||||
@ -59,4 +59,4 @@ add_to_vcpus_params_live.sh=..,0755,/opt/cloud/bin
|
||||
cloudstack_plugins.conf=..,0644,/etc/xensource
|
||||
cloudstack_pluginlib.py=..,0755,/etc/xapi.d/plugins
|
||||
cloudlog=..,0644,/etc/logrotate.d
|
||||
update_host_passwd.sh=..,0755,/opt/cloud/bin
|
||||
update_host_passwd.sh=../..,0755,/opt/cloud/bin
|
||||
@ -63,4 +63,4 @@ add_to_vcpus_params_live.sh=..,0755,/opt/cloud/bin
|
||||
cloudstack_plugins.conf=..,0644,/etc/xensource
|
||||
cloudstack_pluginlib.py=..,0755,/etc/xapi.d/plugins
|
||||
cloudlog=..,0644,/etc/logrotate.d
|
||||
update_host_passwd.sh=..,0755,/opt/cloud/bin
|
||||
update_host_passwd.sh=../..,0755,/opt/cloud/bin
|
||||
@ -62,4 +62,4 @@ add_to_vcpus_params_live.sh=..,0755,/opt/cloud/bin
|
||||
cloudstack_plugins.conf=..,0644,/etc/xensource
|
||||
cloudstack_pluginlib.py=..,0755,/etc/xapi.d/plugins
|
||||
cloudlog=..,0644,/etc/logrotate.d
|
||||
update_host_passwd.sh=..,0755,/opt/cloud/bin
|
||||
update_host_passwd.sh=../..,0755,/opt/cloud/bin
|
||||
@ -68,4 +68,4 @@ ovs-pvlan-cleanup.sh=../../../network,0755,/opt/cloud/bin
|
||||
ovs-get-dhcp-iface.sh=..,0755,/opt/cloud/bin
|
||||
ovs-get-bridge.sh=..,0755,/opt/cloud/bin
|
||||
cloudlog=..,0644,/etc/logrotate.d
|
||||
update_host_passwd.sh=..,0755,/opt/cloud/bin
|
||||
update_host_passwd.sh=../..,0755,/opt/cloud/bin
|
||||
@ -64,4 +64,4 @@ ovs-pvlan-cleanup.sh=../../../network,0755,/opt/cloud/bin
|
||||
ovs-get-dhcp-iface.sh=..,0755,/opt/cloud/bin
|
||||
ovs-get-bridge.sh=..,0755,/opt/cloud/bin
|
||||
cloudlog=..,0644,/etc/logrotate.d
|
||||
update_host_passwd.sh=..,0755,/opt/cloud/bin
|
||||
update_host_passwd.sh=../..,0755,/opt/cloud/bin
|
||||
@ -64,4 +64,4 @@ ovs-pvlan-cleanup.sh=../../../network,0755,/opt/cloud/bin
|
||||
ovs-get-dhcp-iface.sh=..,0755,/opt/cloud/bin
|
||||
ovs-get-bridge.sh=..,0755,/opt/cloud/bin
|
||||
cloudlog=..,0644,/etc/logrotate.d
|
||||
update_host_passwd.sh=..,0755,/opt/cloud/bin
|
||||
update_host_passwd.sh=../..,0755,/opt/cloud/bin
|
||||
@ -2265,7 +2265,7 @@ public class ResourceManagerImpl extends ManagerBase implements ResourceManager,
|
||||
if (shouldUpdateHostPasswd) {
|
||||
final boolean isUpdated = doUpdateHostPassword(host.getId());
|
||||
if (!isUpdated) {
|
||||
throw new CloudRuntimeException("CloudStack failed to update the password of the Host with UUID/ID ==> " + host.getUuid() + "/" + host.getId() + ". Please make sure you are still able to connect to your hosts.");
|
||||
throw new CloudRuntimeException("CloudStack failed to update the password of the Host with UUID / ID ==> " + host.getUuid() + " / " + host.getId() + ". Please make sure you are still able to connect to your hosts.");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user