radfish 0.1.2 → 0.1.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/radfish/cli.rb +8 -1
- data/lib/radfish/core/system.rb +4 -0
- data/lib/radfish/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2f57d68f93828e6ae9d3721da829aa6c667660ce2995e5f133bb30b9575db4e0
|
4
|
+
data.tar.gz: 443f6020c0c9d017248044db6e4073c2144ef03c0856e2dc646a483dde1664e2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1c7beb6bb2104a5955af53c23fcb3d61443996301b60b7b215fdbf3fd71a540e3aca19d43f8dc81fc8d8cb5af4ecf21edbfcdd580797707bfa1b748377bdba55
|
7
|
+
data.tar.gz: 5d352457420a2bc1c71bc6026eb36f847eda5929a611058acad25e43e07199bab22e699f8653c3e2e974505c9cea5ae786a555aaef7e99c7981c293dfcd996ea
|
data/lib/radfish/cli.rb
CHANGED
@@ -74,6 +74,13 @@ module Radfish
|
|
74
74
|
when 'status', 'state'
|
75
75
|
status = client.power_status
|
76
76
|
output_result({ power_status: status }, "Power Status: #{status}", status == 'On' ? :green : :yellow)
|
77
|
+
when 'consumption', 'usage', 'watts'
|
78
|
+
begin
|
79
|
+
watts = client.power_consumption_watts
|
80
|
+
output_result({ power_consumption_watts: watts }, "Power Consumption: #{watts}W", :green)
|
81
|
+
rescue NotImplementedError
|
82
|
+
error "Power consumption not supported for this vendor"
|
83
|
+
end
|
77
84
|
when 'on'
|
78
85
|
result = client.power_on
|
79
86
|
output_result({ success: result }, result ? "System powered on" : "Failed to power on")
|
@@ -96,7 +103,7 @@ module Radfish
|
|
96
103
|
output_result({ success: result }, result ? "Power cycle initiated" : "Failed to power cycle")
|
97
104
|
else
|
98
105
|
error "Unknown power command: #{subcommand}"
|
99
|
-
puts "Available: status, on, off, force-off, restart, force-restart, cycle"
|
106
|
+
puts "Available: status, on, off, force-off, restart, force-restart, cycle, consumption"
|
100
107
|
puts "Use --force flag with 'off' or 'restart' to skip graceful shutdown"
|
101
108
|
end
|
102
109
|
end
|
data/lib/radfish/core/system.rb
CHANGED
@@ -34,6 +34,10 @@ module Radfish
|
|
34
34
|
def power_consumption
|
35
35
|
raise NotImplementedError, "Adapter must implement #power_consumption"
|
36
36
|
end
|
37
|
+
|
38
|
+
def power_consumption_watts
|
39
|
+
raise NotImplementedError, "Adapter must implement #power_consumption_watts"
|
40
|
+
end
|
37
41
|
end
|
38
42
|
end
|
39
43
|
end
|
data/lib/radfish/version.rb
CHANGED