foreman_kubevirt 0.1.7 → 0.1.8

Sign up to get free protection for your applications and to get access to all the features.
Files changed (49) hide show
  1. checksums.yaml +4 -4
  2. data/app/controllers/foreman_kubevirt/concerns/api/compute_resources_controller_extensions.rb +9 -9
  3. data/app/models/foreman_kubevirt/kubevirt.rb +13 -16
  4. data/app/validators/volume_validator.rb +2 -2
  5. data/lib/foreman_kubevirt/version.rb +1 -1
  6. data/locale/action_names.rb +5 -0
  7. data/locale/ca/LC_MESSAGES/foreman_kubevirt.mo +0 -0
  8. data/locale/ca/foreman_kubevirt.po +170 -0
  9. data/locale/cs_CZ/LC_MESSAGES/foreman_kubevirt.mo +0 -0
  10. data/locale/cs_CZ/foreman_kubevirt.po +170 -0
  11. data/locale/de/LC_MESSAGES/foreman_kubevirt.mo +0 -0
  12. data/locale/de/foreman_kubevirt.po +170 -0
  13. data/locale/en/LC_MESSAGES/foreman_kubevirt.mo +0 -0
  14. data/locale/en/foreman_kubevirt.edit.po +219 -0
  15. data/locale/en/foreman_kubevirt.po +162 -11
  16. data/locale/en/foreman_kubevirt.po.time_stamp +0 -0
  17. data/locale/en_GB/LC_MESSAGES/foreman_kubevirt.mo +0 -0
  18. data/locale/en_GB/foreman_kubevirt.po +170 -0
  19. data/locale/es/LC_MESSAGES/foreman_kubevirt.mo +0 -0
  20. data/locale/es/foreman_kubevirt.po +170 -0
  21. data/locale/foreman_kubevirt.pot +232 -8
  22. data/locale/fr/LC_MESSAGES/foreman_kubevirt.mo +0 -0
  23. data/locale/fr/foreman_kubevirt.po +170 -0
  24. data/locale/gemspec.rb +1 -1
  25. data/locale/gl/LC_MESSAGES/foreman_kubevirt.mo +0 -0
  26. data/locale/gl/foreman_kubevirt.po +170 -0
  27. data/locale/it/LC_MESSAGES/foreman_kubevirt.mo +0 -0
  28. data/locale/it/foreman_kubevirt.po +170 -0
  29. data/locale/ja/LC_MESSAGES/foreman_kubevirt.mo +0 -0
  30. data/locale/ja/foreman_kubevirt.po +170 -0
  31. data/locale/ko/LC_MESSAGES/foreman_kubevirt.mo +0 -0
  32. data/locale/ko/foreman_kubevirt.po +170 -0
  33. data/locale/nl_NL/LC_MESSAGES/foreman_kubevirt.mo +0 -0
  34. data/locale/nl_NL/foreman_kubevirt.po +177 -0
  35. data/locale/pl/LC_MESSAGES/foreman_kubevirt.mo +0 -0
  36. data/locale/pl/foreman_kubevirt.po +176 -0
  37. data/locale/pt_BR/LC_MESSAGES/foreman_kubevirt.mo +0 -0
  38. data/locale/pt_BR/foreman_kubevirt.po +178 -0
  39. data/locale/ru/LC_MESSAGES/foreman_kubevirt.mo +0 -0
  40. data/locale/ru/foreman_kubevirt.po +180 -0
  41. data/locale/sv_SE/LC_MESSAGES/foreman_kubevirt.mo +0 -0
  42. data/locale/sv_SE/foreman_kubevirt.po +176 -0
  43. data/locale/zh_CN/LC_MESSAGES/foreman_kubevirt.mo +0 -0
  44. data/locale/zh_CN/foreman_kubevirt.po +177 -0
  45. data/locale/zh_TW/LC_MESSAGES/foreman_kubevirt.mo +0 -0
  46. data/locale/zh_TW/foreman_kubevirt.po +175 -0
  47. data/test/models/compute_resources/kubevirt_test.rb +1 -1
  48. data/test/unit/foreman_kubevirt_test.rb +0 -2
  49. metadata +43 -5
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: f619df9926ad4c9ca2cf964e29f1f97123224e25bbf9b95c5dd52f2cf63e035a
4
- data.tar.gz: b55f71d2315a39de2a6825082befb77d304f3dd3234633f1917097cde4ea23da
3
+ metadata.gz: b284e744d2f757d5493ff422214f54fd3247f50fc57cdcf3a64fe56f09c8cebe
4
+ data.tar.gz: c0468a5c9499fe9930d66efdba3519ea251963fdd07fa03b6cbd0ad2cebe28d6
5
5
  SHA512:
6
- metadata.gz: 9ab3ad59f3606d8ced103e68e9af033fcc5bc77dd75c39e0c5a6f5b61225223177fef474f551143b7160bdbb36363b056c1b1b602c71cff23c01e6569160e34e
7
- data.tar.gz: 8669114d8c00088129ecc3cf07fb2aa121949f672493466d6401d9cda0d7f773bb52c3e74503479717853abb3b3c88acafa440d11bac78a7e66f2b17add38667
6
+ metadata.gz: b4882fb3ac0e11da7bb342249518066df95202b87f906a487a82be829544d1a46a1512fa1b71ec2367ce55f8fbaacad40e42fadb2a6bd641581afcc3e88f6750
7
+ data.tar.gz: c1f5a09d792cebef6f12390f6aefae6c2b47cd7f1ed11bf39d4727208eec825ba7677cb77fe352a9a7ccdd1f1153b1a14463affd05ac0db60e712af60c5362c0
@@ -2,17 +2,17 @@ module ForemanKubevirt
2
2
  module Concerns
3
3
  module Api
4
4
  module ComputeResourcesControllerExtensions
5
- extend ::Apipie::DSL::Concern
6
- update_api(:create, :update) do
7
- param :compute_resource, Hash do
8
- param :token, String, :desc => N_("Token for KubeVirt only")
9
- param :hostname, String, :desc => N_("Host name for KubeVirt only")
10
- param :namespace, String, :desc => N_("Namespace for KubeVirt only")
11
- param :ca_crt, String, :desc => N_("CA crt for KubeVirt only")
12
- param :api_port, String, :desc => N_("API port for KubeVirt only")
13
- end
5
+ extend ::Apipie::DSL::Concern
6
+ update_api(:create, :update) do
7
+ param :compute_resource, Hash do
8
+ param :token, String, :desc => N_("Token for KubeVirt only")
9
+ param :hostname, String, :desc => N_("Host name for KubeVirt only")
10
+ param :namespace, String, :desc => N_("Namespace for KubeVirt only")
11
+ param :ca_crt, String, :desc => N_("CA crt for KubeVirt only")
12
+ param :api_port, String, :desc => N_("API port for KubeVirt only")
14
13
  end
15
14
  end
15
+ end
16
16
  end
17
17
  end
18
18
  end
@@ -66,19 +66,17 @@ module ForemanKubevirt
66
66
  return false if errors.any?
67
67
  client&.valid? && client&.virt_supported?
68
68
  rescue StandardError => e
69
- if e.message =~ /401/
69
+ if e.message =~ /401/
70
70
  errors[:base] << _('The compute resource could not be authenticated')
71
- else
72
- errors[:base] << e.message
73
- end
71
+ else
72
+ errors[:base] << e.message
73
+ end
74
74
  end
75
75
 
76
76
  def connection_properties_valid?
77
77
  errors[:hostname].empty? && errors[:token].empty? && errors[:namespace].empty? && errors[:api_port].empty?
78
78
  end
79
79
 
80
-
81
-
82
80
  def networks
83
81
  client.networkattachmentdefs.all
84
82
  rescue StandardError => e
@@ -106,7 +104,6 @@ module ForemanKubevirt
106
104
  storage_classes.map { |sc| OpenStruct.new(id: sc.name, description: "#{sc.name} (#{sc.provisioner})") }
107
105
  end
108
106
 
109
-
110
107
  def new_volume(attrs = {})
111
108
  return unless new_volume_errors.empty?
112
109
  capacity = attrs.delete(:capacity)
@@ -177,7 +174,7 @@ module ForemanKubevirt
177
174
  :networks => networks,
178
175
  :interfaces => interfaces)
179
176
  client.servers.get(options[:name])
180
- rescue Exception => e
177
+ rescue Exception => e
181
178
  delete_pvcs(volumes) if volumes
182
179
  raise e
183
180
  end
@@ -307,13 +304,13 @@ module ForemanKubevirt
307
304
  vnc_details = client.vminstances.get_vnc_console_details(vm.name, namespace)
308
305
  token = Base64.encode64(vnc_details[:token]).delete!("\n").delete("==")
309
306
  {
310
- :host => vnc_details[:host],
311
- :port => vnc_details[:port],
312
- :path => vnc_details[:path],
313
- :token_protocol => token_protocol(token),
314
- :plain_protocol => plain_kubevirt_protocol,
315
- :type => 'vnc',
316
- :encrypt => true
307
+ :host => vnc_details[:host],
308
+ :port => vnc_details[:port],
309
+ :path => vnc_details[:path],
310
+ :token_protocol => token_protocol(token),
311
+ :plain_protocol => plain_kubevirt_protocol,
312
+ :type => 'vnc',
313
+ :encrypt => true
317
314
  }
318
315
  end
319
316
 
@@ -386,7 +383,7 @@ module ForemanKubevirt
386
383
  end
387
384
 
388
385
  def validate_only_single_bootable_volume(volumes_attributes)
389
- raise ::Foreman::Exception.new N_('Only one volume can be bootable') if volumes_attributes.select { |_, v| v[:bootable] == "true" }.count > 1
386
+ raise ::Foreman::Exception.new N_('Only one volume can be bootable') if volumes_attributes.count { |_, v| v[:bootable] == "true" } > 1
390
387
  end
391
388
 
392
389
  def create_new_pvc(pvc_name, capacity, storage_class)
@@ -2,9 +2,9 @@ class VolumeValidator < ActiveModel::EachValidator
2
2
  def validate_each(record, attribute, value)
3
3
  if value[:volumes_attributes].present?
4
4
  value[:volumes_attributes].each do |_, attrs|
5
- if attrs.key?("capacity") and attrs.key?("storage_class")
5
+ if attrs.key?("capacity") && attrs.key?("storage_class")
6
6
  if attrs["capacity"].to_s.empty? || /\A\d+G?\Z/.match(attrs["capacity"].to_s).nil?
7
- record.errors.add(attribute, _("Volume size #{attrs["capacity"]} is not valid"))
7
+ record.errors.add(attribute, _("Volume size #{attrs['capacity']} is not valid"))
8
8
  end
9
9
  end
10
10
  end
@@ -1,3 +1,3 @@
1
1
  module ForemanKubevirt
2
- VERSION = '0.1.7'.freeze
2
+ VERSION = '0.1.8'.freeze
3
3
  end
@@ -0,0 +1,5 @@
1
+ # Autogenerated!
2
+ _("Action with sub plans")
3
+ _("Import facts")
4
+ _("Import Puppet classes")
5
+ _("Remote action:")
@@ -0,0 +1,170 @@
1
+ # Catalan translations for foreman_kubevirt package.
2
+ # Copyright (C) 2020 THE PACKAGE'S COPYRIGHT HOLDER
3
+ # This file is distributed under the same license as the foreman_kubevirt package.
4
+ # FIRST AUTHOR <EMAIL@ADDRESS>, 2020.
5
+ #
6
+ msgid ""
7
+ msgstr ""
8
+ "Project-Id-Version: foreman_kubevirt 1.0.0\n"
9
+ "Report-Msgid-Bugs-To: \n"
10
+ "PO-Revision-Date: 2020-05-26 13:16+0530\n"
11
+ "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
12
+ "Language-Team: Catalan\n"
13
+ "Language: ca\n"
14
+ "MIME-Version: 1.0\n"
15
+ "Content-Type: text/plain; charset=UTF-8\n"
16
+ "Content-Transfer-Encoding: 8bit\n"
17
+ "Plural-Forms: nplurals=2; plural=n != 1;\n"
18
+ "\n"
19
+
20
+ msgid "%{cpu_cores} Cores and %{memory} memory"
21
+ msgstr ""
22
+
23
+ msgid "API Port"
24
+ msgstr ""
25
+
26
+ msgid "API port for KubeVirt only"
27
+ msgstr ""
28
+
29
+ msgid "Actions"
30
+ msgstr ""
31
+
32
+ msgid "Bootable"
33
+ msgstr ""
34
+
35
+ msgid "CA crt for KubeVirt only"
36
+ msgstr ""
37
+
38
+ msgid "CNI Provider"
39
+ msgstr ""
40
+
41
+ msgid "CPUs"
42
+ msgstr ""
43
+
44
+ msgid "Disk"
45
+ msgstr ""
46
+
47
+ msgid "Does this image support user data input (e.g. via cloud-init)?"
48
+ msgstr ""
49
+
50
+ msgid "Host name for KubeVirt only"
51
+ msgstr ""
52
+
53
+ msgid "Hostname"
54
+ msgstr ""
55
+
56
+ msgid "Image"
57
+ msgstr ""
58
+
59
+ msgid "It is not possible to set a bootable volume and image based provisioning."
60
+ msgstr ""
61
+
62
+ msgid "Memory"
63
+ msgstr ""
64
+
65
+ msgid "NIC"
66
+ msgstr ""
67
+
68
+ msgid "Name"
69
+ msgstr ""
70
+
71
+ msgid "Namespace"
72
+ msgstr ""
73
+
74
+ msgid "Namespace for KubeVirt only"
75
+ msgstr ""
76
+
77
+ msgid "Network"
78
+ msgstr ""
79
+
80
+ msgid "Only one volume can be bootable"
81
+ msgstr ""
82
+
83
+ msgid "Optionally provide a CA, or a correctly ordered CA chain or a path to a file. If left blank - insecure."
84
+ msgstr ""
85
+
86
+ msgid "Password to authenticate with - used for SSH finish step."
87
+ msgstr ""
88
+
89
+ msgid "Please select an image"
90
+ msgstr ""
91
+
92
+ msgid "Power"
93
+ msgstr ""
94
+
95
+ msgid "Power ON this machine"
96
+ msgstr ""
97
+
98
+ msgid "Properties"
99
+ msgstr ""
100
+
101
+ msgid "Provision and manage Kubevirt Virtual Machines from Foreman."
102
+ msgstr ""
103
+
104
+ msgid "Running on"
105
+ msgstr ""
106
+
107
+ msgid "Size (GB)"
108
+ msgstr ""
109
+
110
+ msgid "Start"
111
+ msgstr ""
112
+
113
+ msgid "Storage Class"
114
+ msgstr ""
115
+
116
+ msgid "The compute resource could not be authenticated"
117
+ msgstr ""
118
+
119
+ msgid "The name of the image in the registry."
120
+ msgstr ""
121
+
122
+ msgid ""
123
+ "The remote system presented a public key signed by an unidentified certificate authority.\n"
124
+ " If you are sure the remote system is authentic, go to the compute resource edit page, press the 'Test Connection' button and submit"
125
+ msgstr ""
126
+
127
+ msgid "The user that is used to ssh into the instance, normally cloud-user, ec2-user, ubuntu, root etc"
128
+ msgstr ""
129
+
130
+ msgid "Token"
131
+ msgstr ""
132
+
133
+ msgid "Token for KubeVirt only"
134
+ msgstr ""
135
+
136
+ msgid "Type"
137
+ msgstr ""
138
+
139
+ msgid "UUID"
140
+ msgstr ""
141
+
142
+ msgid "VCPU(s)"
143
+ msgstr ""
144
+
145
+ msgid "VM should be created based on Persistent Volume Claim or Image"
146
+ msgstr ""
147
+
148
+ msgid "VM should be created based on an image"
149
+ msgstr ""
150
+
151
+ msgid "X509 Certification Authorities"
152
+ msgstr ""
153
+
154
+ msgid "cni_provider or network are missing"
155
+ msgstr ""
156
+
157
+ msgid "e.g. eyJhbGciOiJSUzI1NiIsImtpZCI6IiJ9..."
158
+ msgstr ""
159
+
160
+ msgid "genie"
161
+ msgstr ""
162
+
163
+ msgid "multus"
164
+ msgstr ""
165
+
166
+ msgid "no Storage Classes available on provider"
167
+ msgstr ""
168
+
169
+ msgid "pod"
170
+ msgstr ""
@@ -0,0 +1,170 @@
1
+ # Czech translations for foreman_kubevirt package.
2
+ # Copyright (C) 2020 THE PACKAGE'S COPYRIGHT HOLDER
3
+ # This file is distributed under the same license as the foreman_kubevirt package.
4
+ # FIRST AUTHOR <EMAIL@ADDRESS>, 2020.
5
+ #
6
+ msgid ""
7
+ msgstr ""
8
+ "Project-Id-Version: foreman_kubevirt 1.0.0\n"
9
+ "Report-Msgid-Bugs-To: \n"
10
+ "PO-Revision-Date: 2020-05-26 13:16+0530\n"
11
+ "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
12
+ "Language-Team: Czech\n"
13
+ "Language: cs_CZ\n"
14
+ "MIME-Version: 1.0\n"
15
+ "Content-Type: text/plain; charset=UTF-8\n"
16
+ "Content-Transfer-Encoding: 8bit\n"
17
+ "Plural-Forms: nplurals=3; plural=(n==1) ? 0 : (n>=2 && n<=4) ? 1 : 2;\n"
18
+ "\n"
19
+
20
+ msgid "%{cpu_cores} Cores and %{memory} memory"
21
+ msgstr ""
22
+
23
+ msgid "API Port"
24
+ msgstr ""
25
+
26
+ msgid "API port for KubeVirt only"
27
+ msgstr ""
28
+
29
+ msgid "Actions"
30
+ msgstr ""
31
+
32
+ msgid "Bootable"
33
+ msgstr ""
34
+
35
+ msgid "CA crt for KubeVirt only"
36
+ msgstr ""
37
+
38
+ msgid "CNI Provider"
39
+ msgstr ""
40
+
41
+ msgid "CPUs"
42
+ msgstr ""
43
+
44
+ msgid "Disk"
45
+ msgstr ""
46
+
47
+ msgid "Does this image support user data input (e.g. via cloud-init)?"
48
+ msgstr ""
49
+
50
+ msgid "Host name for KubeVirt only"
51
+ msgstr ""
52
+
53
+ msgid "Hostname"
54
+ msgstr ""
55
+
56
+ msgid "Image"
57
+ msgstr ""
58
+
59
+ msgid "It is not possible to set a bootable volume and image based provisioning."
60
+ msgstr ""
61
+
62
+ msgid "Memory"
63
+ msgstr ""
64
+
65
+ msgid "NIC"
66
+ msgstr ""
67
+
68
+ msgid "Name"
69
+ msgstr ""
70
+
71
+ msgid "Namespace"
72
+ msgstr ""
73
+
74
+ msgid "Namespace for KubeVirt only"
75
+ msgstr ""
76
+
77
+ msgid "Network"
78
+ msgstr ""
79
+
80
+ msgid "Only one volume can be bootable"
81
+ msgstr ""
82
+
83
+ msgid "Optionally provide a CA, or a correctly ordered CA chain or a path to a file. If left blank - insecure."
84
+ msgstr ""
85
+
86
+ msgid "Password to authenticate with - used for SSH finish step."
87
+ msgstr ""
88
+
89
+ msgid "Please select an image"
90
+ msgstr ""
91
+
92
+ msgid "Power"
93
+ msgstr ""
94
+
95
+ msgid "Power ON this machine"
96
+ msgstr ""
97
+
98
+ msgid "Properties"
99
+ msgstr ""
100
+
101
+ msgid "Provision and manage Kubevirt Virtual Machines from Foreman."
102
+ msgstr ""
103
+
104
+ msgid "Running on"
105
+ msgstr ""
106
+
107
+ msgid "Size (GB)"
108
+ msgstr ""
109
+
110
+ msgid "Start"
111
+ msgstr ""
112
+
113
+ msgid "Storage Class"
114
+ msgstr ""
115
+
116
+ msgid "The compute resource could not be authenticated"
117
+ msgstr ""
118
+
119
+ msgid "The name of the image in the registry."
120
+ msgstr ""
121
+
122
+ msgid ""
123
+ "The remote system presented a public key signed by an unidentified certificate authority.\n"
124
+ " If you are sure the remote system is authentic, go to the compute resource edit page, press the 'Test Connection' button and submit"
125
+ msgstr ""
126
+
127
+ msgid "The user that is used to ssh into the instance, normally cloud-user, ec2-user, ubuntu, root etc"
128
+ msgstr ""
129
+
130
+ msgid "Token"
131
+ msgstr ""
132
+
133
+ msgid "Token for KubeVirt only"
134
+ msgstr ""
135
+
136
+ msgid "Type"
137
+ msgstr ""
138
+
139
+ msgid "UUID"
140
+ msgstr ""
141
+
142
+ msgid "VCPU(s)"
143
+ msgstr ""
144
+
145
+ msgid "VM should be created based on Persistent Volume Claim or Image"
146
+ msgstr ""
147
+
148
+ msgid "VM should be created based on an image"
149
+ msgstr ""
150
+
151
+ msgid "X509 Certification Authorities"
152
+ msgstr ""
153
+
154
+ msgid "cni_provider or network are missing"
155
+ msgstr ""
156
+
157
+ msgid "e.g. eyJhbGciOiJSUzI1NiIsImtpZCI6IiJ9..."
158
+ msgstr ""
159
+
160
+ msgid "genie"
161
+ msgstr ""
162
+
163
+ msgid "multus"
164
+ msgstr ""
165
+
166
+ msgid "no Storage Classes available on provider"
167
+ msgstr ""
168
+
169
+ msgid "pod"
170
+ msgstr ""