foreman_patch 1.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 +7 -0
- data/LICENSE +619 -0
- data/README.md +38 -0
- data/Rakefile +53 -0
- data/app/assets/javascript/foreman_patch/plan_edit_windows.js +9 -0
- data/app/assets/stylesheets/foreman_patch/cycle_plans.scss +6 -0
- data/app/assets/stylesheets/foreman_patch/foreman_patch.css +4 -0
- data/app/controllers/concerns/foreman_patch/parameters/ticket_field.rb +26 -0
- data/app/controllers/foreman_patch/api/v2/base_controller.rb +12 -0
- data/app/controllers/foreman_patch/api/v2/cycles_controller.rb +78 -0
- data/app/controllers/foreman_patch/api/v2/groups_controller.rb +70 -0
- data/app/controllers/foreman_patch/api/v2/host_groups_controller.rb +13 -0
- data/app/controllers/foreman_patch/api/v2/invocations_controller.rb +70 -0
- data/app/controllers/foreman_patch/api/v2/plans_controller.rb +79 -0
- data/app/controllers/foreman_patch/api/v2/rounds_controller.rb +77 -0
- data/app/controllers/foreman_patch/api/v2/window_plans_controller.rb +73 -0
- data/app/controllers/foreman_patch/api/v2/windows_controller.rb +85 -0
- data/app/controllers/foreman_patch/concerns/api/v2/hosts_controller_extensions.rb +21 -0
- data/app/controllers/foreman_patch/concerns/hosts_controller_extensions.rb +61 -0
- data/app/controllers/foreman_patch/cycles_controller.rb +34 -0
- data/app/controllers/foreman_patch/groups_controller.rb +68 -0
- data/app/controllers/foreman_patch/invocations_controller.rb +51 -0
- data/app/controllers/foreman_patch/plans_controller.rb +59 -0
- data/app/controllers/foreman_patch/rounds_controller.rb +18 -0
- data/app/controllers/foreman_patch/ticket_fields_controller.rb +37 -0
- data/app/controllers/foreman_patch/window_plans_controller.rb +60 -0
- data/app/controllers/foreman_patch/windows_controller.rb +58 -0
- data/app/helpers/concerns/foreman_patch/hosts_helper_extensions.rb +13 -0
- data/app/helpers/foreman_patch/cycles_helper.rb +19 -0
- data/app/helpers/foreman_patch/hosts_helper.rb +52 -0
- data/app/helpers/foreman_patch/patching_helper.rb +116 -0
- data/app/helpers/foreman_patch/plans_helper.rb +45 -0
- data/app/helpers/foreman_patch/ticket_helper.rb +11 -0
- data/app/helpers/foreman_patch/window_patching_helper.rb +20 -0
- data/app/helpers/foreman_patch/window_plans_helper.rb +13 -0
- data/app/helpers/foreman_patch/windows_helper.rb +17 -0
- data/app/lib/actions/foreman_patch/cycle/complete.rb +41 -0
- data/app/lib/actions/foreman_patch/cycle/create.rb +69 -0
- data/app/lib/actions/foreman_patch/cycle/initiate.rb +68 -0
- data/app/lib/actions/foreman_patch/cycle/plan.rb +73 -0
- data/app/lib/actions/foreman_patch/cycle/prepare_content.rb +123 -0
- data/app/lib/actions/foreman_patch/host/reschedule.rb +32 -0
- data/app/lib/actions/foreman_patch/invocation/action.rb +135 -0
- data/app/lib/actions/foreman_patch/invocation/ensure_services.rb +47 -0
- data/app/lib/actions/foreman_patch/invocation/patch.rb +93 -0
- data/app/lib/actions/foreman_patch/invocation/reschedule.rb +21 -0
- data/app/lib/actions/foreman_patch/invocation/restart.rb +101 -0
- data/app/lib/actions/foreman_patch/invocation/update_packages.rb +52 -0
- data/app/lib/actions/foreman_patch/invocation/wait_for_host.rb +103 -0
- data/app/lib/actions/foreman_patch/round/add_missing_hosts.rb +21 -0
- data/app/lib/actions/foreman_patch/round/create.rb +37 -0
- data/app/lib/actions/foreman_patch/round/patch.rb +81 -0
- data/app/lib/actions/foreman_patch/round/plan.rb +33 -0
- data/app/lib/actions/foreman_patch/round/resolve_hosts.rb +45 -0
- data/app/lib/actions/foreman_patch/window/create.rb +41 -0
- data/app/lib/actions/foreman_patch/window/patch.rb +72 -0
- data/app/lib/actions/foreman_patch/window/plan.rb +43 -0
- data/app/lib/actions/foreman_patch/window/publish.rb +32 -0
- data/app/lib/actions/foreman_patch/window/resolve_hosts.rb +31 -0
- data/app/lib/actions/helpers/failure_notification.rb +20 -0
- data/app/lib/actions/helpers/with_feature_action.rb +102 -0
- data/app/lib/actions/middleware/check_exit_status.rb +31 -0
- data/app/mailers/foreman_patch/cycle_mailer.rb +17 -0
- data/app/mailers/foreman_patch/group_mailer.rb +41 -0
- data/app/mailers/foreman_patch/invocation_mailer.rb +19 -0
- data/app/models/foreman_patch/concerns/group_facet_host_extensions.rb +35 -0
- data/app/models/foreman_patch/concerns/host_managed_extensions.rb +17 -0
- data/app/models/foreman_patch/cycle.rb +49 -0
- data/app/models/foreman_patch/group.rb +43 -0
- data/app/models/foreman_patch/host/group_facet.rb +13 -0
- data/app/models/foreman_patch/invocation.rb +60 -0
- data/app/models/foreman_patch/plan.rb +110 -0
- data/app/models/foreman_patch/plan_task_group.rb +11 -0
- data/app/models/foreman_patch/round.rb +68 -0
- data/app/models/foreman_patch/ticket_field.rb +23 -0
- data/app/models/foreman_patch/window.rb +123 -0
- data/app/models/foreman_patch/window_plan.rb +77 -0
- data/app/models/foreman_patch/window_task_group.rb +11 -0
- data/app/models/setting/patching.rb +57 -0
- data/app/services/foreman_patch/cycle_name_generator.rb +38 -0
- data/app/services/foreman_patch/ticket/affected_items.rb +110 -0
- data/app/services/foreman_patch/ticket/api.rb +68 -0
- data/app/services/foreman_patch/ticket/change_request.rb +92 -0
- data/app/services/foreman_patch/ticket/field_render.rb +21 -0
- data/app/services/foreman_patch/ticket/payload.rb +136 -0
- data/app/services/foreman_patch/ticket.rb +14 -0
- data/app/views/dashboard/_foreman_patch_widget.html.erb +2 -0
- data/app/views/foreman_patch/api/v2/cycles/base.json.rabl +3 -0
- data/app/views/foreman_patch/api/v2/cycles/create.json.rabl +3 -0
- data/app/views/foreman_patch/api/v2/cycles/index.json.rabl +3 -0
- data/app/views/foreman_patch/api/v2/cycles/show.json.rabl +9 -0
- data/app/views/foreman_patch/api/v2/cycles/update.json.rabl +3 -0
- data/app/views/foreman_patch/api/v2/group_facet/base.json.rabl +7 -0
- data/app/views/foreman_patch/api/v2/group_facet/base_with_root.json.rabl +4 -0
- data/app/views/foreman_patch/api/v2/group_facet/show.json.rabl +3 -0
- data/app/views/foreman_patch/api/v2/groups/base.json.rabl +3 -0
- data/app/views/foreman_patch/api/v2/groups/create.json.rabl +3 -0
- data/app/views/foreman_patch/api/v2/groups/index.json.rabl +2 -0
- data/app/views/foreman_patch/api/v2/groups/show.json.rabl +14 -0
- data/app/views/foreman_patch/api/v2/groups/update.json.rabl +3 -0
- data/app/views/foreman_patch/api/v2/invocations/base.json.rabl +6 -0
- data/app/views/foreman_patch/api/v2/invocations/index.json.rabl +3 -0
- data/app/views/foreman_patch/api/v2/invocations/phase.json.rabl +7 -0
- data/app/views/foreman_patch/api/v2/invocations/show.json.rabl +7 -0
- data/app/views/foreman_patch/api/v2/plans/base.json.rabl +3 -0
- data/app/views/foreman_patch/api/v2/plans/create.json.rabl +2 -0
- data/app/views/foreman_patch/api/v2/plans/index.json.rabl +3 -0
- data/app/views/foreman_patch/api/v2/plans/show.json.rabl +9 -0
- data/app/views/foreman_patch/api/v2/plans/update.json.rabl +2 -0
- data/app/views/foreman_patch/api/v2/rounds/base.json.rabl +3 -0
- data/app/views/foreman_patch/api/v2/rounds/index.json.rabl +3 -0
- data/app/views/foreman_patch/api/v2/rounds/show.json.rabl +17 -0
- data/app/views/foreman_patch/api/v2/rounds/status.json.rabl +11 -0
- data/app/views/foreman_patch/api/v2/window_plans/base.json.rabl +4 -0
- data/app/views/foreman_patch/api/v2/window_plans/create.json.rabl +2 -0
- data/app/views/foreman_patch/api/v2/window_plans/index.json.rabl +2 -0
- data/app/views/foreman_patch/api/v2/window_plans/show.json.rabl +14 -0
- data/app/views/foreman_patch/api/v2/window_plans/update.json.rabl +2 -0
- data/app/views/foreman_patch/api/v2/windows/base.json.rabl +3 -0
- data/app/views/foreman_patch/api/v2/windows/index.json.rabl +3 -0
- data/app/views/foreman_patch/api/v2/windows/schedule.json.rabl +13 -0
- data/app/views/foreman_patch/api/v2/windows/show.json.rabl +13 -0
- data/app/views/foreman_patch/api/v2/windows/update.json.rabl +3 -0
- data/app/views/foreman_patch/cycle_mailer/_details.html.erb +4 -0
- data/app/views/foreman_patch/cycle_mailer/_round.html.erb +12 -0
- data/app/views/foreman_patch/cycle_mailer/_summary.html.erb +6 -0
- data/app/views/foreman_patch/cycle_mailer/_window.html.erb +4 -0
- data/app/views/foreman_patch/cycle_mailer/planned.html.erb +7 -0
- data/app/views/foreman_patch/cycles/_form.html.erb +9 -0
- data/app/views/foreman_patch/cycles/edit.html.erb +41 -0
- data/app/views/foreman_patch/cycles/index.html.erb +45 -0
- data/app/views/foreman_patch/cycles/show.html.erb +26 -0
- data/app/views/foreman_patch/group_mailer/_dashboard.html.erb +31 -0
- data/app/views/foreman_patch/group_mailer/_list.html.erb +17 -0
- data/app/views/foreman_patch/group_mailer/completed.html.erb +16 -0
- data/app/views/foreman_patch/group_mailer/initiated.html.erb +4 -0
- data/app/views/foreman_patch/groups/_form.html.erb +9 -0
- data/app/views/foreman_patch/groups/edit.html.erb +3 -0
- data/app/views/foreman_patch/groups/index.html.erb +40 -0
- data/app/views/foreman_patch/groups/new.html.erb +3 -0
- data/app/views/foreman_patch/hosts/hosts/new_action.html.erb +1 -0
- data/app/views/foreman_patch/hosts/new_action.html.erb +1 -0
- data/app/views/foreman_patch/invocation_mailer/_output_line_set.html.erb +6 -0
- data/app/views/foreman_patch/invocation_mailer/_output_line_set.text.erb +3 -0
- data/app/views/foreman_patch/invocation_mailer/failure.html.erb +50 -0
- data/app/views/foreman_patch/invocation_mailer/failure.text.erb +10 -0
- data/app/views/foreman_patch/invocations/_output_line_set.html.erb +8 -0
- data/app/views/foreman_patch/invocations/_phase.html.erb +17 -0
- data/app/views/foreman_patch/invocations/_primary.html.erb +1 -0
- data/app/views/foreman_patch/invocations/_refresh.js.erb +7 -0
- data/app/views/foreman_patch/invocations/show.html.erb +44 -0
- data/app/views/foreman_patch/invocations/show.js.erb +17 -0
- data/app/views/foreman_patch/layouts/react.html.erb +17 -0
- data/app/views/foreman_patch/plans/_form.html.erb +12 -0
- data/app/views/foreman_patch/plans/edit.html.erb +6 -0
- data/app/views/foreman_patch/plans/index.html.erb +32 -0
- data/app/views/foreman_patch/plans/new.html.erb +3 -0
- data/app/views/foreman_patch/plans/show.html.erb +19 -0
- data/app/views/foreman_patch/rounds/show.html.erb +54 -0
- data/app/views/foreman_patch/ticket_fields/_fields.html.erb +66 -0
- data/app/views/foreman_patch/ticket_fields/edit.html.erb +6 -0
- data/app/views/foreman_patch/ticket_fields/index.html.erb +26 -0
- data/app/views/foreman_patch/ticket_fields/new.html.erb +6 -0
- data/app/views/foreman_patch/window_plans/_form.html.erb +11 -0
- data/app/views/foreman_patch/window_plans/_hidden_layout.html.erb +7 -0
- data/app/views/foreman_patch/window_plans/edit.html.erb +3 -0
- data/app/views/foreman_patch/window_plans/new.html.erb +3 -0
- data/app/views/foreman_patch/windows/_form.html.erb +21 -0
- data/app/views/foreman_patch/windows/_groups.html.erb +2 -0
- data/app/views/foreman_patch/windows/_rounds.html.erb +24 -0
- data/app/views/foreman_patch/windows/_schedule.html.erb +16 -0
- data/app/views/foreman_patch/windows/_ticket.html.erb +12 -0
- data/app/views/foreman_patch/windows/edit.html.erb +3 -0
- data/app/views/foreman_patch/windows/new.html.erb +3 -0
- data/app/views/foreman_patch/windows/show.html.erb +27 -0
- data/app/views/foreman_patch/windows/show.json.erb +4 -0
- data/app/views/hosts/select_multiple_patch_group.html.erb +12 -0
- data/app/views/overrides/patch_groups/_host_patch_group_select.html.erb +9 -0
- data/app/views/templates/ensure_services.erb +28 -0
- data/config/api_routes.rb +37 -0
- data/config/initializers/pagelets.rb +6 -0
- data/config/initializers/safemode_jail.rb +4 -0
- data/config/routes/mount_engine.rb +3 -0
- data/config/routes/overrides.rb +10 -0
- data/config/routes.rb +47 -0
- data/db/migrate/20210202161304_create_foreman_patch_plans.rb +32 -0
- data/db/migrate/20210202163323_create_foreman_patch_cycles.rb +38 -0
- data/db/migrate/20210202164301_create_foreman_patch_groups.rb +37 -0
- data/db/migrate/20210226134103_add_name_to_cycles.rb +31 -0
- data/db/migrate/20210226162824_rename_default_window.rb +5 -0
- data/db/migrate/20210302165058_add_task_to_window_groups.rb +7 -0
- data/db/migrate/20210304141111_create_invocation.rb +16 -0
- data/db/migrate/20210519163923_add_cycle_end_date.rb +29 -0
- data/db/migrate/20210525154113_expand_window_groups.rb +27 -0
- data/db/migrate/20210723160142_add_cycle_plan_task_group.rb +7 -0
- data/db/migrate/20210831160044_cycle_plan_start_correction.rb +5 -0
- data/db/migrate/20210907104645_rename_group_priority.rb +5 -0
- data/db/migrate/20210909130118_remove_old_references.rb +14 -0
- data/db/migrate/20210910141428_rename_round.rb +7 -0
- data/db/migrate/20210910163542_rename_plan.rb +8 -0
- data/db/migrate/20211014212415_round_group_reference.rb +9 -0
- data/db/migrate/20220105224803_add_group_label.rb +25 -0
- data/db/migrate/20220114153808_plan_add_name_generator.rb +5 -0
- data/db/migrate/20220117103808_remove_cycle_description.rb +5 -0
- data/db/migrate/20220406110705_add_window_state.rb +37 -0
- data/db/migrate/20220407161120_add_round_status.rb +9 -0
- data/db/migrate/20220902134800_add_invocation_status.rb +28 -0
- data/db/seeds.d/100-assign_features_with_templates.rb +16 -0
- data/db/seeds.d/160-mail_notifications.rb +38 -0
- data/db/seeds.d/75-job_templates.rb +16 -0
- data/lib/foreman_patch/engine.rb +87 -0
- data/lib/foreman_patch/plugin.rb +47 -0
- data/lib/foreman_patch/version.rb +3 -0
- data/lib/foreman_patch.rb +4 -0
- data/lib/tasks/foreman_patch_tasks.rake +47 -0
- data/locale/Makefile +60 -0
- data/locale/en/foreman_patch.po +19 -0
- data/locale/foreman_patch.pot +19 -0
- data/locale/gemspec.rb +2 -0
- data/package.json +35 -0
- data/public/assets/foreman_patch/cycle_plans-e5667e178ba389908f5c815b24ec0ea77c340849d56bc39c5ce72bb626bd446a.scss +6 -0
- data/public/assets/foreman_patch/cycle_plans-e5667e178ba389908f5c815b24ec0ea77c340849d56bc39c5ce72bb626bd446a.scss.gz +0 -0
- data/public/assets/foreman_patch/foreman_patch-ce5805a60c0d5f896f557ff5246e5a09172043004c850b39bea54e618df1c485.css +1 -0
- data/public/assets/foreman_patch/foreman_patch-ce5805a60c0d5f896f557ff5246e5a09172043004c850b39bea54e618df1c485.css.gz +0 -0
- data/public/assets/foreman_patch/foreman_patch.json +1 -0
- data/public/assets/foreman_patch/plan_edit_windows-e656ba411642a7f983b51958ab30ac49c056322d19295a603cff4d5e6c71c8ed.js +1 -0
- data/public/assets/foreman_patch/plan_edit_windows-e656ba411642a7f983b51958ab30ac49c056322d19295a603cff4d5e6c71c8ed.js.gz +0 -0
- data/public/webpack/foreman_patch/bundle-200e97f4e2ad9ed413ea.css +1 -0
- data/public/webpack/foreman_patch/bundle-200e97f4e2ad9ed413ea.css.gz +0 -0
- data/public/webpack/foreman_patch/bundle-200e97f4e2ad9ed413ea.js +6 -0
- data/public/webpack/foreman_patch/bundle-200e97f4e2ad9ed413ea.js.gz +0 -0
- data/public/webpack/foreman_patch/bundle-200e97f4e2ad9ed413ea.js.map +1 -0
- data/public/webpack/foreman_patch/bundle-200e97f4e2ad9ed413ea.js.map.gz +0 -0
- data/public/webpack/foreman_patch/foreman_patch-1e4f2d5e6f040a27aa7a.css +1 -0
- data/public/webpack/foreman_patch/foreman_patch-1e4f2d5e6f040a27aa7a.css.gz +0 -0
- data/public/webpack/foreman_patch/foreman_patch-1e4f2d5e6f040a27aa7a.js +6 -0
- data/public/webpack/foreman_patch/foreman_patch-1e4f2d5e6f040a27aa7a.js.gz +0 -0
- data/public/webpack/foreman_patch/foreman_patch-1e4f2d5e6f040a27aa7a.js.map +1 -0
- data/public/webpack/foreman_patch/foreman_patch-1e4f2d5e6f040a27aa7a.js.map.gz +0 -0
- data/public/webpack/foreman_patch/manifest.json +26 -0
- data/public/webpack/foreman_patch/manifest.json.gz +0 -0
- data/public/webpack/foreman_patch/vendor-4b77c91f1e9103179596.js +2 -0
- data/public/webpack/foreman_patch/vendor-4b77c91f1e9103179596.js.gz +0 -0
- data/public/webpack/foreman_patch/vendor-4b77c91f1e9103179596.js.map +1 -0
- data/public/webpack/foreman_patch/vendor-4b77c91f1e9103179596.js.map.gz +0 -0
- data/test/factories/foreman_patch_factories.rb +5 -0
- data/test/test_plugin_helper.rb +6 -0
- data/test/unit/foreman_patch_test.rb +11 -0
- data/webpack/components/Cycle/Cycle.js +57 -0
- data/webpack/components/Cycle/CycleActions.js +21 -0
- data/webpack/components/Cycle/CycleConstants.js +2 -0
- data/webpack/components/Cycle/CycleHelpers.js +3 -0
- data/webpack/components/Cycle/CycleSelectors.js +10 -0
- data/webpack/components/Cycle/Window.js +32 -0
- data/webpack/components/Cycle/index.js +41 -0
- data/webpack/components/Groups/Group.js +20 -0
- data/webpack/components/Groups/Groups.js +46 -0
- data/webpack/components/Groups/GroupsHelpers.js +11 -0
- data/webpack/components/Groups/Priority.js +51 -0
- data/webpack/components/Invocation/Invocation.js +47 -0
- data/webpack/components/Invocation/InvocationActions.js +8 -0
- data/webpack/components/Invocation/InvocationConsts.js +1 -0
- data/webpack/components/Invocation/InvocationSelectors.js +14 -0
- data/webpack/components/Invocation/index.js +36 -0
- data/webpack/components/Invocations/Invocations.js +55 -0
- data/webpack/components/Invocations/InvocationsConstants.js +1 -0
- data/webpack/components/Invocations/InvocationsHelpers.js +11 -0
- data/webpack/components/Invocations/InvocationsPage.js +66 -0
- data/webpack/components/Invocations/InvocationsPage.scss +3 -0
- data/webpack/components/Invocations/InvocationsSelectors.js +21 -0
- data/webpack/components/Invocations/components/InvocationItem.js +66 -0
- data/webpack/components/Invocations/components/InvocationStatus.js +51 -0
- data/webpack/components/Invocations/index.js +99 -0
- data/webpack/components/Plan/Plan.js +90 -0
- data/webpack/components/Plan/PlanActions.js +12 -0
- data/webpack/components/Plan/PlanConstants.js +1 -0
- data/webpack/components/Plan/PlanSelectors.js +9 -0
- data/webpack/components/Plan/Window.js +33 -0
- data/webpack/components/Plan/index.js +36 -0
- data/webpack/components/PlanWindow/PlanWindow.js +55 -0
- data/webpack/components/PlanWindow/index.js +32 -0
- data/webpack/components/RoundProgress/AggregateStatus.js +58 -0
- data/webpack/components/RoundProgress/RoundProgress.js +48 -0
- data/webpack/components/RoundProgress/RoundProgressActions.js +9 -0
- data/webpack/components/RoundProgress/RoundProgressConstants.js +1 -0
- data/webpack/components/RoundProgress/RoundProgressSelectors.js +24 -0
- data/webpack/components/RoundProgress/index.js +44 -0
- data/webpack/components/Rounds/Rounds.js +57 -0
- data/webpack/components/Rounds/RoundsActions.js +8 -0
- data/webpack/components/Rounds/RoundsConsts.js +1 -0
- data/webpack/components/Rounds/RoundsSelectors.js +14 -0
- data/webpack/components/Rounds/components/RoundItem.js +52 -0
- data/webpack/components/Rounds/components/RoundStatus.js +40 -0
- data/webpack/components/Rounds/index.js +37 -0
- data/webpack/components/common/Calendar/Calendar.js +86 -0
- data/webpack/components/common/Calendar/Calendar.scss +76 -0
- data/webpack/components/common/Calendar/CalendarConstants.js +1 -0
- data/webpack/components/common/Calendar/CalendarHelpers.js +77 -0
- data/webpack/components/common/Calendar/Day/index.js +9 -0
- data/webpack/components/common/Calendar/Event.js +25 -0
- data/webpack/components/common/Calendar/Month/Day.js +51 -0
- data/webpack/components/common/Calendar/Month/Header.js +77 -0
- data/webpack/components/common/Calendar/Month/Month.js +47 -0
- data/webpack/components/common/Calendar/Month/index.js +1 -0
- data/webpack/components/common/Calendar/View.js +20 -0
- data/webpack/components/common/Calendar/Week/index.js +13 -0
- data/webpack/components/common/Calendar/index.js +2 -0
- data/webpack/components/common/Terminal/OutputLine.js +26 -0
- data/webpack/components/common/Terminal/Terminal.js +115 -0
- data/webpack/components/common/Terminal/Terminal.scss +47 -0
- data/webpack/index.js +20 -0
- metadata +438 -0
@@ -0,0 +1,26 @@
|
|
1
|
+
<% title _("Ticket Fields") %>
|
2
|
+
|
3
|
+
<%= title_actions link_to(_("New Ticket Field"), hash_for_new_ticket_field_path, class: 'btn btn-default') %>
|
4
|
+
|
5
|
+
<table class="<%= table_css_classes 'table-fixed' %>">
|
6
|
+
<thead>
|
7
|
+
<tr>
|
8
|
+
<th class='col-md-6'><%= sort :field, as: s_('Field|Name') %></th>
|
9
|
+
<th class='col-md-1'><%= _('Type') %></th>
|
10
|
+
<th class='col-md-2'><%= _('Actions') %></th>
|
11
|
+
</tr>
|
12
|
+
</thead>
|
13
|
+
<tbody>
|
14
|
+
<% @ticket_fields.each do |ticket_field| %>
|
15
|
+
<tr>
|
16
|
+
<td class="ellipsis"><%= link_to ticket_field.key, edit_ticket_field_path(ticket_field) %></td>
|
17
|
+
<td class="ellipsis"><%= ticket_field.key_type || 'string' %></td>
|
18
|
+
<td>
|
19
|
+
<%= action_buttons(display_delete_if_authorized(hash_for_ticket_field_path(id: ticket_field.id).merge(auth_object: ticket_field, authorizer: authorizer), data: { confirm: _("Delete ticket field, %s?") % ticket_field.key })) %>
|
20
|
+
</td>
|
21
|
+
</tr>
|
22
|
+
<% end %>
|
23
|
+
</tbody>
|
24
|
+
</table>
|
25
|
+
|
26
|
+
<%= will_paginate_with_info @ticket_fields %>
|
@@ -0,0 +1,6 @@
|
|
1
|
+
<%= breadcrumbs(items: [ { caption: _('Ticket Fields'), url: url_for(ticket_fields_path) }, { caption: _('Create Ticket Field') }], switchable: false) %>
|
2
|
+
<% title _('Create Ticket Field') %>
|
3
|
+
<%= form_for(@ticket_field) do |f| %>
|
4
|
+
<%= render 'fields', f: f %>
|
5
|
+
<%= submit_or_cancel f %>
|
6
|
+
<% end %>
|
@@ -0,0 +1,11 @@
|
|
1
|
+
<%= form_for @window_plan, url: plan_window_plans_path(plan_id: @plan.id) do |f| %>
|
2
|
+
<%= base_errors_for @window_plan %>
|
3
|
+
|
4
|
+
<%= text_f f, :name %>
|
5
|
+
<%= textarea_f f, :description %>
|
6
|
+
<%= number_f f, :start_day, in: 0..plan_length(@plan) %>
|
7
|
+
<%= time_local_f f, :start_time %>
|
8
|
+
<%= number_f f, :duration %>
|
9
|
+
|
10
|
+
<%= submit_or_cancel f, false, {cancel_path: plan_path(@plan)} %>
|
11
|
+
<% end %>
|
@@ -0,0 +1,7 @@
|
|
1
|
+
|
2
|
+
<div class="hidden" id="windowPlanHidden<%= local_assigns[:id] %>" data-window-id="<%= local_assigns[:id] %>">
|
3
|
+
<%= field_set_tag "", id: "windowPlan", :'data-url' => new_window_plan_path do %>
|
4
|
+
<% f.hidden_field(:_destroy, class: :destroyFlag, value: (local_assigns[:id].nil? ? 1 : 0)) %>
|
5
|
+
<%= yield %>
|
6
|
+
<% end %>
|
7
|
+
</div>
|
@@ -0,0 +1,21 @@
|
|
1
|
+
<%= form_for @window, url: (@window.new_record? ? cycle_windows_path(cycle_id: @cycle) : window_path(id: @window)) do |f| %>
|
2
|
+
<%= base_errors_for @window %>
|
3
|
+
<ul class="nav nav-tabs" data-tabs="tabs">
|
4
|
+
<li class="active"><a href="#primary" data-toggle="tab"><%= _('Window') %></a></li>
|
5
|
+
<li><a href="#groups" data-toggle="tab"><%= _('Groups') %></a></li>
|
6
|
+
</ul>
|
7
|
+
|
8
|
+
<div class="tab-content">
|
9
|
+
<div class="tab-pane active" id="primary">
|
10
|
+
<%= text_f f, :name %>
|
11
|
+
<%= text_f f, :description %>
|
12
|
+
<%= text_f f, :start_at %>
|
13
|
+
<%= text_f f, :end_by %>
|
14
|
+
</div>
|
15
|
+
<div class="tab-pane" id="groups">
|
16
|
+
<%= render partial: 'groups' %>
|
17
|
+
</div>
|
18
|
+
</div>
|
19
|
+
|
20
|
+
<%= submit_or_cancel f, false, { cancel_path: cycle_path(id: (@window.new_record? ? @cycle : @window.cycle)) } %>
|
21
|
+
<% end %>
|
@@ -0,0 +1,24 @@
|
|
1
|
+
<table class="<%= table_css_classes %>">
|
2
|
+
<thead>
|
3
|
+
<tr>
|
4
|
+
<th><%= _('Group') %></th>
|
5
|
+
<th><%= _('Order') %></th>
|
6
|
+
<th><%= _('Host Count') %></th>
|
7
|
+
<th><%= _('Status') %></th>
|
8
|
+
<th><%= _('Actions') %></th>
|
9
|
+
</tr>
|
10
|
+
</thead>
|
11
|
+
<tbody>
|
12
|
+
<% rounds.each do |round| %>
|
13
|
+
<tr>
|
14
|
+
<td class="ellipsis"><%= link_to round.name, window_round_path(round) %></td>
|
15
|
+
<td><%= round.priority %></td>
|
16
|
+
<td><%= round.hosts.count %></td>
|
17
|
+
<td><%= round.status_label %></td>
|
18
|
+
<td>TODO</td>
|
19
|
+
</tr>
|
20
|
+
<% end %>
|
21
|
+
</tbody>
|
22
|
+
</table>
|
23
|
+
|
24
|
+
|
@@ -0,0 +1,16 @@
|
|
1
|
+
<div class="card-pf card-pf-accented">
|
2
|
+
<div class="card-pf-title">
|
3
|
+
<h2 style="height: 18px;" class="card-pf-title">
|
4
|
+
<%= _('Schedule') %>
|
5
|
+
</h2>
|
6
|
+
</div>
|
7
|
+
<div class="card-pf-body">
|
8
|
+
<p>
|
9
|
+
<ul>
|
10
|
+
<li><b><%= _('Scheduled to start at') %></b>: <%= window.start_at.try(:in_time_zone) %><br></li>
|
11
|
+
<li><b><%= _('Scheduled to end by') %></b>: <%= window.end_by.try(:in_time_zone) %><br></li>
|
12
|
+
</ul>
|
13
|
+
</p>
|
14
|
+
</div>
|
15
|
+
</div>
|
16
|
+
|
@@ -0,0 +1,12 @@
|
|
1
|
+
<div class="card-pf card-pf-accented">
|
2
|
+
<div class="card-pf-title">
|
3
|
+
<h2 style="height: 18px;" class="card-pf-title">
|
4
|
+
<%= _('Ticket') %>
|
5
|
+
</h2>
|
6
|
+
</div>
|
7
|
+
<div class="card-pf-body">
|
8
|
+
<p>
|
9
|
+
<%= ticket_link(@window, target: '_blank') %>
|
10
|
+
</p>
|
11
|
+
</div>
|
12
|
+
</div>
|
@@ -0,0 +1,27 @@
|
|
1
|
+
<%= webpacked_plugins_js_for :foreman_patch %>
|
2
|
+
|
3
|
+
<%
|
4
|
+
items = [{ caption: _('Cycles'), url: cycles_path },
|
5
|
+
{ caption: @cycle.name, url: cycle_path(@cycle) },
|
6
|
+
{ caption: @window.name }]
|
7
|
+
|
8
|
+
breadcrumbs(resource_url: api_cycle_windows_path(@cycle.id),
|
9
|
+
name_field: 'name',
|
10
|
+
switcher_item_url: window_path(':id'),
|
11
|
+
items: items)
|
12
|
+
%>
|
13
|
+
|
14
|
+
<% title_actions %>
|
15
|
+
|
16
|
+
<div class="row">
|
17
|
+
<div class="col-xs-6 col-sm-6 col-md-6">
|
18
|
+
<%= render partial: 'schedule', locals: { window: @window } %>
|
19
|
+
</div>
|
20
|
+
<div class="col-xs-12 col-sm-6 col-md-6">
|
21
|
+
<%= render partial: 'ticket', locals: { ticket: @window.ticket } %>
|
22
|
+
</div>
|
23
|
+
</div>
|
24
|
+
<hr/>
|
25
|
+
<div id="rounds">
|
26
|
+
<%= react_component('Rounds') %>
|
27
|
+
</div>
|
@@ -0,0 +1,12 @@
|
|
1
|
+
<%= render 'selected_hosts', hosts: @hosts %>
|
2
|
+
|
3
|
+
<%= form_for :patch_group, url: update_multiple_patch_group_hosts_path(host_ids: params[:host_ids]) do |f| %>
|
4
|
+
<%= selectable_f f, :id,
|
5
|
+
[[_('Select patch group'), 'disabled']] +
|
6
|
+
[[_('*Clear patch group*'), '']] +
|
7
|
+
ForemanPatch::Group.all.map {|pg| [pg.name, pg.id]},
|
8
|
+
{},
|
9
|
+
label: _('Patch Group'),
|
10
|
+
onchange: 'tfm.hosts.table.toggleMultipleOkButton(this)' %>
|
11
|
+
<%= checkbox_f f, :include_active, { label: _('Include Active'), help_inline: _('Reschedule patch invocations in currently active patch cycles') }, true, false %>
|
12
|
+
<% end %>
|
@@ -0,0 +1,9 @@
|
|
1
|
+
<% f ||= form %>
|
2
|
+
<% spinner_path = asset_path('spinner.gif') %>
|
3
|
+
|
4
|
+
<% pg_select_id = :host_patch_group_id %>
|
5
|
+
<% pg_select_name = 'host[group_facet_attributes][group_id]' %>
|
6
|
+
<% pg_select_attr = 'group_facet.group' %>
|
7
|
+
<%= field(f, pg_select_attr, {label: _("Default Patch Group")}) do
|
8
|
+
select_tag pg_select_id, patch_groups_for_host(@host, include_blank: true), data: {"spinner_path" => spinner_path}, class: 'form-control', name: pg_select_name
|
9
|
+
end %>
|
@@ -0,0 +1,28 @@
|
|
1
|
+
<%#
|
2
|
+
kind: job_template
|
3
|
+
name: Ensure Services - SSH Default
|
4
|
+
job_category: Services
|
5
|
+
description_format: 'Ensure Services'
|
6
|
+
feature: ensure_services
|
7
|
+
provider_type: SSH
|
8
|
+
%>
|
9
|
+
<% if @host.operatingsystem.family == "Redhat" && @host.operatingsystem.major.to_i > 6 %>
|
10
|
+
state=$(systemctl is-system-running)
|
11
|
+
while [ $? -ne 0 ]; do
|
12
|
+
case $state in
|
13
|
+
initializing | starting)
|
14
|
+
sleep 5
|
15
|
+
state=$(systemctl is-system-running)
|
16
|
+
;;
|
17
|
+
maintenance | stopping | offline)
|
18
|
+
echo $state
|
19
|
+
exit 1
|
20
|
+
;;
|
21
|
+
*)
|
22
|
+
systemctl list-units --failed
|
23
|
+
exit 1
|
24
|
+
;;
|
25
|
+
esac
|
26
|
+
done
|
27
|
+
<% else %>
|
28
|
+
<% end %>
|
@@ -0,0 +1,37 @@
|
|
1
|
+
ForemanPatch::Engine.routes.draw do
|
2
|
+
scope :foreman_patch, path: '/foreman_patch' do
|
3
|
+
namespace :api do
|
4
|
+
scope '(:apiv)', module: :v2, defaults: { apiv: 'v2' }, apiv: /v1|v2/, constraints: ApiConstraints.new(version: 2, default: true) do
|
5
|
+
resources :plans, only: [:index, :show, :create, :update, :destroy] do
|
6
|
+
resources :window_plans, only: [:index, :create]
|
7
|
+
resources :cycles, only: [:index, :create]
|
8
|
+
end
|
9
|
+
|
10
|
+
resources :window_plans, only: [:index, :show, :update, :destroy]
|
11
|
+
|
12
|
+
resources :cycles, only: [:index, :create, :show, :update, :destroy] do
|
13
|
+
resources :windows, only: [:index, :create]
|
14
|
+
end
|
15
|
+
|
16
|
+
resources :windows, only: [:show, :update, :destroy] do
|
17
|
+
resources :rounds, only: [:index]
|
18
|
+
member do
|
19
|
+
post :schedule
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
resources :groups, only: [:index, :show, :create, :update, :destroy]
|
24
|
+
|
25
|
+
resources :rounds, only: [:show, :create, :update, :destroy] do
|
26
|
+
resources :invocations, only: [:index]
|
27
|
+
member do
|
28
|
+
get :status
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
resources :invocations, only: [:show]
|
33
|
+
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
data/config/routes.rb
ADDED
@@ -0,0 +1,47 @@
|
|
1
|
+
ForemanPatch::Engine.routes.draw do
|
2
|
+
scope :foreman_patch, path: '/foreman_patch' do
|
3
|
+
resources :groups, only: [:index, :new, :create, :edit, :update, :destroy] do
|
4
|
+
collection do
|
5
|
+
get 'auto_complete_search'
|
6
|
+
end
|
7
|
+
end
|
8
|
+
|
9
|
+
resources :cycles, only: [:index, :show, :destroy] do
|
10
|
+
collection do
|
11
|
+
get 'auto_complete_search'
|
12
|
+
end
|
13
|
+
|
14
|
+
resources :windows, only: [:new, :create]
|
15
|
+
end
|
16
|
+
|
17
|
+
resources :windows, only: [:show, :destroy]
|
18
|
+
|
19
|
+
resources :rounds, only: [:show] do
|
20
|
+
collection do
|
21
|
+
get 'auto_complete_search'
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
resources :invocations, only: [:show, :destroy] do
|
26
|
+
collection do
|
27
|
+
get 'auto_complete_search'
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
resources :plans, only: [:index, :new, :create, :show, :edit, :update, :destroy] do
|
32
|
+
resources :window_plans, only: [:new, :create]
|
33
|
+
member do
|
34
|
+
post :iterate
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
38
|
+
resources :window_plans, only: [:edit, :update, :destroy]
|
39
|
+
|
40
|
+
resources :ticket_fields, except: [:show] do
|
41
|
+
resources :lookup_values, only: [:index, :create, :update, :destroy]
|
42
|
+
collection do
|
43
|
+
get 'auto_complete_search'
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
@@ -0,0 +1,32 @@
|
|
1
|
+
class CreateForemanPatchPlans < ActiveRecord::Migration[6.0]
|
2
|
+
def change
|
3
|
+
create_table :foreman_patch_cycle_plans do |t|
|
4
|
+
t.string :name, null: false
|
5
|
+
t.text :description
|
6
|
+
t.date :start_date
|
7
|
+
t.integer :interval
|
8
|
+
t.string :units
|
9
|
+
t.integer :active_count
|
10
|
+
|
11
|
+
t.timestamps
|
12
|
+
end
|
13
|
+
|
14
|
+
add_index :foreman_patch_cycle_plans, :name, unique: true, name: :foreman_patch_cycle_plans_name_uq
|
15
|
+
|
16
|
+
create_table :foreman_patch_window_plans do |t|
|
17
|
+
t.string :name, null: false
|
18
|
+
t.text :description
|
19
|
+
t.integer :cycle_plan_id, null: false
|
20
|
+
t.integer :start_day
|
21
|
+
t.time :start_time
|
22
|
+
t.integer :duration
|
23
|
+
|
24
|
+
t.timestamps
|
25
|
+
end
|
26
|
+
|
27
|
+
add_index :foreman_patch_window_plans, :name, name: :foreman_patch_window_plans_name_idx
|
28
|
+
add_index :foreman_patch_window_plans, [:cycle_plan_id, :name], unique: true, name: :foreman_patch_window_plans_cycle_plan_id_name_uq
|
29
|
+
|
30
|
+
add_foreign_key :foreman_patch_window_plans, :foreman_patch_cycle_plans, column: :cycle_plan_id, name: :foreman_patch_window_plans_cycle_plan_id_fk
|
31
|
+
end
|
32
|
+
end
|
@@ -0,0 +1,38 @@
|
|
1
|
+
class CreateForemanPatchCycles < ActiveRecord::Migration[6.0]
|
2
|
+
def change
|
3
|
+
create_table :foreman_patch_cycles do |t|
|
4
|
+
t.integer :cycle_plan_id
|
5
|
+
t.date :start_date
|
6
|
+
|
7
|
+
t.timestamps
|
8
|
+
end
|
9
|
+
|
10
|
+
add_index :foreman_patch_cycles, :start_date, name: :foreman_patch_cycles_start_date_idx
|
11
|
+
|
12
|
+
add_foreign_key :foreman_patch_cycles, :foreman_patch_cycle_plans, column: :cycle_plan_id, name: :foreman_patch_cycles_cycle_plan_id_fk
|
13
|
+
|
14
|
+
create_table :foreman_patch_windows do |t|
|
15
|
+
t.integer :window_plan_id
|
16
|
+
t.string :name
|
17
|
+
t.text :description
|
18
|
+
t.integer :cycle_id, null: false
|
19
|
+
t.timestamp :start_at
|
20
|
+
t.timestamp :end_by
|
21
|
+
t.string :ticket_id
|
22
|
+
t.uuid :task_id
|
23
|
+
t.integer :task_group_id
|
24
|
+
t.integer :triggering_id
|
25
|
+
|
26
|
+
t.timestamps
|
27
|
+
end
|
28
|
+
|
29
|
+
add_index :foreman_patch_windows, :name, name: :foreman_patch_windows_name_idx
|
30
|
+
add_index :foreman_patch_windows, [:cycle_id, :name], unique: true, name: :foreman_patch_windows_cycle_id_name_uq
|
31
|
+
|
32
|
+
add_foreign_key :foreman_patch_windows, :foreman_patch_window_plans, column: :window_plan_id, name: :foreman_patch_window_window_plan_id_fk
|
33
|
+
add_foreign_key :foreman_patch_windows, :foreman_patch_cycles, column: :cycle_id, name: :foreman_patch_windows_cycle_id_fk
|
34
|
+
# add_foreign_key :foreman_patch_windows, :foreman_tasks_tasks, column: :task_id, name: :foreman_patch_windows_task_id_fk
|
35
|
+
add_foreign_key :foreman_patch_windows, :foreman_tasks_task_groups, column: :task_group_id, name: :foreman_patch_windows_task_group_id_fk
|
36
|
+
add_foreign_key :foreman_patch_windows, :foreman_tasks_triggerings, column: :triggering_id, name: :foreman_patch_windows_triggering_id_fk
|
37
|
+
end
|
38
|
+
end
|
@@ -0,0 +1,37 @@
|
|
1
|
+
class CreateForemanPatchGroups < ActiveRecord::Migration[6.0]
|
2
|
+
def change
|
3
|
+
create_table :foreman_patch_groups do |t|
|
4
|
+
t.string :name, null: false
|
5
|
+
t.text :description
|
6
|
+
t.integer :default_window_id
|
7
|
+
t.integer :max_unavailable
|
8
|
+
t.integer :default_priority
|
9
|
+
|
10
|
+
t.timestamps
|
11
|
+
end
|
12
|
+
|
13
|
+
add_index :foreman_patch_groups, :name, unique: true, name: :foreman_patch_groups_name_uq
|
14
|
+
|
15
|
+
add_foreign_key :foreman_patch_groups, :foreman_patch_window_plans, column: :default_window_id, name: :foreman_patch_groups_default_window_id_fk
|
16
|
+
|
17
|
+
create_table :foreman_patch_window_groups do |t|
|
18
|
+
t.integer :window_id, null: false
|
19
|
+
t.integer :group_id, null: false
|
20
|
+
t.integer :priority, null: false
|
21
|
+
|
22
|
+
t.timestamps
|
23
|
+
end
|
24
|
+
|
25
|
+
add_foreign_key :foreman_patch_window_groups, :foreman_patch_groups, column: :group_id, name: :foreman_patch_window_groups_group_id_fk
|
26
|
+
add_foreign_key :foreman_patch_window_groups, :foreman_patch_windows, column: :window_id, name: :foreman_patch_window_groups_window_id_fk
|
27
|
+
|
28
|
+
create_table :foreman_patch_group_facets do |t|
|
29
|
+
t.integer :host_id, null: false
|
30
|
+
t.integer :group_id
|
31
|
+
t.timestamp :last_patched_at
|
32
|
+
end
|
33
|
+
|
34
|
+
add_foreign_key :foreman_patch_group_facets, :hosts, column: :host_id, name: :foreman_patch_group_facets_host_id_fk
|
35
|
+
add_foreign_key :foreman_patch_group_facets, :foreman_patch_groups, column: :group_id, name: :foreman_patch_group_facets_group_id_fk
|
36
|
+
end
|
37
|
+
end
|
@@ -0,0 +1,31 @@
|
|
1
|
+
class AddNameToCycles < ActiveRecord::Migration[6.0]
|
2
|
+
class CyclePlan < ActiveRecord::Base
|
3
|
+
self.table_name = 'foreman_patch_cycle_plans'
|
4
|
+
end
|
5
|
+
|
6
|
+
class Cycle < ActiveRecord::Base
|
7
|
+
self.table_name = 'foreman_patch_cycles'
|
8
|
+
|
9
|
+
belongs_to :cycle_plan, class_name: 'CyclePlan'
|
10
|
+
end
|
11
|
+
|
12
|
+
def change
|
13
|
+
add_column(:foreman_patch_cycles, :name, :string)
|
14
|
+
add_column(:foreman_patch_cycles, :description, :text)
|
15
|
+
|
16
|
+
Cycle.all.each do |cycle|
|
17
|
+
if cycle.cycle_plan_id?
|
18
|
+
cycle.name = cycle.cycle_plan.name
|
19
|
+
cycle.description = cycle.cycle_plan.description
|
20
|
+
else
|
21
|
+
cycle.name = 'Unnamed'
|
22
|
+
end
|
23
|
+
|
24
|
+
cycle.save!
|
25
|
+
end
|
26
|
+
|
27
|
+
change_column_null(:foreman_patch_cycles, :name, false)
|
28
|
+
|
29
|
+
add_index(:foreman_patch_cycles, :name, name: :foreman_patch_cycles_name_idx )
|
30
|
+
end
|
31
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
class CreateInvocation < ActiveRecord::Migration[6.0]
|
2
|
+
def change
|
3
|
+
create_table :foreman_patch_invocations do |t|
|
4
|
+
t.integer :host_id, null: false
|
5
|
+
t.integer :window_group_id, null: false
|
6
|
+
t.uuid :task_id
|
7
|
+
end
|
8
|
+
|
9
|
+
add_index :foreman_patch_invocations, :host_id, name: :foreman_patch_invocations_host_id
|
10
|
+
add_index :foreman_patch_invocations, :window_group_id, name: :foreman_patch_invocations_group_invocation_id
|
11
|
+
add_index :foreman_patch_invocations, :task_id, name: :foreman_patch_invocations_task_id
|
12
|
+
|
13
|
+
add_foreign_key :foreman_patch_invocations, :hosts, column: :host_id, name: :foreman_patch_invocations_host_id_fk
|
14
|
+
add_foreign_key :foreman_patch_invocations, :foreman_patch_window_groups, column: :window_group_id, name: :foreman_patch_invocations_window_group_id_fk
|
15
|
+
end
|
16
|
+
end
|
@@ -0,0 +1,29 @@
|
|
1
|
+
class AddCycleEndDate < ActiveRecord::Migration[6.0]
|
2
|
+
class CyclePlan < ActiveRecord::Base
|
3
|
+
self.table_name = 'foreman_patch_cycle_plans'
|
4
|
+
end
|
5
|
+
|
6
|
+
class Cycle < ActiveRecord::Base
|
7
|
+
self.table_name = 'foreman_patch_cycles'
|
8
|
+
|
9
|
+
belongs_to :cycle_plan, class_name: 'CyclePlan'
|
10
|
+
end
|
11
|
+
|
12
|
+
def change
|
13
|
+
add_column :foreman_patch_cycles, :end_date, :date
|
14
|
+
|
15
|
+
Cycle.all.each do |cycle|
|
16
|
+
cycle.start_date ||= Date.today
|
17
|
+
if cycle.cycle_plan.blank?
|
18
|
+
cycle.end_date = Date.today
|
19
|
+
else
|
20
|
+
plan = cycle.cycle_plan
|
21
|
+
cycle.end_date = cycle.start_date + (plan.interval.send(plan.units).value / ActiveSupport::Duration::SECONDS_PER_DAY) - 1
|
22
|
+
end
|
23
|
+
cycle.save!
|
24
|
+
end
|
25
|
+
|
26
|
+
change_column_null(:foreman_patch_cycles, :start_date, false)
|
27
|
+
change_column_null(:foreman_patch_cycles, :end_date, false)
|
28
|
+
end
|
29
|
+
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
class ExpandWindowGroups < ActiveRecord::Migration[6.0]
|
2
|
+
class DefaultGroup < ActiveRecord::Base
|
3
|
+
self.table_name = 'foreman_patch_groups'
|
4
|
+
end
|
5
|
+
|
6
|
+
class Group < ActiveRecord::Base
|
7
|
+
self.table_name = 'foreman_patch_window_groups'
|
8
|
+
|
9
|
+
belongs_to :group, class_name: 'DefaultGroup'
|
10
|
+
end
|
11
|
+
|
12
|
+
def change
|
13
|
+
add_column :foreman_patch_window_groups, :name, :string
|
14
|
+
add_column :foreman_patch_window_groups, :description, :text
|
15
|
+
add_column :foreman_patch_window_groups, :max_unavailable, :integer
|
16
|
+
|
17
|
+
Group.all.each do |group|
|
18
|
+
group.name = group.group.name
|
19
|
+
group.description = group.group.description
|
20
|
+
group.max_unavailable = group.group.max_unavailable
|
21
|
+
group.save!
|
22
|
+
end
|
23
|
+
|
24
|
+
change_column_null(:foreman_patch_window_groups, :group_id, true)
|
25
|
+
change_column_null(:foreman_patch_window_groups, :name, false)
|
26
|
+
end
|
27
|
+
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
class RemoveOldReferences < ActiveRecord::Migration[6.0]
|
2
|
+
def change
|
3
|
+
remove_foreign_key :foreman_patch_windows, column: :window_plan_id
|
4
|
+
remove_foreign_key :foreman_patch_window_groups, column: :group_id
|
5
|
+
|
6
|
+
remove_column :foreman_patch_windows, :window_plan_id
|
7
|
+
remove_column :foreman_patch_window_groups, :group_id
|
8
|
+
|
9
|
+
add_index :foreman_patch_window_groups, [:window_id, :name],
|
10
|
+
unique: true, name: :foreman_patch_window_groups_unique_name_by_window
|
11
|
+
add_index :foreman_patch_windows, [:cycle_id, :name],
|
12
|
+
unique: true, name: :foreman_patch_windows_unique_names_by_cycle
|
13
|
+
end
|
14
|
+
end
|
@@ -0,0 +1,8 @@
|
|
1
|
+
class RenamePlan < ActiveRecord::Migration[6.0]
|
2
|
+
def change
|
3
|
+
rename_column :foreman_patch_cycles, :cycle_plan_id, :plan_id
|
4
|
+
rename_column :foreman_patch_window_plans, :cycle_plan_id, :plan_id
|
5
|
+
|
6
|
+
rename_table :foreman_patch_cycle_plans, :foreman_patch_plans
|
7
|
+
end
|
8
|
+
end
|