hammer_cli_foreman_resource_quota 0.1.0 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e90527b47b5267b58ca2ca6622b361d946dd1bccfa50a68fc381109815006817
|
4
|
+
data.tar.gz: b8e74e0e528333cc6e8202062d359b5c4122ed1f518be32416b8302f717f14dc
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a0b442e82b6ef3693a16d82ffe74e1a066b02c52ca5e33c1682c8118cf2879fac46f3f631a178ac9de44a4fe1098be7031f8b00ff4f3a72d56325920795af181
|
7
|
+
data.tar.gz: 3c19d5863472d1c13937ab3ac335a055d4c8ad0fde287a727c90fb995812bb6d441f65cf46605575d1349b27f659bf5561be302680e64de70f88a360cfc718f9
|
@@ -48,8 +48,8 @@ module HammerCLIForemanResourceQuota
|
|
48
48
|
success_message _('Resource quota created.')
|
49
49
|
failure_message _('Could not create resource quota')
|
50
50
|
|
51
|
-
option '--memory', "Memory", _('Maximum memory in MiB'), attribute_name: :
|
52
|
-
option '--disk-space', "Disk space", _('Maximum disk space in GiB'), attribute_name: :
|
51
|
+
option '--memory', "Memory", _('Maximum memory in MiB'), attribute_name: :option_memory_mb, format: HammerCLI::Options::Normalizers::Number.new
|
52
|
+
option '--disk-space', "Disk space", _('Maximum disk space in GiB'), attribute_name: :option_disk_gb, format: HammerCLI::Options::Normalizers::Number.new
|
53
53
|
|
54
54
|
build_options do |o|
|
55
55
|
o.without('memory_mb', 'disk_gb')
|
@@ -57,18 +57,41 @@ module HammerCLIForemanResourceQuota
|
|
57
57
|
end
|
58
58
|
|
59
59
|
class DeleteCommand < HammerCLIForeman::DeleteCommand
|
60
|
-
success_message _('Resource quota
|
60
|
+
success_message _('Resource quota "%{name}" was deleted.')
|
61
61
|
failure_message _('Could not delete the resource quota')
|
62
62
|
|
63
63
|
build_options
|
64
64
|
end
|
65
65
|
|
66
66
|
class UpdateCommand < HammerCLIForeman::UpdateCommand
|
67
|
-
success_message _('Resource quota
|
67
|
+
success_message _('Resource quota "%{name}" updated.')
|
68
68
|
failure_message _('Could not update the resource quota')
|
69
69
|
|
70
|
-
option '--memory', "Memory", _('Maximum memory in MiB'), attribute_name: :
|
71
|
-
option '--disk-space', "Disk space", _('Maximum disk space in GiB'), attribute_name: :
|
70
|
+
option '--memory', "Memory", _('Maximum memory in MiB'), attribute_name: :option_memory_mb, format: HammerCLI::Options::Normalizers::Number.new
|
71
|
+
option '--disk-space', "Disk space", _('Maximum disk space in GiB'), attribute_name: :option_disk_gb, format: HammerCLI::Options::Normalizers::Number.new
|
72
|
+
option '--remove-memory-limit', :flag, _('Remove quota limit for memory')
|
73
|
+
option '--remove-disk-space-limit', :flag, _('Remove quota limit for disk space')
|
74
|
+
option '--remove-cpu-cores-limit', :flag, _('Remove quota limit for CPU cores')
|
75
|
+
|
76
|
+
validate_options do
|
77
|
+
if option(:option_remove_memory_limit).exist? && option(:option_memory_mb).exist?
|
78
|
+
raise ArgumentError, _("You cannot set '--remove-memory-limit' and '--memory' options at the same time")
|
79
|
+
end
|
80
|
+
if option(:option_remove_disk_space_limit).exist? && option(:option_disk_gb).exist?
|
81
|
+
raise ArgumentError, _("You cannot set '--remove-disk-space-limit' and '--disk-space' options at the same time")
|
82
|
+
end
|
83
|
+
if option(:option_remove_cpu_cores_limit).exist? && option(:option_cpu_cores).exist?
|
84
|
+
raise ArgumentError, _("You cannot set '--remove-cpu-cores-limit' and '--cpu-cores' options at the same time")
|
85
|
+
end
|
86
|
+
end
|
87
|
+
|
88
|
+
def request_params
|
89
|
+
super.tap do |opts|
|
90
|
+
opts['resource_quota']['memory_mb'] = nil if option_remove_memory_limit?
|
91
|
+
opts['resource_quota']['disk_gb'] = nil if option_remove_disk_space_limit?
|
92
|
+
opts['resource_quota']['cpu_cores'] = nil if option_remove_cpu_cores_limit?
|
93
|
+
end
|
94
|
+
end
|
72
95
|
|
73
96
|
build_options do |o|
|
74
97
|
o.without('memory_mb', 'disk_gb')
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: hammer_cli_foreman_resource_quota
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- ATIX AG
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2025-01-
|
11
|
+
date: 2025-01-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: hammer_cli_foreman
|