foreman_acd 0.4.0 → 0.9.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +84 -84
- data/app/controllers/foreman_acd/ansible_playbooks_controller.rb +103 -11
- data/app/controllers/foreman_acd/api/v2/ansible_playbooks_controller.rb +21 -3
- data/app/controllers/foreman_acd/api/v2/app_definitions_controller.rb +1 -0
- data/app/controllers/foreman_acd/api/v2/app_instances_controller.rb +9 -1
- data/app/controllers/foreman_acd/app_definitions_controller.rb +117 -15
- data/app/controllers/foreman_acd/app_instances_controller.rb +104 -30
- data/app/controllers/foreman_acd/concerns/ansible_playbook_parameters.rb +1 -1
- data/app/controllers/foreman_acd/concerns/app_definition_parameters.rb +1 -1
- data/app/controllers/foreman_acd/concerns/app_instance_mixins.rb +36 -0
- data/app/controllers/foreman_acd/concerns/app_instance_parameters.rb +1 -1
- data/app/controllers/foreman_acd/remote_execution_controller.rb +36 -23
- data/app/controllers/ui_acd_controller.rb +46 -0
- data/app/lib/actions/foreman_acd/deploy_all_hosts.rb +47 -0
- data/app/lib/actions/foreman_acd/run_configurator.rb +45 -0
- data/app/models/concerns/foreman_acd/host_managed_extensions.rb +39 -0
- data/app/models/foreman_acd/acd_provider.rb +36 -0
- data/app/models/foreman_acd/ansible_playbook.rb +32 -14
- data/app/models/foreman_acd/app_definition.rb +24 -1
- data/app/models/foreman_acd/app_instance.rb +85 -5
- data/app/models/foreman_acd/foreman_host.rb +31 -0
- data/app/models/foreman_acd/taxonomy_extensions.rb +17 -0
- data/app/services/foreman_acd/acd_proxy_proxy_selector.rb +17 -0
- data/app/services/foreman_acd/app_configurator.rb +64 -36
- data/app/services/foreman_acd/app_deployer.rb +83 -48
- data/app/services/foreman_acd/inventory_creator.rb +36 -25
- data/app/views/foreman_acd/ansible_playbooks/_form.html.erb +50 -7
- data/app/views/foreman_acd/ansible_playbooks/edit.html.erb +9 -1
- data/app/views/foreman_acd/ansible_playbooks/index.html.erb +3 -3
- data/app/views/foreman_acd/api/v2/ansible_playbooks/base.json.rabl +2 -0
- data/app/views/foreman_acd/api/v2/ansible_playbooks/index.json.rabl +2 -0
- data/app/views/foreman_acd/api/v2/ansible_playbooks/show.json.rabl +6 -0
- data/app/views/foreman_acd/api/v2/app_definitions/base.json.rabl +2 -0
- data/app/views/foreman_acd/api/v2/app_definitions/index.json.rabl +2 -0
- data/app/views/foreman_acd/api/v2/app_definitions/show.json.rabl +6 -0
- data/app/views/foreman_acd/api/v2/app_instances/base.json.rabl +3 -1
- data/app/views/foreman_acd/api/v2/app_instances/index.json.rabl +2 -0
- data/app/views/foreman_acd/api/v2/app_instances/show.json.rabl +2 -0
- data/app/views/foreman_acd/app_definitions/_form.html.erb +9 -1
- data/app/views/foreman_acd/app_definitions/edit.html.erb +10 -5
- data/app/views/foreman_acd/app_definitions/import.html.erb +20 -1
- data/app/views/foreman_acd/app_definitions/index.html.erb +5 -8
- data/app/views/foreman_acd/app_instances/_form.html.erb +4 -4
- data/app/views/foreman_acd/app_instances/edit.html.erb +10 -0
- data/app/views/foreman_acd/app_instances/index.html.erb +93 -14
- data/app/views/foreman_acd/app_instances/report.html.erb +12 -4
- data/app/views/templates/job/run_acd_ansible_playbook.erb +28 -15
- data/app/views/ui_acd/app_definition.json.rabl +1 -1
- data/app/views/ui_acd/host_report.json.rabl +4 -0
- data/app/views/ui_acd/report_data.json.rabl +10 -0
- data/app/views/ui_acd/validate_hostname.json.rabl +6 -0
- data/config/routes.rb +12 -3
- data/db/migrate/20200917120220_add_ansible_playbook_id.rb +1 -1
- data/db/migrate/20201016002819_add_ansible_vars_all_to_app_definitions.rb +3 -0
- data/db/migrate/20201016104338_add_ansible_vars_all_to_app_instances.rb +3 -0
- data/db/migrate/20210112111548_add_organization_to_app_instance.rb +22 -0
- data/db/migrate/20210112113853_add_location_to_app_instance.rb +8 -0
- data/db/migrate/20210202141658_create_foreman_hosts.rb +24 -0
- data/db/migrate/20210204111306_remove_hosts_from_app_instances.rb +8 -0
- data/db/migrate/20210209091014_rename_acd_tables.rb +16 -0
- data/db/migrate/20210216083522_add_last_progress_report.rb +8 -0
- data/db/migrate/20210216091529_add_last_deploy_task.rb +8 -0
- data/db/migrate/20210316151145_add_git_commit_to_ansible_playbooks.rb +8 -0
- data/db/migrate/20210503122809_add_git_url_to_ansible_playbooks.rb +8 -0
- data/db/migrate/20210818125913_add_is_existing_host_to_foreman_host.rb +8 -0
- data/db/migrate/20210902110645_add_initial_configure_task.rb +8 -0
- data/db/seeds.d/62_acd_proxy_feature.rb +4 -0
- data/db/seeds.d/75-job_templates.rb +6 -1
- data/lib/foreman_acd/engine.rb +40 -3
- data/lib/foreman_acd/plugin.rb +60 -45
- data/lib/foreman_acd/version.rb +1 -1
- data/lib/foreman_acd.rb +30 -0
- data/lib/tasks/foreman_acd_tasks.rake +0 -12
- data/locale/en/foreman_acd.edit.po +326 -0
- data/locale/en/foreman_acd.po +232 -2
- data/{app/controllers/foreman_acd/api/v2/app_playbooks_controller.rb → locale/en/foreman_acd.po.time_stamp} +0 -0
- data/locale/foreman_acd.pot +343 -8
- data/package.json +8 -8
- data/test/controllers/ansible_playbooks_controller_test.rb +27 -0
- data/test/controllers/app_instances_controller_test.rb +8 -3
- data/test/controllers/ui_acd_controller_test.rb +22 -6
- data/test/factories/foreman_acd_factories.rb +18 -4
- data/test/models/acd_provider_test.rb +37 -0
- data/test/models/ansible_playbook_test.rb +11 -0
- data/test/models/app_definition_test.rb +1 -1
- data/test/models/app_instance_test.rb +2 -0
- data/test/models/concerns/host_extensions_test.rb +26 -0
- data/test/models/foreman_host_test.rb +12 -0
- data/webpack/__mocks__/foremanReact/API.js +2 -0
- data/webpack/__mocks__/foremanReact/common/I18n.js +3 -0
- data/webpack/__mocks__/foremanReact/common/helpers.js +2 -0
- data/webpack/__mocks__/foremanReact/components/ForemanModal/ForemanModalActions.js +2 -0
- data/webpack/__mocks__/foremanReact/components/ForemanModal.js +7 -0
- data/webpack/__mocks__/foremanReact/components/common/forms/CommonForm.js +2 -0
- data/webpack/__mocks__/foremanReact/components/common/forms/TextInput.js +2 -0
- data/webpack/__mocks__/foremanReact/components/hosts/powerStatus.js +1 -0
- data/webpack/__snapshots__/helper.test.js.snap +14 -0
- data/webpack/components/ApplicationDefinition/ApplicationDefinition.js +55 -21
- data/webpack/components/ApplicationDefinition/ApplicationDefinitionActions.js +14 -0
- data/webpack/components/ApplicationDefinition/ApplicationDefinitionConstants.js +2 -0
- data/webpack/components/ApplicationDefinition/ApplicationDefinitionReducer.js +48 -1
- data/webpack/components/ApplicationDefinition/ApplicationDefinitionSelectors.js +4 -0
- data/webpack/components/ApplicationDefinition/__fixtures__/applicationDefinitionConfData_1.fixtures.js +288 -0
- data/webpack/components/ApplicationDefinition/__fixtures__/applicationDefinitionReducer.fixtures.js +79 -0
- data/webpack/components/ApplicationDefinition/__tests__/ApplicationDefinition.test.js +26 -0
- data/webpack/components/ApplicationDefinition/__tests__/ApplicationDefinitionReducer.test.js +119 -0
- data/webpack/components/ApplicationDefinition/__tests__/ApplicationDefinitionSelectors.test.js +41 -0
- data/webpack/components/ApplicationDefinition/__tests__/__snapshots__/ApplicationDefinition.test.js.snap +225 -0
- data/webpack/components/ApplicationDefinition/__tests__/__snapshots__/ApplicationDefinitionReducer.test.js.snap +3033 -0
- data/webpack/components/ApplicationDefinition/__tests__/__snapshots__/ApplicationDefinitionSelectors.test.js.snap +299 -0
- data/webpack/components/ApplicationDefinition/components/AnsiblePlaybookSelector.js +2 -1
- data/webpack/components/ApplicationDefinition/components/__tests__/AnsiblePlaybookSelector.test.js +41 -0
- data/webpack/components/ApplicationDefinition/components/__tests__/__snapshots__/AnsiblePlaybookSelector.test.js.snap +121 -0
- data/webpack/components/ApplicationDefinition/index.js +8 -0
- data/webpack/components/ApplicationDefinitionImport/ApplicationDefinitionImport.js +214 -0
- data/webpack/components/ApplicationDefinitionImport/ApplicationDefinitionImport.scss +1 -0
- data/webpack/components/ApplicationDefinitionImport/ApplicationDefinitionImportActions.js +161 -0
- data/webpack/components/ApplicationDefinitionImport/ApplicationDefinitionImportConstants.js +6 -0
- data/webpack/components/ApplicationDefinitionImport/ApplicationDefinitionImportReducer.js +79 -0
- data/webpack/components/ApplicationDefinitionImport/ApplicationDefinitionImportSelectors.js +8 -0
- data/webpack/components/ApplicationDefinitionImport/__fixtures__/applicationDefinitionImportConfData_1.fixtures.js +129 -0
- data/webpack/components/ApplicationDefinitionImport/__fixtures__/applicationDefinitionImportReducer.fixtures.js +29 -0
- data/webpack/components/ApplicationDefinitionImport/__tests__/ApplicationDefinitionImport.test.js +20 -0
- data/webpack/components/ApplicationDefinitionImport/__tests__/ApplicationDefinitionImportReducer.test.js +43 -0
- data/webpack/components/ApplicationDefinitionImport/__tests__/ApplicationDefinitionImportSelectors.test.js +29 -0
- data/webpack/components/ApplicationDefinitionImport/__tests__/__snapshots__/ApplicationDefinitionImport.test.js.snap +62 -0
- data/webpack/components/ApplicationDefinitionImport/__tests__/__snapshots__/ApplicationDefinitionImportReducer.test.js.snap +362 -0
- data/webpack/components/ApplicationDefinitionImport/__tests__/__snapshots__/ApplicationDefinitionImportSelectors.test.js.snap +130 -0
- data/webpack/components/ApplicationDefinitionImport/index.js +32 -0
- data/webpack/components/ApplicationInstance/ApplicationInstance.js +153 -45
- data/webpack/components/ApplicationInstance/ApplicationInstanceActions.js +120 -6
- data/webpack/components/ApplicationInstance/ApplicationInstanceConstants.js +5 -0
- data/webpack/components/ApplicationInstance/ApplicationInstanceHelper.js +15 -0
- data/webpack/components/ApplicationInstance/ApplicationInstanceReducer.js +77 -22
- data/webpack/components/ApplicationInstance/ApplicationInstanceSelectors.js +4 -0
- data/webpack/components/ApplicationInstance/__fixtures__/applicationInstanceConfData_1.fixtures.js +263 -0
- data/webpack/components/ApplicationInstance/__fixtures__/applicationInstanceReducer.fixtures.js +80 -0
- data/webpack/components/ApplicationInstance/__tests__/ApplicationInstance.test.js +24 -0
- data/webpack/components/ApplicationInstance/__tests__/ApplicationInstanceReducer.test.js +131 -0
- data/webpack/components/ApplicationInstance/__tests__/ApplicationInstanceSelectors.test.js +44 -0
- data/webpack/components/ApplicationInstance/__tests__/__snapshots__/ApplicationInstance.test.js.snap +299 -0
- data/webpack/components/ApplicationInstance/__tests__/__snapshots__/ApplicationInstanceReducer.test.js.snap +2990 -0
- data/webpack/components/ApplicationInstance/__tests__/__snapshots__/ApplicationInstanceSelectors.test.js.snap +276 -0
- data/webpack/components/ApplicationInstance/components/AppDefinitionSelector.js +1 -0
- data/webpack/components/ApplicationInstance/components/Service.js +1 -1
- data/webpack/components/ApplicationInstance/components/ServiceCounter.js +1 -1
- data/webpack/components/ApplicationInstance/helper.js +0 -0
- data/webpack/components/ApplicationInstance/index.js +8 -0
- data/webpack/components/ApplicationInstanceReport/ApplicationInstanceReport.js +128 -60
- data/webpack/components/ApplicationInstanceReport/ApplicationInstanceReport.scss +17 -0
- data/webpack/components/ApplicationInstanceReport/ApplicationInstanceReportActions.js +40 -50
- data/webpack/components/ApplicationInstanceReport/ApplicationInstanceReportConstants.js +5 -4
- data/webpack/components/ApplicationInstanceReport/ApplicationInstanceReportReducer.js +19 -14
- data/webpack/components/ApplicationInstanceReport/ApplicationInstanceReportSelectors.js +4 -1
- data/webpack/components/ApplicationInstanceReport/__fixtures__/applicationInstanceReportData_1.fixtures.js +349 -0
- data/webpack/components/ApplicationInstanceReport/__fixtures__/applicationInstanceReportReducer.fixtures.js +20 -0
- data/webpack/components/ApplicationInstanceReport/__tests__/ApplicationInstanceReport.test.js +47 -0
- data/webpack/components/ApplicationInstanceReport/__tests__/ApplicationInstanceReportReducer.test.js +41 -0
- data/webpack/components/ApplicationInstanceReport/__tests__/ApplicationInstanceReportSelectors.test.js +26 -0
- data/webpack/components/ApplicationInstanceReport/__tests__/__snapshots__/ApplicationInstanceReport.test.js.snap +7 -0
- data/webpack/components/ApplicationInstanceReport/__tests__/__snapshots__/ApplicationInstanceReportReducer.test.js.snap +718 -0
- data/webpack/components/ApplicationInstanceReport/__tests__/__snapshots__/ApplicationInstanceReportSelectors.test.js.snap +347 -0
- data/webpack/components/ApplicationInstanceReport/components/ReportViewer.js +1 -1
- data/webpack/components/ApplicationInstanceReport/components/__tests__/ReportViewer.test.js +24 -0
- data/webpack/components/ApplicationInstanceReport/components/__tests__/__snapshots__/ReportViewer.test.js.snap +24 -0
- data/webpack/components/ApplicationInstanceReport/index.js +8 -3
- data/webpack/components/ExistingHostSelection/ExistingHostSelection.js +104 -0
- data/webpack/components/ExistingHostSelection/ExistingHostSelection.scss +15 -0
- data/webpack/components/ExistingHostSelection/ExistingHostSelectionActions.js +71 -0
- data/webpack/components/ExistingHostSelection/ExistingHostSelectionConstants.js +4 -0
- data/webpack/components/ExistingHostSelection/ExistingHostSelectionHelper.js +0 -0
- data/webpack/components/ExistingHostSelection/ExistingHostSelectionReducer.js +90 -0
- data/webpack/components/ExistingHostSelection/ExistingHostSelectionSelectors.js +8 -0
- data/webpack/components/ExistingHostSelection/__fixtures__/existingHostSelectionConfData_1.fixtures.js +191 -0
- data/webpack/components/ExistingHostSelection/__fixtures__/existingHostSelectionReducer.fixtures.js +203 -0
- data/webpack/components/ExistingHostSelection/__tests__/ExistingHostSelection.test.js +19 -0
- data/webpack/components/ExistingHostSelection/__tests__/ExistingHostSelectionReducer.test.js +59 -0
- data/webpack/components/ExistingHostSelection/__tests__/ExistingHostSelectionSelectors.test.js +36 -0
- data/webpack/components/ExistingHostSelection/__tests__/__snapshots__/ExistingHostSelection.test.js.snap +35 -0
- data/webpack/components/ExistingHostSelection/__tests__/__snapshots__/ExistingHostSelectionReducer.test.js.snap +614 -0
- data/webpack/components/ExistingHostSelection/__tests__/__snapshots__/ExistingHostSelectionSelectors.test.js.snap +27 -0
- data/webpack/components/ExistingHostSelection/components/ServiceSelector.js +48 -0
- data/webpack/components/ExistingHostSelection/components/__tests__/ServiceSelector.test.js +35 -0
- data/webpack/components/ExistingHostSelection/components/__tests__/__snapshots__/ServiceSelector.test.js.snap +77 -0
- data/webpack/components/ExistingHostSelection/index.js +26 -0
- data/webpack/components/ParameterSelection/ParameterSelection.js +138 -15
- data/webpack/components/ParameterSelection/ParameterSelection.scss +7 -0
- data/webpack/components/ParameterSelection/ParameterSelectionActions.js +52 -9
- data/webpack/components/ParameterSelection/ParameterSelectionConstants.js +3 -0
- data/webpack/components/ParameterSelection/ParameterSelectionReducer.js +62 -25
- data/webpack/components/ParameterSelection/ParameterSelectionSelectors.js +1 -0
- data/webpack/components/ParameterSelection/__fixtures__/parameterSelectionData_1.fixtures.js +116 -84
- data/webpack/components/ParameterSelection/__fixtures__/parameterSelectionReducer.fixtures.js +10 -4
- data/webpack/components/ParameterSelection/__tests__/ParameterSelection.test.js +36 -46
- data/webpack/components/ParameterSelection/__tests__/ParameterSelectionReducer.test.js +33 -25
- data/webpack/components/ParameterSelection/__tests__/ParameterSelectionSelectors.test.js +6 -6
- data/webpack/components/ParameterSelection/__tests__/__snapshots__/ParameterSelection.test.js.snap +84 -112
- data/webpack/components/ParameterSelection/__tests__/__snapshots__/ParameterSelectionReducer.test.js.snap +1488 -872
- data/webpack/components/ParameterSelection/__tests__/__snapshots__/ParameterSelectionSelectors.test.js.snap +117 -79
- data/webpack/components/ParameterSelection/index.js +2 -1
- data/webpack/components/SyncGitRepo/SyncGitRepo.js +202 -0
- data/webpack/components/SyncGitRepo/SyncGitRepo.scss +1 -0
- data/webpack/components/SyncGitRepo/SyncGitRepoActions.js +123 -0
- data/webpack/components/SyncGitRepo/SyncGitRepoConstants.js +8 -0
- data/webpack/components/SyncGitRepo/SyncGitRepoReducer.js +80 -0
- data/webpack/components/SyncGitRepo/SyncGitRepoSelectors.js +6 -0
- data/webpack/components/SyncGitRepo/__fixtures__/syncGitRepoConfData_1.fixtures.js +7 -0
- data/webpack/components/SyncGitRepo/__fixtures__/syncGitRepoReducer.fixtures.js +44 -0
- data/webpack/components/SyncGitRepo/__tests__/SyncGitRepo.test.js +27 -0
- data/webpack/components/SyncGitRepo/__tests__/SyncGitRepoReducer.test.js +95 -0
- data/webpack/components/SyncGitRepo/__tests__/SyncGitRepoSelectors.test.js +32 -0
- data/webpack/components/SyncGitRepo/__tests__/__snapshots__/SyncGitRepo.test.js.snap +31 -0
- data/webpack/components/SyncGitRepo/__tests__/__snapshots__/SyncGitRepoReducer.test.js.snap +137 -0
- data/webpack/components/SyncGitRepo/__tests__/__snapshots__/SyncGitRepoSelectors.test.js.snap +13 -0
- data/webpack/components/SyncGitRepo/components/FormTextInput.js +42 -0
- data/webpack/components/SyncGitRepo/components/ScmTypeSelector.js +47 -0
- data/webpack/components/SyncGitRepo/index.js +28 -0
- data/webpack/components/common/DeleteTableEntry.js +18 -4
- data/webpack/components/common/EditTableEntry.js +50 -0
- data/webpack/components/common/ExtTextInput.js +43 -0
- data/webpack/components/common/LockTableEntry.js +60 -0
- data/webpack/components/common/__tests__/EditTableEntry.test.js +53 -0
- data/webpack/components/common/__tests__/LockTableEntry.test.js +35 -0
- data/webpack/components/common/__tests__/__snapshots__/DeleteTableEntry.test.js.snap +40 -2
- data/webpack/components/common/__tests__/__snapshots__/EditTableEntry.test.js.snap +81 -0
- data/webpack/components/common/__tests__/__snapshots__/LockTableEntry.test.js.snap +60 -0
- data/webpack/helper.js +20 -1
- data/webpack/helper.test.js +37 -0
- data/webpack/index.js +7 -0
- data/webpack/js-yaml.js +3874 -0
- data/webpack/reducer.js +16 -1
- metadata +182 -11
- data/app/views/foreman_acd/app_instances/deploy.html.erb +0 -19
- data/webpack/components/common/EasyHeaderFormatter.js +0 -18
- data/webpack/components/common/__tests__/__snapshots__/AddParameter.test.js.snap +0 -35
- data/webpack/components/common/__tests__/__snapshots__/DeleteParameter.test.js.snap +0 -41
data/locale/foreman_acd.pot
CHANGED
@@ -1,19 +1,354 @@
|
|
1
|
-
#
|
2
|
-
#
|
3
|
-
# This file is distributed under the same license as foreman_acd.
|
1
|
+
# SOME DESCRIPTIVE TITLE.
|
2
|
+
# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
|
3
|
+
# This file is distributed under the same license as the foreman_acd package.
|
4
|
+
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
|
4
5
|
#
|
5
6
|
#, fuzzy
|
6
7
|
msgid ""
|
7
8
|
msgstr ""
|
8
|
-
"Project-Id-Version:
|
9
|
+
"Project-Id-Version: foreman_acd 1.0.0\n"
|
9
10
|
"Report-Msgid-Bugs-To: \n"
|
10
|
-
"POT-Creation-Date:
|
11
|
-
"PO-Revision-Date:
|
12
|
-
"Last-Translator:
|
13
|
-
"Language-Team:
|
11
|
+
"POT-Creation-Date: 2021-02-05 21:21+0000\n"
|
12
|
+
"PO-Revision-Date: 2021-02-05 21:21+0000\n"
|
13
|
+
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
14
|
+
"Language-Team: LANGUAGE <LL@li.org>\n"
|
14
15
|
"Language: \n"
|
15
16
|
"MIME-Version: 1.0\n"
|
16
17
|
"Content-Type: text/plain; charset=UTF-8\n"
|
17
18
|
"Content-Transfer-Encoding: 8bit\n"
|
18
19
|
"Plural-Forms: nplurals=INTEGER; plural=EXPRESSION;\n"
|
19
20
|
|
21
|
+
#: ../app/controllers/foreman_acd/ansible_playbooks_controller.rb:22
|
22
|
+
msgid ""
|
23
|
+
"Successfully created %s. You need to press the \"Import groups\" button\n"
|
24
|
+
" before this ansible playbook can be"
|
25
|
+
" used in App Definitions!"
|
26
|
+
msgstr ""
|
27
|
+
|
28
|
+
#: ../app/controllers/foreman_acd/ansible_playbooks_controller.rb:116
|
29
|
+
msgid "Successfully loaded ansible group variables from %s"
|
30
|
+
msgstr ""
|
31
|
+
|
32
|
+
#: ../app/controllers/foreman_acd/api/v2/ansible_playbooks_controller.rb:15
|
33
|
+
msgid "Show ansible playbook"
|
34
|
+
msgstr ""
|
35
|
+
|
36
|
+
#: ../app/controllers/foreman_acd/api/v2/ansible_playbooks_controller.rb:19
|
37
|
+
msgid "List ansible playbooks"
|
38
|
+
msgstr ""
|
39
|
+
|
40
|
+
#: ../app/controllers/foreman_acd/api/v2/ansible_playbooks_controller.rb:35
|
41
|
+
msgid "Create a ansible playbook"
|
42
|
+
msgstr ""
|
43
|
+
|
44
|
+
#: ../app/controllers/foreman_acd/api/v2/ansible_playbooks_controller.rb:42
|
45
|
+
msgid "Deletes ansible playbook"
|
46
|
+
msgstr ""
|
47
|
+
|
48
|
+
#: ../app/controllers/foreman_acd/api/v2/ansible_playbooks_controller.rb:48
|
49
|
+
msgid "Grab ansible playbook"
|
50
|
+
msgstr ""
|
51
|
+
|
52
|
+
#: ../app/controllers/foreman_acd/api/v2/app_definitions_controller.rb:12
|
53
|
+
msgid "Show application definition"
|
54
|
+
msgstr ""
|
55
|
+
|
56
|
+
#: ../app/controllers/foreman_acd/api/v2/app_definitions_controller.rb:16
|
57
|
+
msgid "List application definitions"
|
58
|
+
msgstr ""
|
59
|
+
|
60
|
+
#: ../app/controllers/foreman_acd/api/v2/app_definitions_controller.rb:32
|
61
|
+
msgid "Create a application definition"
|
62
|
+
msgstr ""
|
63
|
+
|
64
|
+
#: ../app/controllers/foreman_acd/api/v2/app_definitions_controller.rb:39
|
65
|
+
msgid "Deletes application definition"
|
66
|
+
msgstr ""
|
67
|
+
|
68
|
+
#: ../app/controllers/foreman_acd/api/v2/app_instances_controller.rb:12
|
69
|
+
msgid "Show application instance"
|
70
|
+
msgstr ""
|
71
|
+
|
72
|
+
#: ../app/controllers/foreman_acd/api/v2/app_instances_controller.rb:18
|
73
|
+
msgid "List application instances"
|
74
|
+
msgstr ""
|
75
|
+
|
76
|
+
#: ../app/controllers/foreman_acd/api/v2/app_instances_controller.rb:39
|
77
|
+
msgid "Create a application instance"
|
78
|
+
msgstr ""
|
79
|
+
|
80
|
+
#: ../app/controllers/foreman_acd/api/v2/app_instances_controller.rb:46
|
81
|
+
msgid "Deletes application instance"
|
82
|
+
msgstr ""
|
83
|
+
|
84
|
+
#: ../app/models/foreman_acd/ansible_playbook.rb:37
|
85
|
+
msgid "Ansible playbook"
|
86
|
+
msgstr ""
|
87
|
+
|
88
|
+
#: ../app/models/foreman_acd/app_definition.rb:37
|
89
|
+
msgid "App Definition"
|
90
|
+
msgstr ""
|
91
|
+
|
92
|
+
#: ../app/models/foreman_acd/app_instance.rb:19
|
93
|
+
msgid "App Instance"
|
94
|
+
msgstr ""
|
95
|
+
|
96
|
+
#: ../app/views/foreman_acd/ansible_playbooks/_form.html.erb:5
|
97
|
+
msgid "Ansible playbooks"
|
98
|
+
msgstr ""
|
99
|
+
|
100
|
+
#: ../app/views/foreman_acd/ansible_playbooks/_form.html.erb:7
|
101
|
+
#: ../app/views/foreman_acd/app_definitions/_form.html.erb:34
|
102
|
+
msgid "Locations"
|
103
|
+
msgstr ""
|
104
|
+
|
105
|
+
#: ../app/views/foreman_acd/ansible_playbooks/_form.html.erb:10
|
106
|
+
#: ../app/views/foreman_acd/app_definitions/_form.html.erb:37
|
107
|
+
msgid "Organizations"
|
108
|
+
msgstr ""
|
109
|
+
|
110
|
+
#: ../app/views/foreman_acd/ansible_playbooks/edit.html.erb:4
|
111
|
+
#: ../app/views/foreman_acd/ansible_playbooks/index.html.erb:1
|
112
|
+
msgid "Ansible Playbooks"
|
113
|
+
msgstr ""
|
114
|
+
|
115
|
+
#: ../app/views/foreman_acd/ansible_playbooks/edit.html.erb:10
|
116
|
+
msgid "Edit Ansible Playbook %s"
|
117
|
+
msgstr ""
|
118
|
+
|
119
|
+
#: ../app/views/foreman_acd/ansible_playbooks/index.html.erb:4
|
120
|
+
#: ../app/views/foreman_acd/ansible_playbooks/new.html.erb:1
|
121
|
+
msgid "New Ansible Playbook"
|
122
|
+
msgstr ""
|
123
|
+
|
124
|
+
#: ../app/views/foreman_acd/ansible_playbooks/index.html.erb:9
|
125
|
+
msgid "AnsiblePlaybook|Name"
|
126
|
+
msgstr ""
|
127
|
+
|
128
|
+
#: ../app/views/foreman_acd/ansible_playbooks/index.html.erb:10
|
129
|
+
#: ../app/views/foreman_acd/app_definitions/index.html.erb:11
|
130
|
+
#: ../app/views/foreman_acd/app_instances/index.html.erb:9
|
131
|
+
#: ../webpack/components/ParameterSelection/ParameterSelectionActions.js:97
|
132
|
+
msgid "Description"
|
133
|
+
msgstr ""
|
134
|
+
|
135
|
+
#: ../app/views/foreman_acd/ansible_playbooks/index.html.erb:19
|
136
|
+
msgid "Import groups"
|
137
|
+
msgstr ""
|
138
|
+
|
139
|
+
#: ../app/views/foreman_acd/ansible_playbooks/index.html.erb:21
|
140
|
+
#: ../app/views/foreman_acd/app_definitions/index.html.erb:21
|
141
|
+
#: ../app/views/foreman_acd/app_instances/index.html.erb:27
|
142
|
+
msgid "Delete %s?"
|
143
|
+
msgstr ""
|
144
|
+
|
145
|
+
#: ../app/views/foreman_acd/app_definitions/_form.html.erb:32
|
146
|
+
#: ../app/views/foreman_acd/app_definitions/import.html.erb:6
|
147
|
+
#: ../app/views/foreman_acd/app_definitions/index.html.erb:1
|
148
|
+
msgid "Application Definitions"
|
149
|
+
msgstr ""
|
150
|
+
|
151
|
+
#: ../app/views/foreman_acd/app_definitions/edit.html.erb:4
|
152
|
+
msgid "App Definitions"
|
153
|
+
msgstr ""
|
154
|
+
|
155
|
+
#: ../app/views/foreman_acd/app_definitions/edit.html.erb:11
|
156
|
+
msgid "Edit Application Definition %s"
|
157
|
+
msgstr ""
|
158
|
+
|
159
|
+
#: ../app/views/foreman_acd/app_definitions/import.html.erb:1
|
160
|
+
msgid "Import Application Definition"
|
161
|
+
msgstr ""
|
162
|
+
|
163
|
+
#: ../app/views/foreman_acd/app_definitions/import.html.erb:13
|
164
|
+
msgid "Application Definition file"
|
165
|
+
msgstr ""
|
166
|
+
|
167
|
+
#: ../app/views/foreman_acd/app_definitions/index.html.erb:4
|
168
|
+
#: ../app/views/foreman_acd/app_definitions/new.html.erb:1
|
169
|
+
msgid "New Application Definition"
|
170
|
+
msgstr ""
|
171
|
+
|
172
|
+
#: ../app/views/foreman_acd/app_definitions/index.html.erb:5
|
173
|
+
msgid "Import"
|
174
|
+
msgstr ""
|
175
|
+
|
176
|
+
#: ../app/views/foreman_acd/app_definitions/index.html.erb:10
|
177
|
+
msgid "AppDefinition|Name"
|
178
|
+
msgstr ""
|
179
|
+
|
180
|
+
#: ../app/views/foreman_acd/app_definitions/index.html.erb:22
|
181
|
+
msgid "Export"
|
182
|
+
msgstr ""
|
183
|
+
|
184
|
+
#: ../app/views/foreman_acd/app_instances/_form.html.erb:32
|
185
|
+
#: ../app/views/foreman_acd/app_instances/index.html.erb:1
|
186
|
+
msgid "Application Instances"
|
187
|
+
msgstr ""
|
188
|
+
|
189
|
+
#: ../app/views/foreman_acd/app_instances/edit.html.erb:4
|
190
|
+
msgid "App Instances"
|
191
|
+
msgstr ""
|
192
|
+
|
193
|
+
#: ../app/views/foreman_acd/app_instances/edit.html.erb:11
|
194
|
+
msgid "Edit Application Instance %s"
|
195
|
+
msgstr ""
|
196
|
+
|
197
|
+
#: ../app/views/foreman_acd/app_instances/index.html.erb:3
|
198
|
+
#: ../app/views/foreman_acd/app_instances/new.html.erb:1
|
199
|
+
msgid "New Application Instance"
|
200
|
+
msgstr ""
|
201
|
+
|
202
|
+
#: ../app/views/foreman_acd/app_instances/index.html.erb:7
|
203
|
+
msgid "AppInstance|Name"
|
204
|
+
msgstr ""
|
205
|
+
|
206
|
+
#: ../app/views/foreman_acd/app_instances/index.html.erb:8
|
207
|
+
msgid "Application"
|
208
|
+
msgstr ""
|
209
|
+
|
210
|
+
#: ../app/views/foreman_acd/app_instances/index.html.erb:18
|
211
|
+
msgid "Deploy"
|
212
|
+
msgstr ""
|
213
|
+
|
214
|
+
#: ../app/views/foreman_acd/app_instances/index.html.erb:20
|
215
|
+
msgid "Run Playbook"
|
216
|
+
msgstr ""
|
217
|
+
|
218
|
+
#: ../app/views/foreman_acd/app_instances/index.html.erb:22
|
219
|
+
msgid "Run Playbook - customize first"
|
220
|
+
msgstr ""
|
221
|
+
|
222
|
+
#: ../app/views/foreman_acd/app_instances/index.html.erb:24
|
223
|
+
msgid "Report"
|
224
|
+
msgstr ""
|
225
|
+
|
226
|
+
#: ../lib/foreman_acd/plugin.rb:9
|
227
|
+
msgid "Applications"
|
228
|
+
msgstr ""
|
229
|
+
|
230
|
+
#: ../lib/foreman_acd/plugin.rb:145
|
231
|
+
msgid "Run playbook for ACD"
|
232
|
+
msgstr ""
|
233
|
+
|
234
|
+
#: ../lib/foreman_acd/plugin.rb:147
|
235
|
+
msgid "Run an Ansible playbook to configure ACD application"
|
236
|
+
msgstr ""
|
237
|
+
|
238
|
+
#: ../webpack/components/ApplicationDefinition/ApplicationDefinition.js:74
|
239
|
+
#: ../webpack/components/ApplicationInstance/ApplicationInstance.js:114
|
240
|
+
msgid "edit entry"
|
241
|
+
msgstr ""
|
242
|
+
|
243
|
+
#: ../webpack/components/ApplicationDefinition/ApplicationDefinition.js:81
|
244
|
+
#: ../webpack/components/ApplicationInstance/ApplicationInstance.js:121
|
245
|
+
msgid "change parameters"
|
246
|
+
msgstr ""
|
247
|
+
|
248
|
+
#: ../webpack/components/ApplicationDefinition/ApplicationDefinition.js:88
|
249
|
+
#: ../webpack/components/ApplicationInstance/ApplicationInstance.js:128
|
250
|
+
msgid "change ansible variables"
|
251
|
+
msgstr ""
|
252
|
+
|
253
|
+
#: ../webpack/components/ApplicationDefinition/ApplicationDefinition.js:102
|
254
|
+
#: ../webpack/components/ApplicationInstance/ApplicationInstance.js:142
|
255
|
+
msgid "edit"
|
256
|
+
msgstr ""
|
257
|
+
|
258
|
+
#: ../webpack/components/ApplicationDefinition/ApplicationDefinition.js:106
|
259
|
+
#: ../webpack/components/ApplicationInstance/ApplicationInstance.js:146
|
260
|
+
msgid "settings"
|
261
|
+
msgstr ""
|
262
|
+
|
263
|
+
#: ../webpack/components/ApplicationDefinition/ApplicationDefinition.js:277
|
264
|
+
#: ../webpack/components/ApplicationInstance/ApplicationInstance.js:324
|
265
|
+
msgid "change ansible variables for 'all'"
|
266
|
+
msgstr ""
|
267
|
+
|
268
|
+
#: ../webpack/components/ApplicationDefinition/ApplicationDefinition.js:285
|
269
|
+
msgid "Foreman Parameter definition for Application Definition"
|
270
|
+
msgstr ""
|
271
|
+
|
272
|
+
#: ../webpack/components/ApplicationDefinition/ApplicationDefinition.js:303
|
273
|
+
#: ../webpack/components/ApplicationDefinition/ApplicationDefinition.js:330
|
274
|
+
#: ../webpack/components/ApplicationInstance/ApplicationInstance.js:350
|
275
|
+
#: ../webpack/components/ApplicationInstance/ApplicationInstance.js:377
|
276
|
+
msgid "Save"
|
277
|
+
msgstr ""
|
278
|
+
|
279
|
+
#: ../webpack/components/ApplicationDefinition/ApplicationDefinition.js:304
|
280
|
+
#: ../webpack/components/ApplicationDefinition/ApplicationDefinition.js:331
|
281
|
+
#: ../webpack/components/ApplicationInstance/ApplicationInstance.js:351
|
282
|
+
#: ../webpack/components/ApplicationInstance/ApplicationInstance.js:378
|
283
|
+
msgid "Cancel"
|
284
|
+
msgstr ""
|
285
|
+
|
286
|
+
#: ../webpack/components/ApplicationDefinition/ApplicationDefinition.js:313
|
287
|
+
msgid "Ansible variables for Application Definition"
|
288
|
+
msgstr ""
|
289
|
+
|
290
|
+
#: ../webpack/components/ApplicationInstance/ApplicationInstance.js:53
|
291
|
+
msgid ""
|
292
|
+
"For some hosts the values for some parameters are missing. Check the values fo"
|
293
|
+
"r these hosts:\\n"
|
294
|
+
msgstr ""
|
295
|
+
|
296
|
+
#: ../webpack/components/ApplicationInstance/ApplicationInstance.js:71
|
297
|
+
msgid "Unachieved service counts:"
|
298
|
+
msgstr ""
|
299
|
+
|
300
|
+
#: ../webpack/components/ApplicationInstance/ApplicationInstance.js:75
|
301
|
+
msgid "- service ${s.name} expects at ${s.minCount} least configured hosts\\n"
|
302
|
+
msgstr ""
|
303
|
+
|
304
|
+
#: ../webpack/components/ApplicationInstance/ApplicationInstance.js:79
|
305
|
+
msgid "- service ${s.name} expects no more than ${s.axCount} configured hosts\\n"
|
306
|
+
msgstr ""
|
307
|
+
|
308
|
+
#: ../webpack/components/ApplicationInstance/ApplicationInstance.js:332
|
309
|
+
msgid "Foreman Parameter specification for Application Instance"
|
310
|
+
msgstr ""
|
311
|
+
|
312
|
+
#: ../webpack/components/ApplicationInstance/ApplicationInstance.js:360
|
313
|
+
msgid "Ansible group variables for Application Instance"
|
314
|
+
msgstr ""
|
315
|
+
|
316
|
+
#: ../webpack/components/ApplicationInstance/components/Service.js:12
|
317
|
+
msgid "Min/Max"
|
318
|
+
msgstr ""
|
319
|
+
|
320
|
+
#: ../webpack/components/ParameterSelection/ParameterSelectionActions.js:63
|
321
|
+
msgid "Value"
|
322
|
+
msgstr ""
|
323
|
+
|
324
|
+
#: ../webpack/components/ParameterSelection/ParameterSelectionActions.js:65
|
325
|
+
msgid "Default value"
|
326
|
+
msgstr ""
|
327
|
+
|
328
|
+
#: ../webpack/components/ParameterSelection/ParameterSelectionActions.js:78
|
329
|
+
msgid "Name"
|
330
|
+
msgstr ""
|
331
|
+
|
332
|
+
#: ../webpack/components/ParameterSelection/ParameterSelectionActions.js:120
|
333
|
+
msgid "Type"
|
334
|
+
msgstr ""
|
335
|
+
|
336
|
+
#: ../webpack/components/ParameterSelection/ParameterSelectionActions.js:161
|
337
|
+
msgid "Actions"
|
338
|
+
msgstr ""
|
339
|
+
|
340
|
+
#: ../webpack/components/ParameterSelection/ParameterSelectionActions.js:188
|
341
|
+
msgid "Failed to fetch data from server."
|
342
|
+
msgstr ""
|
343
|
+
|
344
|
+
#: ../webpack/components/common/DeleteTableEntry.js:24
|
345
|
+
msgid "Are you sure you wish to delete this item?"
|
346
|
+
msgstr ""
|
347
|
+
|
348
|
+
#: ../webpack/components/common/DeleteTableEntry.js:26
|
349
|
+
msgid "Delete entry"
|
350
|
+
msgstr ""
|
351
|
+
|
352
|
+
#: gemspec.rb:2
|
353
|
+
msgid "TODO: Description of ForemanAcd."
|
354
|
+
msgstr ""
|
data/package.json
CHANGED
@@ -14,26 +14,26 @@
|
|
14
14
|
"@theforeman/vendor-dev": "^1.7.0",
|
15
15
|
"babel-eslint": "^8.2.1",
|
16
16
|
"babel-jest": "^23.6.0",
|
17
|
-
"babel-plugin-dynamic-import-node": "^2.
|
17
|
+
"babel-plugin-dynamic-import-node": "^2.3.3",
|
18
|
+
"babel-plugin-syntax-dynamic-import": "^6.18.0",
|
18
19
|
"babel-plugin-transform-class-properties": "^6.24.1",
|
19
20
|
"babel-plugin-transform-object-assign": "^6.22.0",
|
20
21
|
"babel-plugin-transform-object-rest-spread": "^6.26.0",
|
21
|
-
"babel-plugin-syntax-dynamic-import": "^6.18.0",
|
22
22
|
"babel-preset-env": "^1.6.0",
|
23
23
|
"babel-preset-react": "^6.24.1",
|
24
|
-
"enzyme": "^3.
|
25
|
-
"enzyme-adapter-react-16": "^1.
|
26
|
-
"enzyme-to-json": "^3.
|
24
|
+
"enzyme": "^3.11.0",
|
25
|
+
"enzyme-adapter-react-16": "^1.15.6",
|
26
|
+
"enzyme-to-json": "^3.6.1",
|
27
27
|
"eslint": "^4.18.1",
|
28
|
-
"eslint-plugin-import": "^2.
|
28
|
+
"eslint-plugin-import": "^2.22.1",
|
29
29
|
"eslint-plugin-jest": "^21.2.0",
|
30
30
|
"eslint-plugin-patternfly-react": "^0.2.1",
|
31
|
-
"eslint-plugin-react": "^7.
|
31
|
+
"eslint-plugin-react": "^7.22.0",
|
32
32
|
"identity-obj-proxy": "^3.0.0",
|
33
|
-
"lodash": "^4.17.11",
|
34
33
|
"jest": "^23.6.0",
|
35
34
|
"jest-cli": "^23.6.0",
|
36
35
|
"jest-prop-type-error": "^1.1.0",
|
36
|
+
"lodash": "^4.17.21",
|
37
37
|
"react-redux-test-utils": "^0.1.1",
|
38
38
|
"sortabular": "~1.5.1",
|
39
39
|
"table-resolver": "~3.2.0"
|
@@ -0,0 +1,27 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'test_plugin_helper'
|
4
|
+
require 'nokogiri'
|
5
|
+
|
6
|
+
module ForemanAcd
|
7
|
+
# Ansible Playbooks Controller tests
|
8
|
+
class AnsiblePlaybooksControllerTest < ActionController::TestCase
|
9
|
+
setup do
|
10
|
+
as_admin { FactoryBot.create(:ansible_playbook) }
|
11
|
+
@model = ForemanAcd::AnsiblePlaybook.first
|
12
|
+
end
|
13
|
+
|
14
|
+
basic_index_test('ansible_playbooks')
|
15
|
+
basic_new_test
|
16
|
+
basic_edit_test('ansible_playbook')
|
17
|
+
|
18
|
+
test 'should destroy ansible playbook' do
|
19
|
+
assert_difference('AnsiblePlaybook.count', -1) do
|
20
|
+
delete :destroy,
|
21
|
+
:params => { :id => @model.id },
|
22
|
+
:session => set_session_user
|
23
|
+
end
|
24
|
+
assert_redirected_to ansible_playbooks_url
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
@@ -11,17 +11,22 @@ module ForemanAcd
|
|
11
11
|
@model = ForemanAcd::AppInstance.first
|
12
12
|
end
|
13
13
|
|
14
|
+
def set_session_user
|
15
|
+
org_a = Organization.find_by(:name => 'Organization 1')
|
16
|
+
loc_a = Location.find_by(:name => 'Location 1')
|
17
|
+
super.merge(:location_id => loc_a.id, :organization_id => org_a.id)
|
18
|
+
end
|
19
|
+
|
14
20
|
basic_index_test('app_instances')
|
15
21
|
basic_new_test
|
16
|
-
basic_edit_test('app_instance')
|
22
|
+
# basic_edit_test('app_instance')
|
17
23
|
|
18
24
|
test 'should destroy app instance' do
|
19
25
|
assert_difference('AppInstance.count', -1) do
|
20
|
-
delete :
|
26
|
+
delete :destroy_with_hosts,
|
21
27
|
:params => { :id => @model.id },
|
22
28
|
:session => set_session_user
|
23
29
|
end
|
24
|
-
assert_redirected_to app_instances_url
|
25
30
|
end
|
26
31
|
end
|
27
32
|
end
|
@@ -19,20 +19,36 @@ class UiAcdControllerTest < ActionController::TestCase
|
|
19
19
|
get :app, :params => { :id => app_def.id }, :session => set_session_user
|
20
20
|
assert_response :success
|
21
21
|
|
22
|
+
json_app_services = JSON.parse(app_def.services)
|
23
|
+
json_app_all = JSON.parse(app_def.ansible_vars_all)
|
24
|
+
parsed_services_response = JSON.parse(json_response['app_definition']['services'])
|
25
|
+
parsed_all_response = JSON.parse(json_response['app_definition']['ansible_vars_all'])
|
26
|
+
|
22
27
|
assert_equal app_def.name, json_response['app_definition']['name']
|
23
|
-
assert_equal
|
24
|
-
assert_equal
|
25
|
-
assert_equal
|
26
|
-
assert_equal app_def.hostgroup.ptable.name, json_response['fdata']['ptables'][0]['name']
|
28
|
+
assert_equal json_app_services.first['name'], parsed_services_response.first['name']
|
29
|
+
assert_equal json_app_services.first['ansibleGroup'], parsed_services_response.first['ansibleGroup']
|
30
|
+
assert_equal json_app_all.first['name'], parsed_all_response.first['name']
|
27
31
|
end
|
28
32
|
|
29
|
-
test 'get
|
33
|
+
test 'get foreman data json' do
|
30
34
|
hostgroup = FactoryBot.create(:hostgroup, :with_domain, :with_os, :with_environment)
|
31
|
-
get :
|
35
|
+
get :foreman_data, :params => { :id => hostgroup.id }, :session => set_session_user
|
32
36
|
assert_response :success
|
33
37
|
|
38
|
+
assert_equal hostgroup.id, json_response['hostgroup_id']
|
34
39
|
assert_equal hostgroup.environment.name, json_response['environments'][0]['name']
|
35
40
|
assert_equal hostgroup.domain.name, json_response['domains'][0]['name']
|
36
41
|
assert_equal hostgroup.ptable.name, json_response['ptables'][0]['name']
|
37
42
|
end
|
43
|
+
|
44
|
+
test 'get ansible data json' do
|
45
|
+
ansible_playbook = FactoryBot.create(:ansible_playbook)
|
46
|
+
get :ansible_data, :params => { :id => ansible_playbook.id }, :session => set_session_user
|
47
|
+
assert_response :success
|
48
|
+
|
49
|
+
json_playbook = JSON.parse(ansible_playbook.vars)
|
50
|
+
assert_equal ansible_playbook.name, json_response['name']
|
51
|
+
assert_equal json_playbook['dbservers']['mysqlservice'], json_response['groups']['dbservers']['mysqlservice']
|
52
|
+
assert_equal json_playbook['all']['repository'], json_response['groups']['all']['repository']
|
53
|
+
end
|
38
54
|
end
|
@@ -1,17 +1,31 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
FactoryBot.define do
|
4
|
+
factory :ansible_playbook, :class => 'ForemanAcd::AnsiblePlaybook' do
|
5
|
+
sequence(:name) { |n| "ansible_playbook#{n}" }
|
6
|
+
sequence(:description) { |n| "description#{n}" }
|
7
|
+
scm_type { 'directory' }
|
8
|
+
path { '/home/vagrant/acd_examples/ansible-playbook' }
|
9
|
+
playfile { 'site.yml' }
|
10
|
+
vars { '{"dbservers":{"mysqlservice":"mysqld","mysql_port":3306,"dbuser":"webapp","dbname":"ANSAP01","upassword":"Bond@007","masterpassword":"MySQL@007"},"all":{"repository":"https://github.com/bennojoy/mywebapp.git"},"webservers":{"dummy_var":0}}' }
|
11
|
+
end
|
12
|
+
|
4
13
|
factory :app_definition, :class => 'ForemanAcd::AppDefinition' do
|
5
14
|
sequence(:name) { |n| "app_definition#{n}" }
|
6
15
|
sequence(:description) { |n| "description#{n}" }
|
7
|
-
|
8
|
-
|
16
|
+
ansible_playbook
|
17
|
+
services do
|
18
|
+
'[{"id":1,"name":"DB","description":"","hostgroup":"1","ansibleGroup":"dbservers","minCount":"","maxCount":"","foremanParameters":[],"ansibleParameters":[{"id":0,"name":"mysqlservice","value":"mysqld"},{"id":1,"name":"mysql_port","value":"3306"},{"id":2,"name":"dbuser","value":"webapp"},{"id":3,"name":"dbname","value":"ANSAP01"},{"id":4,"name":"upassword","value":"Bond@007"},{"id":5,"name":"masterpassword","value":"MySQL@007"}]},{"id":2,"name":"Web","description":"","hostgroup":"1","ansibleGroup":"webservers","minCount":"","maxCount":"","foremanParameters":[],"ansibleParameters":[{"id":0,"name":"dummy_var","value":"0"}]}]'
|
19
|
+
end
|
20
|
+
ansible_vars_all { '[{"id":0,"name":"repository","value":"https://github.com/bennojoy/mywebapp.git"}]' }
|
9
21
|
end
|
10
22
|
|
11
23
|
factory :app_instance, :class => 'ForemanAcd::AppInstance' do
|
12
24
|
sequence(:name) { |n| "app_instance#{n}" }
|
13
|
-
app_definition { FactoryBot.create(:app_definition) }
|
14
25
|
sequence(:description) { |n| "description#{n}" }
|
15
|
-
|
26
|
+
app_definition
|
27
|
+
location { Location.find_by(:name => 'Location 1') }
|
28
|
+
organization { Organization.find_by(:name => 'Organization 1') }
|
29
|
+
ansible_vars_all { '[{"id":0,"name":"repository","value":"https://github.com/bennojoy/mywebapp.git"}]' }
|
16
30
|
end
|
17
31
|
end
|
@@ -0,0 +1,37 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'test_plugin_helper'
|
4
|
+
|
5
|
+
module ForemanAcd
|
6
|
+
# ACD Provider Test
|
7
|
+
class AcdProviderTest < ActiveSupport::TestCase
|
8
|
+
describe '.provider_names' do
|
9
|
+
let(:provider_names) { AcdProvider.provider_names }
|
10
|
+
|
11
|
+
it 'returns only strings' do
|
12
|
+
provider_names.each do |name|
|
13
|
+
_(name).must_be_kind_of String
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
context 'provider is registetered under :custom symbol' do
|
18
|
+
before { AcdProvider.register(:ACD, String) }
|
19
|
+
it { _(provider_names).must_include 'ACD' }
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
describe AcdProvider do
|
24
|
+
before { User.current = FactoryBot.build(:user, :admin) }
|
25
|
+
after { User.current = nil }
|
26
|
+
|
27
|
+
before do
|
28
|
+
Setting::RemoteExecution.load_defaults
|
29
|
+
end
|
30
|
+
|
31
|
+
let(:job_invocation) { FactoryBot.create(:job_invocation, :with_template) }
|
32
|
+
let(:template_invocation) { job_invocation.pattern_template_invocations.first }
|
33
|
+
let(:host) { FactoryBot.create(:host) }
|
34
|
+
let(:proxy_options) { AcdProvider.proxy_command_options(template_invocation, host) }
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
@@ -0,0 +1,11 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'test_plugin_helper'
|
4
|
+
|
5
|
+
module ForemanAcd
|
6
|
+
# Ansible Playbook Model tests
|
7
|
+
class AnsiblePlaybookTest < ActiveSupport::TestCase
|
8
|
+
should validate_presence_of(:name)
|
9
|
+
should validate_uniqueness_of(:name)
|
10
|
+
end
|
11
|
+
end
|
@@ -7,7 +7,7 @@ module ForemanAcd
|
|
7
7
|
class AppDefinitionTest < ActiveSupport::TestCase
|
8
8
|
should validate_presence_of(:name)
|
9
9
|
should validate_uniqueness_of(:name)
|
10
|
-
should belong_to(:
|
10
|
+
should belong_to(:ansible_playbook)
|
11
11
|
should have_many(:app_instances).dependent(:destroy)
|
12
12
|
end
|
13
13
|
end
|
@@ -0,0 +1,26 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'test_plugin_helper'
|
4
|
+
|
5
|
+
module ForemanAcd
|
6
|
+
# Host Extensions Test
|
7
|
+
class HostExtensionsTest < ActiveSupport::TestCase
|
8
|
+
setup do
|
9
|
+
User.current = users :admin
|
10
|
+
end
|
11
|
+
|
12
|
+
test 'host was deployed via acd?' do
|
13
|
+
host = FactoryBot.create :host
|
14
|
+
app = FactoryBot.create :app_instance
|
15
|
+
|
16
|
+
foreman_host = app.foreman_hosts.create(:hostname => host.name,
|
17
|
+
:service => 'DB',
|
18
|
+
:description => 'Description',
|
19
|
+
:foremanParameters => nil,
|
20
|
+
:ansibleParameters => nil)
|
21
|
+
foreman_host.host = host
|
22
|
+
foreman_host.save
|
23
|
+
assert host.deployed_via_acd?
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
@@ -0,0 +1,12 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'test_plugin_helper'
|
4
|
+
|
5
|
+
module ForemanAcd
|
6
|
+
# ForemanHost Model tests
|
7
|
+
class ForemanHostTest < ActiveSupport::TestCase
|
8
|
+
should validate_presence_of(:hostname)
|
9
|
+
should belong_to(:app_instance)
|
10
|
+
should belong_to(:host)
|
11
|
+
end
|
12
|
+
end
|