Alon Bar-Lev has uploaded a new change for review.

Change subject: bootstrap: make approve command respect installation failure
......................................................................

bootstrap: make approve command respect installation failure

Current implementation assumes success at all results, which is invalid.

Do not use parent member if there is a method to access it.

Change-Id: Iab010f40007ac11dd909350f60b6db1880edbf7f
Signed-off-by: Alon Bar-Lev <[email protected]>
---
M 
backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/ApproveVdsCommand.java
1 file changed, 7 insertions(+), 18 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/43/9443/1

diff --git 
a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/ApproveVdsCommand.java
 
b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/ApproveVdsCommand.java
index 4dafdfd..9507681 100644
--- 
a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/ApproveVdsCommand.java
+++ 
b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/ApproveVdsCommand.java
@@ -2,7 +2,6 @@
 
 import org.ovirt.engine.core.common.AuditLogType;
 import org.ovirt.engine.core.common.action.ApproveVdsParameters;
-import org.ovirt.engine.core.common.businessentities.VDS;
 import org.ovirt.engine.core.common.businessentities.VDSStatus;
 import org.ovirt.engine.core.common.businessentities.VDSType;
 import org.ovirt.engine.core.common.config.Config;
@@ -16,12 +15,6 @@
 
     public ApproveVdsCommand(T parameters) {
         super(parameters);
-    }
-
-    @Override
-    protected void executeCommand() {
-        ApproveVds(getVds());
-        setSucceeded(true);
     }
 
     @Override
@@ -48,18 +41,15 @@
 
     @Override
     public AuditLogType getAuditLogTypeValue() {
-        if (!getSucceeded()) {
-            if (_failureLogTypeValue == AuditLogType.VDS_INSTALL_FAILED) {
-                AddCustomValue("FailedInstallMessage", 
getErrorMessage(_failureMessage));
-            }
-            return _failureLogTypeValue;
-        } else {
+        if (getSucceeded()) {
             return AuditLogType.VDS_APPROVE;
+        } else {
+            return super.getAuditLogTypeValue();
         }
     }
 
-    public void ApproveVds(VDS vds) {
-
+    @Override
+    protected void executeCommand() {
         _failureLogTypeValue = AuditLogType.VDS_INSTALL_FAILED;
         if (Config.<Boolean> 
GetValue(ConfigValues.PowerClientAutoInstallCertificateOnApprove)) {
             super.executeCommand();
@@ -71,14 +61,13 @@
             Backend.getInstance()
             .getResourceManager()
             .RunVdsCommand(VDSCommandType.SetVdsStatus,
-                            new SetVdsStatusVDSCommandParameters(vds.getId(), 
VDSStatus.Unassigned));
+                            new 
SetVdsStatusVDSCommandParameters(getVds().getId(), VDSStatus.Unassigned));
         } else if (getParameters().isApprovedByRegister()) {
             // In case of Approval of oVirt host process, the status of the 
host is re-initialized to PendingApproval
             Backend.getInstance()
                     .getResourceManager()
                     .RunVdsCommand(VDSCommandType.SetVdsStatus,
-                            new SetVdsStatusVDSCommandParameters(vds.getId(), 
VDSStatus.PendingApproval));
+                            new 
SetVdsStatusVDSCommandParameters(getVds().getId(), VDSStatus.PendingApproval));
         }
     }
-
 }


--
To view, visit http://gerrit.ovirt.org/9443
To unsubscribe, visit http://gerrit.ovirt.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Iab010f40007ac11dd909350f60b6db1880edbf7f
Gerrit-PatchSet: 1
Gerrit-Project: ovirt-engine
Gerrit-Branch: master
Gerrit-Owner: Alon Bar-Lev <[email protected]>
_______________________________________________
Engine-patches mailing list
[email protected]
http://lists.ovirt.org/mailman/listinfo/engine-patches

Reply via email to