foreman_google 3.0.8 → 3.1.1
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/app/assets/javascripts/foreman_google/locale/cs_CZ/foreman_google.js +7 -1
- data/app/assets/javascripts/foreman_google/locale/de/foreman_google.js +7 -1
- data/app/assets/javascripts/foreman_google/locale/el/foreman_google.js +7 -1
- data/app/assets/javascripts/foreman_google/locale/en/foreman_google.js +7 -1
- data/app/assets/javascripts/foreman_google/locale/en_GB/foreman_google.js +7 -1
- data/app/assets/javascripts/foreman_google/locale/es/foreman_google.js +7 -1
- data/app/assets/javascripts/foreman_google/locale/fr/foreman_google.js +8 -2
- data/app/assets/javascripts/foreman_google/locale/it/foreman_google.js +7 -1
- data/app/assets/javascripts/foreman_google/locale/ja/foreman_google.js +8 -2
- data/app/assets/javascripts/foreman_google/locale/ka/foreman_google.js +7 -1
- data/app/assets/javascripts/foreman_google/locale/ko/foreman_google.js +8 -2
- data/app/assets/javascripts/foreman_google/locale/pl/foreman_google.js +7 -1
- data/app/assets/javascripts/foreman_google/locale/pt_BR/foreman_google.js +7 -1
- data/app/assets/javascripts/foreman_google/locale/ru/foreman_google.js +7 -1
- data/app/assets/javascripts/foreman_google/locale/sv_SE/foreman_google.js +7 -1
- data/app/assets/javascripts/foreman_google/locale/zh_CN/foreman_google.js +8 -2
- data/app/assets/javascripts/foreman_google/locale/zh_TW/foreman_google.js +7 -1
- data/app/lib/google_cloud_compute/compute_attributes.rb +3 -1
- data/app/models/foreman_google/gce.rb +2 -4
- data/app/models/foreman_google/google_compute.rb +2 -2
- data/lib/foreman_google/engine.rb +1 -1
- data/lib/foreman_google/version.rb +1 -1
- data/locale/cs_CZ/LC_MESSAGES/foreman_google.mo +0 -0
- data/locale/cs_CZ/foreman_google.po +7 -1
- data/locale/de/LC_MESSAGES/foreman_google.mo +0 -0
- data/locale/de/foreman_google.po +7 -1
- data/locale/el/LC_MESSAGES/foreman_google.mo +0 -0
- data/locale/el/foreman_google.po +7 -1
- data/locale/en/LC_MESSAGES/foreman_google.mo +0 -0
- data/locale/en/foreman_google.po +7 -1
- data/locale/en_GB/LC_MESSAGES/foreman_google.mo +0 -0
- data/locale/en_GB/foreman_google.po +7 -1
- data/locale/es/LC_MESSAGES/foreman_google.mo +0 -0
- data/locale/es/foreman_google.po +7 -1
- data/locale/foreman_google.pot +12 -4
- data/locale/fr/LC_MESSAGES/foreman_google.mo +0 -0
- data/locale/fr/foreman_google.po +9 -3
- data/locale/it/LC_MESSAGES/foreman_google.mo +0 -0
- data/locale/it/foreman_google.po +7 -1
- data/locale/ja/LC_MESSAGES/foreman_google.mo +0 -0
- data/locale/ja/foreman_google.po +9 -3
- data/locale/ka/LC_MESSAGES/foreman_google.mo +0 -0
- data/locale/ka/foreman_google.po +7 -1
- data/locale/ko/LC_MESSAGES/foreman_google.mo +0 -0
- data/locale/ko/foreman_google.po +9 -3
- data/locale/pl/LC_MESSAGES/foreman_google.mo +0 -0
- data/locale/pl/foreman_google.po +7 -1
- data/locale/pt_BR/LC_MESSAGES/foreman_google.mo +0 -0
- data/locale/pt_BR/foreman_google.po +7 -1
- data/locale/ru/LC_MESSAGES/foreman_google.mo +0 -0
- data/locale/ru/foreman_google.po +7 -1
- data/locale/sv_SE/LC_MESSAGES/foreman_google.mo +0 -0
- data/locale/sv_SE/foreman_google.po +7 -1
- data/locale/zh_CN/LC_MESSAGES/foreman_google.mo +0 -0
- data/locale/zh_CN/foreman_google.po +9 -3
- data/locale/zh_TW/LC_MESSAGES/foreman_google.mo +0 -0
- data/locale/zh_TW/foreman_google.po +7 -1
- data/test/controllers/foreman_google/api/v2/compute_resources_extensions_test.rb +71 -0
- data/test/models/concerns/foreman_google/host_managed_extensions_test.rb +46 -0
- data/test/models/foreman_google/gce_test.rb +275 -3
- data/test/models/foreman_google/google_compute_test.rb +193 -4
- data/test/unit/foreman_google/google_compute_adapter_test.rb +59 -7
- data/test/unit/google_cloud_compute/compute_attributes_test.rb +235 -0
- data/test/unit/google_cloud_compute/compute_collection_test.rb +78 -0
- data/test/unit/google_extensions/attached_disk_test.rb +35 -0
- metadata +10 -2
data/locale/fr/foreman_google.po
CHANGED
|
@@ -9,14 +9,14 @@
|
|
|
9
9
|
# Claer <transiblu@claer.hammock.fr>, 2022
|
|
10
10
|
# Amit Upadhye <aupadhye@redhat.com>, 2022
|
|
11
11
|
# Ewoud Kohl van Wijngaarden <ewoud+transifex@kohlvanwijngaarden.nl>, 2024
|
|
12
|
+
# Ondřej Gajdušek, 2026
|
|
12
13
|
#
|
|
13
14
|
msgid ""
|
|
14
15
|
msgstr ""
|
|
15
|
-
"Project-Id-Version: foreman_google 3.0
|
|
16
|
+
"Project-Id-Version: foreman_google 3.1.0\n"
|
|
16
17
|
"Report-Msgid-Bugs-To: \n"
|
|
17
18
|
"PO-Revision-Date: 2022-08-01 12:51+0000\n"
|
|
18
|
-
"Last-Translator:
|
|
19
|
-
"n.nl>, 2024\n"
|
|
19
|
+
"Last-Translator: Ondřej Gajdušek, 2026\n"
|
|
20
20
|
"Language-Team: French (https://app.transifex.com/foreman/teams/114/fr/)\n"
|
|
21
21
|
"MIME-Version: 1.0\n"
|
|
22
22
|
"Content-Type: text/plain; charset=UTF-8\n"
|
|
@@ -102,3 +102,9 @@ msgstr "Zone, pour GCE uniquement"
|
|
|
102
102
|
|
|
103
103
|
msgid "console is not available at this time because the instance is powered off"
|
|
104
104
|
msgstr "la console n'est pas disponible pour le moment car l'instance est éteinte"
|
|
105
|
+
|
|
106
|
+
msgid "unable to start machine that is not persisted"
|
|
107
|
+
msgstr "Impossible de démarrer une machine qui n'est pas persistante."
|
|
108
|
+
|
|
109
|
+
msgid "unable to stop machine that is not persisted"
|
|
110
|
+
msgstr "Impossible d'arrêter une machine dont l'enregistrement n'est pas persistant."
|
|
Binary file
|
data/locale/it/foreman_google.po
CHANGED
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
#
|
|
11
11
|
msgid ""
|
|
12
12
|
msgstr ""
|
|
13
|
-
"Project-Id-Version: foreman_google 3.0
|
|
13
|
+
"Project-Id-Version: foreman_google 3.1.0\n"
|
|
14
14
|
"Report-Msgid-Bugs-To: \n"
|
|
15
15
|
"PO-Revision-Date: 2022-08-01 12:51+0000\n"
|
|
16
16
|
"Last-Translator: 0868a4d1af5275b3f70b0a6dac4c99a4, 2022\n"
|
|
@@ -99,3 +99,9 @@ msgstr ""
|
|
|
99
99
|
|
|
100
100
|
msgid "console is not available at this time because the instance is powered off"
|
|
101
101
|
msgstr ""
|
|
102
|
+
|
|
103
|
+
msgid "unable to start machine that is not persisted"
|
|
104
|
+
msgstr ""
|
|
105
|
+
|
|
106
|
+
msgid "unable to stop machine that is not persisted"
|
|
107
|
+
msgstr ""
|
|
Binary file
|
data/locale/ja/foreman_google.po
CHANGED
|
@@ -8,14 +8,14 @@
|
|
|
8
8
|
# Bryan Kearney <bryan.kearney@gmail.com>, 2022
|
|
9
9
|
# Amit Upadhye <aupadhye@redhat.com>, 2022
|
|
10
10
|
# Ewoud Kohl van Wijngaarden <ewoud+transifex@kohlvanwijngaarden.nl>, 2024
|
|
11
|
+
# Ondřej Gajdušek, 2026
|
|
11
12
|
#
|
|
12
13
|
msgid ""
|
|
13
14
|
msgstr ""
|
|
14
|
-
"Project-Id-Version: foreman_google 3.0
|
|
15
|
+
"Project-Id-Version: foreman_google 3.1.0\n"
|
|
15
16
|
"Report-Msgid-Bugs-To: \n"
|
|
16
17
|
"PO-Revision-Date: 2022-08-01 12:51+0000\n"
|
|
17
|
-
"Last-Translator:
|
|
18
|
-
"n.nl>, 2024\n"
|
|
18
|
+
"Last-Translator: Ondřej Gajdušek, 2026\n"
|
|
19
19
|
"Language-Team: Japanese (https://app.transifex.com/foreman/teams/114/ja/)\n"
|
|
20
20
|
"MIME-Version: 1.0\n"
|
|
21
21
|
"Content-Type: text/plain; charset=UTF-8\n"
|
|
@@ -100,3 +100,9 @@ msgstr "ゾーン、GCE 専用"
|
|
|
100
100
|
|
|
101
101
|
msgid "console is not available at this time because the instance is powered off"
|
|
102
102
|
msgstr "インスタンスの電源がオフであるため、現時点ではコンソールは使用できません"
|
|
103
|
+
|
|
104
|
+
msgid "unable to start machine that is not persisted"
|
|
105
|
+
msgstr "永続化されていないマシンを起動できません"
|
|
106
|
+
|
|
107
|
+
msgid "unable to stop machine that is not persisted"
|
|
108
|
+
msgstr "永続化されていないマシンを停止できません"
|
|
Binary file
|
data/locale/ka/foreman_google.po
CHANGED
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
#
|
|
9
9
|
msgid ""
|
|
10
10
|
msgstr ""
|
|
11
|
-
"Project-Id-Version: foreman_google 3.0
|
|
11
|
+
"Project-Id-Version: foreman_google 3.1.0\n"
|
|
12
12
|
"Report-Msgid-Bugs-To: \n"
|
|
13
13
|
"PO-Revision-Date: 2022-08-01 12:51+0000\n"
|
|
14
14
|
"Last-Translator: Temuri Doghonadze <temuri.doghonadze@gmail.com>, 2023\n"
|
|
@@ -96,3 +96,9 @@ msgstr "ზონა, მხოლოდ GCE-სთვის"
|
|
|
96
96
|
|
|
97
97
|
msgid "console is not available at this time because the instance is powered off"
|
|
98
98
|
msgstr "კონსოლი ამჟამად მიუწვდომელია. გაშვებული ასლი გამორთულია"
|
|
99
|
+
|
|
100
|
+
msgid "unable to start machine that is not persisted"
|
|
101
|
+
msgstr ""
|
|
102
|
+
|
|
103
|
+
msgid "unable to stop machine that is not persisted"
|
|
104
|
+
msgstr ""
|
|
Binary file
|
data/locale/ko/foreman_google.po
CHANGED
|
@@ -7,14 +7,14 @@
|
|
|
7
7
|
# Bryan Kearney <bryan.kearney@gmail.com>, 2022
|
|
8
8
|
# 0868a4d1af5275b3f70b0a6dac4c99a4, 2022
|
|
9
9
|
# Ewoud Kohl van Wijngaarden <ewoud+transifex@kohlvanwijngaarden.nl>, 2024
|
|
10
|
+
# Ondřej Gajdušek, 2026
|
|
10
11
|
#
|
|
11
12
|
msgid ""
|
|
12
13
|
msgstr ""
|
|
13
|
-
"Project-Id-Version: foreman_google 3.0
|
|
14
|
+
"Project-Id-Version: foreman_google 3.1.0\n"
|
|
14
15
|
"Report-Msgid-Bugs-To: \n"
|
|
15
16
|
"PO-Revision-Date: 2022-08-01 12:51+0000\n"
|
|
16
|
-
"Last-Translator:
|
|
17
|
-
"n.nl>, 2024\n"
|
|
17
|
+
"Last-Translator: Ondřej Gajdušek, 2026\n"
|
|
18
18
|
"Language-Team: Korean (https://app.transifex.com/foreman/teams/114/ko/)\n"
|
|
19
19
|
"MIME-Version: 1.0\n"
|
|
20
20
|
"Content-Type: text/plain; charset=UTF-8\n"
|
|
@@ -99,3 +99,9 @@ msgstr "Zone, GCE 전용"
|
|
|
99
99
|
|
|
100
100
|
msgid "console is not available at this time because the instance is powered off"
|
|
101
101
|
msgstr "인스턴스 전원이 꺼져 있으므로 현재 콘솔을 사용할 수 없습니다."
|
|
102
|
+
|
|
103
|
+
msgid "unable to start machine that is not persisted"
|
|
104
|
+
msgstr "영구 저장되지 않은 머신은 시작할 수 없습니다."
|
|
105
|
+
|
|
106
|
+
msgid "unable to stop machine that is not persisted"
|
|
107
|
+
msgstr "영구 저장되지 않은 머신은 중지할 수 없습니다."
|
|
Binary file
|
data/locale/pl/foreman_google.po
CHANGED
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
#
|
|
10
10
|
msgid ""
|
|
11
11
|
msgstr ""
|
|
12
|
-
"Project-Id-Version: foreman_google 3.0
|
|
12
|
+
"Project-Id-Version: foreman_google 3.1.0\n"
|
|
13
13
|
"Report-Msgid-Bugs-To: \n"
|
|
14
14
|
"PO-Revision-Date: 2022-08-01 12:51+0000\n"
|
|
15
15
|
"Last-Translator: Michał Foryt <michal.foryt@gmail.com>, 2022\n"
|
|
@@ -99,3 +99,9 @@ msgstr ""
|
|
|
99
99
|
|
|
100
100
|
msgid "console is not available at this time because the instance is powered off"
|
|
101
101
|
msgstr ""
|
|
102
|
+
|
|
103
|
+
msgid "unable to start machine that is not persisted"
|
|
104
|
+
msgstr ""
|
|
105
|
+
|
|
106
|
+
msgid "unable to stop machine that is not persisted"
|
|
107
|
+
msgstr ""
|
|
Binary file
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
#
|
|
13
13
|
msgid ""
|
|
14
14
|
msgstr ""
|
|
15
|
-
"Project-Id-Version: foreman_google 3.0
|
|
15
|
+
"Project-Id-Version: foreman_google 3.1.0\n"
|
|
16
16
|
"Report-Msgid-Bugs-To: \n"
|
|
17
17
|
"PO-Revision-Date: 2022-08-01 12:51+0000\n"
|
|
18
18
|
"Last-Translator: Luiz Henrique Vasconcelos <luizvasconceloss@yahoo.com.br>, 20"
|
|
@@ -103,3 +103,9 @@ msgstr ""
|
|
|
103
103
|
|
|
104
104
|
msgid "console is not available at this time because the instance is powered off"
|
|
105
105
|
msgstr "console não está disponível neste momento porque a instância está desligada"
|
|
106
|
+
|
|
107
|
+
msgid "unable to start machine that is not persisted"
|
|
108
|
+
msgstr ""
|
|
109
|
+
|
|
110
|
+
msgid "unable to stop machine that is not persisted"
|
|
111
|
+
msgstr ""
|
|
Binary file
|
data/locale/ru/foreman_google.po
CHANGED
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
#
|
|
13
13
|
msgid ""
|
|
14
14
|
msgstr ""
|
|
15
|
-
"Project-Id-Version: foreman_google 3.0
|
|
15
|
+
"Project-Id-Version: foreman_google 3.1.0\n"
|
|
16
16
|
"Report-Msgid-Bugs-To: \n"
|
|
17
17
|
"PO-Revision-Date: 2022-08-01 12:51+0000\n"
|
|
18
18
|
"Last-Translator: 0868a4d1af5275b3f70b0a6dac4c99a4, 2022\n"
|
|
@@ -102,3 +102,9 @@ msgstr ""
|
|
|
102
102
|
|
|
103
103
|
msgid "console is not available at this time because the instance is powered off"
|
|
104
104
|
msgstr ""
|
|
105
|
+
|
|
106
|
+
msgid "unable to start machine that is not persisted"
|
|
107
|
+
msgstr ""
|
|
108
|
+
|
|
109
|
+
msgid "unable to stop machine that is not persisted"
|
|
110
|
+
msgstr ""
|
|
Binary file
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
#
|
|
11
11
|
msgid ""
|
|
12
12
|
msgstr ""
|
|
13
|
-
"Project-Id-Version: foreman_google 3.0
|
|
13
|
+
"Project-Id-Version: foreman_google 3.1.0\n"
|
|
14
14
|
"Report-Msgid-Bugs-To: \n"
|
|
15
15
|
"PO-Revision-Date: 2022-08-01 12:51+0000\n"
|
|
16
16
|
"Last-Translator: johnny.westerlund <johnny.westerlund@gmail.com>, 2022\n"
|
|
@@ -99,3 +99,9 @@ msgstr ""
|
|
|
99
99
|
|
|
100
100
|
msgid "console is not available at this time because the instance is powered off"
|
|
101
101
|
msgstr ""
|
|
102
|
+
|
|
103
|
+
msgid "unable to start machine that is not persisted"
|
|
104
|
+
msgstr ""
|
|
105
|
+
|
|
106
|
+
msgid "unable to stop machine that is not persisted"
|
|
107
|
+
msgstr ""
|
|
Binary file
|
|
@@ -9,14 +9,14 @@
|
|
|
9
9
|
# tim123, 2022
|
|
10
10
|
# Amit Upadhye <aupadhye@redhat.com>, 2022
|
|
11
11
|
# Ewoud Kohl van Wijngaarden <ewoud+transifex@kohlvanwijngaarden.nl>, 2024
|
|
12
|
+
# Ondřej Gajdušek, 2026
|
|
12
13
|
#
|
|
13
14
|
msgid ""
|
|
14
15
|
msgstr ""
|
|
15
|
-
"Project-Id-Version: foreman_google 3.0
|
|
16
|
+
"Project-Id-Version: foreman_google 3.1.0\n"
|
|
16
17
|
"Report-Msgid-Bugs-To: \n"
|
|
17
18
|
"PO-Revision-Date: 2022-08-01 12:51+0000\n"
|
|
18
|
-
"Last-Translator:
|
|
19
|
-
"n.nl>, 2024\n"
|
|
19
|
+
"Last-Translator: Ondřej Gajdušek, 2026\n"
|
|
20
20
|
"Language-Team: Chinese (China) (https://app.transifex.com/foreman/teams/114/zh"
|
|
21
21
|
"_CN/)\n"
|
|
22
22
|
"MIME-Version: 1.0\n"
|
|
@@ -102,3 +102,9 @@ msgstr "Zone,仅限 GCE"
|
|
|
102
102
|
|
|
103
103
|
msgid "console is not available at this time because the instance is powered off"
|
|
104
104
|
msgstr "控制台目前不可用,因为实例已关闭"
|
|
105
|
+
|
|
106
|
+
msgid "unable to start machine that is not persisted"
|
|
107
|
+
msgstr "无法启动没有持久化的机器"
|
|
108
|
+
|
|
109
|
+
msgid "unable to stop machine that is not persisted"
|
|
110
|
+
msgstr "无法停止没有持久化的机器"
|
|
Binary file
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
#
|
|
11
11
|
msgid ""
|
|
12
12
|
msgstr ""
|
|
13
|
-
"Project-Id-Version: foreman_google 3.0
|
|
13
|
+
"Project-Id-Version: foreman_google 3.1.0\n"
|
|
14
14
|
"Report-Msgid-Bugs-To: \n"
|
|
15
15
|
"PO-Revision-Date: 2022-08-01 12:51+0000\n"
|
|
16
16
|
"Last-Translator: 0868a4d1af5275b3f70b0a6dac4c99a4, 2022\n"
|
|
@@ -99,3 +99,9 @@ msgstr ""
|
|
|
99
99
|
|
|
100
100
|
msgid "console is not available at this time because the instance is powered off"
|
|
101
101
|
msgstr ""
|
|
102
|
+
|
|
103
|
+
msgid "unable to start machine that is not persisted"
|
|
104
|
+
msgstr ""
|
|
105
|
+
|
|
106
|
+
msgid "unable to stop machine that is not persisted"
|
|
107
|
+
msgstr ""
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
require 'test_google_helper'
|
|
2
|
+
|
|
3
|
+
module ForemanGoogle
|
|
4
|
+
module Api
|
|
5
|
+
module V2
|
|
6
|
+
class ComputeResourcesExtensionsTest < GoogleTestCase
|
|
7
|
+
describe 'the real API controller integration' do
|
|
8
|
+
it 'loads the Google parameter extension into the compute resource controller' do
|
|
9
|
+
assert_includes ::Api::V2::ComputeResourcesController.ancestors,
|
|
10
|
+
::Foreman::Controller::Parameters::ComputeResourceExtension
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
it 'permits Google compute resource parameters' do
|
|
14
|
+
context = ::Api::V2::ComputeResourcesController.parameter_filter_context
|
|
15
|
+
params = ActionController::Parameters.new(
|
|
16
|
+
compute_resource: { key_path: '/tmp/key.json', zone: 'us-east1-b' }
|
|
17
|
+
)
|
|
18
|
+
|
|
19
|
+
filtered = ::Api::V2::ComputeResourcesController
|
|
20
|
+
.compute_resource_params_filter
|
|
21
|
+
.filter_params(params, context)
|
|
22
|
+
|
|
23
|
+
assert_equal({ 'key_path' => '/tmp/key.json', 'zone' => 'us-east1-b' }, filtered.to_h)
|
|
24
|
+
end
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
let(:controller_class) do
|
|
28
|
+
Class.new do
|
|
29
|
+
def self.before_action(*)
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
include ForemanGoogle::Api::V2::ComputeResourcesExtensions
|
|
33
|
+
|
|
34
|
+
attr_accessor :params
|
|
35
|
+
|
|
36
|
+
def compute_resource_params
|
|
37
|
+
params[:compute_resource]
|
|
38
|
+
end
|
|
39
|
+
end
|
|
40
|
+
end
|
|
41
|
+
|
|
42
|
+
describe '#read_key' do
|
|
43
|
+
it 'reads key file content into password for GCE provider' do
|
|
44
|
+
key_content = '{"type": "service_account", "project_id": "test"}'
|
|
45
|
+
|
|
46
|
+
Tempfile.open('gce_key') do |f|
|
|
47
|
+
f.write(key_content)
|
|
48
|
+
f.flush
|
|
49
|
+
|
|
50
|
+
ctrl = controller_class.new
|
|
51
|
+
ctrl.params = { 'compute_resource' => { 'provider' => 'GCE', 'key_path' => f.path } }.with_indifferent_access
|
|
52
|
+
ctrl.send(:read_key)
|
|
53
|
+
|
|
54
|
+
assert_equal key_content, ctrl.params[:compute_resource][:password]
|
|
55
|
+
assert_not ctrl.params[:compute_resource].key?('key_path')
|
|
56
|
+
end
|
|
57
|
+
end
|
|
58
|
+
|
|
59
|
+
it 'skips when provider is not GCE' do
|
|
60
|
+
ctrl = controller_class.new
|
|
61
|
+
ctrl.params = { 'compute_resource' => { 'provider' => 'EC2', 'key_path' => '/nonexistent' } }.with_indifferent_access
|
|
62
|
+
ctrl.send(:read_key)
|
|
63
|
+
|
|
64
|
+
assert_nil ctrl.params[:compute_resource][:password]
|
|
65
|
+
assert_equal '/nonexistent', ctrl.params[:compute_resource]['key_path']
|
|
66
|
+
end
|
|
67
|
+
end
|
|
68
|
+
end
|
|
69
|
+
end
|
|
70
|
+
end
|
|
71
|
+
end
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
require 'test_google_helper'
|
|
2
|
+
|
|
3
|
+
module ForemanGoogle
|
|
4
|
+
class HostManagedExtensionsTest < GoogleTestCase
|
|
5
|
+
let(:host_class) do
|
|
6
|
+
Class.new do
|
|
7
|
+
include ForemanGoogle::HostManagedExtensions
|
|
8
|
+
attr_accessor :vm
|
|
9
|
+
end
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
describe '#ip_addresses' do
|
|
13
|
+
it 'returns vm ip_addresses when vm exists' do
|
|
14
|
+
vm = mock('GoogleCompute')
|
|
15
|
+
vm.expects(:ip_addresses).returns(['1.2.3.4', '10.0.0.1'])
|
|
16
|
+
|
|
17
|
+
host = host_class.new
|
|
18
|
+
host.vm = vm
|
|
19
|
+
assert_equal ['1.2.3.4', '10.0.0.1'], host.ip_addresses
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
it 'returns empty array when vm is nil' do
|
|
23
|
+
host = host_class.new
|
|
24
|
+
host.vm = nil
|
|
25
|
+
assert_empty host.ip_addresses
|
|
26
|
+
end
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
describe '#vm_ip_address' do
|
|
30
|
+
it 'returns vm public IP when vm exists' do
|
|
31
|
+
vm = mock('GoogleCompute')
|
|
32
|
+
vm.expects(:vm_ip_address).returns('1.2.3.4')
|
|
33
|
+
|
|
34
|
+
host = host_class.new
|
|
35
|
+
host.vm = vm
|
|
36
|
+
assert_equal '1.2.3.4', host.vm_ip_address
|
|
37
|
+
end
|
|
38
|
+
|
|
39
|
+
it 'returns nil when vm is nil' do
|
|
40
|
+
host = host_class.new
|
|
41
|
+
host.vm = nil
|
|
42
|
+
assert_nil host.vm_ip_address
|
|
43
|
+
end
|
|
44
|
+
end
|
|
45
|
+
end
|
|
46
|
+
end
|