mirror of
https://github.com/edgebox-iot/edgeboxctl.git
synced 2026-09-25 06:13:03 +02:00
Leverage release as version
This commit is contained in:
@@ -6,7 +6,6 @@ import (
|
||||
"path/filepath"
|
||||
"strings"
|
||||
|
||||
"github.com/edgebox-iot/edgeboxctl/internal/diagnostics"
|
||||
"github.com/edgebox-iot/edgeboxctl/internal/utils"
|
||||
"github.com/shirou/gopsutil/disk"
|
||||
)
|
||||
@@ -75,20 +74,9 @@ const (
|
||||
DISK_TYPE_VDA DeviceIdentifier = "vda"
|
||||
)
|
||||
|
||||
func GetDeviceIdentifier(release_version diagnostics.ReleaseVersion) DeviceIdentifier {
|
||||
switch release_version {
|
||||
case diagnostics.CLOUD_VERSION:
|
||||
return DISK_TYPE_VDA
|
||||
case diagnostics.PROD_VERSION:
|
||||
return DISK_TYPE_MCBLK
|
||||
}
|
||||
|
||||
return DISK_TYPE_SDA
|
||||
}
|
||||
|
||||
// GetDevices : Returns a list of all available sotrage devices in structs filled with information
|
||||
func GetDevices(release_version diagnostics.ReleaseVersion) []Device {
|
||||
|
||||
// GetDevices : Returns a list of all available storage devices in structs filled with information
|
||||
func GetDevices() []Device {
|
||||
var devices []Device
|
||||
|
||||
cmdArgs := []string{"--raw", "--bytes", "--noheadings"}
|
||||
@@ -100,8 +88,6 @@ func GetDevices(release_version diagnostics.ReleaseVersion) []Device {
|
||||
firstDevice := true
|
||||
currentDeviceInUseFlag := false
|
||||
|
||||
mainDiskID := GetDeviceIdentifier(release_version)
|
||||
|
||||
for scanner.Scan() {
|
||||
// 1 Device is represented here. Extract words in order for filling a Device struct
|
||||
// Example deviceRawInfo: "mmcblk0 179:0 0 29.7G 0 disk"
|
||||
@@ -153,14 +139,9 @@ func GetDevices(release_version diagnostics.ReleaseVersion) []Device {
|
||||
Status: DeviceStatus{ID: 1, Description: "healthy"},
|
||||
}
|
||||
|
||||
if device.ID == mainDiskID {
|
||||
device.MainDevice = true
|
||||
}
|
||||
|
||||
currentDevice = device
|
||||
|
||||
} else if isPartition {
|
||||
|
||||
mountpoint := ""
|
||||
if len(deviceRawInfo) >= 7 {
|
||||
mountpoint = deviceRawInfo[6]
|
||||
|
||||
Reference in New Issue
Block a user