change srm match
Some checks are pending
CI / Lint (push) Waiting to run
CI / Test (push) Waiting to run
CI / End-to-End (push) Waiting to run
CI / Publish Docker (push) Blocked by required conditions
continuous-integration/drone/push Build is passing

This commit is contained in:
2024-10-16 12:26:10 +11:00
parent fb40abfd48
commit b46369811b
2 changed files with 4 additions and 4 deletions

View File

@@ -455,7 +455,7 @@ func (v *Vcenter) FindVMByIDWithDatacenter(vmID string, dcID string) (*mo.Virtua
} else if _, ok := err.(*find.NotFoundError); !ok { } else if _, ok := err.(*find.NotFoundError); !ok {
// If the error is not a NotFoundError, return it // If the error is not a NotFoundError, return it
//return nil, fmt.Errorf("failed to retrieve VM with ID %s in datacenter %s: %w", vmID, dc.Name(), err) //return nil, fmt.Errorf("failed to retrieve VM with ID %s in datacenter %s: %w", vmID, dc.Name(), err)
v.Logger.Debug("Couldn't find vm in datacenter", "vm_id", vmID, "datacenter_id", dcID) //v.Logger.Debug("Couldn't find vm in datacenter", "vm_id", vmID, "datacenter_id", dcID)
return nil, nil return nil, nil
} else { } else {
return nil, fmt.Errorf("failed to retrieve VM: %w", err) return nil, fmt.Errorf("failed to retrieve VM: %w", err)
@@ -493,7 +493,7 @@ func (v *Vcenter) GetVMFolderPath(vm mo.VirtualMachine) (string, error) {
// Traverse the folder hierarchy to build the full folder path // Traverse the folder hierarchy to build the full folder path
folderPath := "" folderPath := ""
v.Logger.Debug("parent is", "parent", parentRef) //v.Logger.Debug("parent is", "parent", parentRef)
for parentRef.Type != "Datacenter" { for parentRef.Type != "Datacenter" {
// Retrieve the parent object // Retrieve the parent object
@@ -518,7 +518,7 @@ func (v *Vcenter) GetVMFolderPath(vm mo.VirtualMachine) (string, error) {
//if folder, ok := parentObj.(*object.Folder); ok { //if folder, ok := parentObj.(*object.Folder); ok {
if parentObj.Parent != nil { if parentObj.Parent != nil {
parentRef = parentObj.Parent parentRef = parentObj.Parent
v.Logger.Debug("Parent uplevel is", "ref", parentRef) //v.Logger.Debug("Parent uplevel is", "ref", parentRef)
} else { } else {
return "", fmt.Errorf("unexpected parent type: %s", parentObj.Reference().Type) return "", fmt.Errorf("unexpected parent type: %s", parentObj.Reference().Type)
} }

View File

@@ -140,7 +140,7 @@ func (h *Handler) VmModifyEvent(w http.ResponseWriter, r *http.Request) {
params.PlaceholderChange = sql.NullString{String: "testVm", Valid: true} params.PlaceholderChange = sql.NullString{String: "testVm", Valid: true}
changeFound = true changeFound = true
params.UpdateType = "srm" params.UpdateType = "srm"
} else if change["newValue"] == "placeholderVm" { } else if change["newValue"] == "\\\"placeholderVm\\\"" {
h.Logger.Debug("placeholderVm") h.Logger.Debug("placeholderVm")
params.PlaceholderChange = sql.NullString{String: "placeholderVm", Valid: true} params.PlaceholderChange = sql.NullString{String: "placeholderVm", Valid: true}
changeFound = true changeFound = true