Skip to content

Commit

Permalink
fix: Parent should be of type SnapshotName
Browse files Browse the repository at this point in the history
  • Loading branch information
Tinyblargon committed Jul 17, 2023
1 parent 4ce3993 commit 9426f5a
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions proxmox/snapshot.go
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ type Snapshot struct {
Description string `json:"description,omitempty"`
VmState bool `json:"ram,omitempty"`
Children []*Snapshot `json:"children,omitempty"`
Parent string `json:"parent,omitempty"`
Parent SnapshotName `json:"parent,omitempty"`
}

// Formats the taskResponse as a list of snapshots
Expand All @@ -110,7 +110,7 @@ func (raw rawSnapshots) FormatSnapshotsList() (list []*Snapshot) {
list[i].Name = SnapshotName(e.(map[string]interface{})["name"].(string))
}
if _, isSet := e.(map[string]interface{})["parent"]; isSet {
list[i].Parent = e.(map[string]interface{})["parent"].(string)
list[i].Parent = SnapshotName(e.(map[string]interface{})["parent"].(string))
}
if _, isSet := e.(map[string]interface{})["snaptime"]; isSet {
list[i].SnapTime = uint(e.(map[string]interface{})["snaptime"].(float64))
Expand All @@ -127,7 +127,7 @@ func (raw rawSnapshots) FormatSnapshotsTree() (tree []*Snapshot) {
list := raw.FormatSnapshotsList()
for _, e := range list {
for _, ee := range list {
if e.Parent == string(ee.Name) {
if e.Parent == ee.Name {
ee.Children = append(ee.Children, e)
break
}
Expand Down

0 comments on commit 9426f5a

Please sign in to comment.