├── locale └── .keep ├── bin ├── update ├── setup └── rails ├── bundler.d └── .keep ├── config ├── settings.yml └── initializers │ ├── activerecord-id_regions.rb │ └── inflections.rb ├── spec ├── dummy │ ├── log │ │ └── .keep │ ├── tmp │ │ ├── .keep │ │ ├── pids │ │ │ └── .keep │ │ └── storage │ │ │ └── .keep │ ├── vendor │ │ └── .keep │ ├── lib │ │ ├── assets │ │ │ └── .keep │ │ └── tasks │ │ │ └── .keep │ ├── storage │ │ └── .keep │ ├── test │ │ ├── models │ │ │ └── .keep │ │ ├── system │ │ │ └── .keep │ │ ├── controllers │ │ │ └── .keep │ │ ├── helpers │ │ │ └── .keep │ │ ├── integration │ │ │ └── .keep │ │ ├── mailers │ │ │ └── .keep │ │ ├── fixtures │ │ │ └── files │ │ │ │ └── .keep │ │ ├── application_system_test_case.rb │ │ ├── channels │ │ │ └── application_cable │ │ │ │ └── connection_test.rb │ │ └── test_helper.rb │ ├── app │ │ ├── assets │ │ │ ├── images │ │ │ │ └── .keep │ │ │ ├── config │ │ │ │ └── manifest.js │ │ │ └── stylesheets │ │ │ │ └── application.css │ │ ├── models │ │ │ ├── concerns │ │ │ │ └── .keep │ │ │ └── application_record.rb │ │ ├── controllers │ │ │ ├── concerns │ │ │ │ └── .keep │ │ │ └── application_controller.rb │ │ ├── views │ │ │ ├── layouts │ │ │ │ ├── mailer.text.erb │ │ │ │ ├── mailer.html.erb │ │ │ │ └── application.html.erb │ │ │ └── pwa │ │ │ │ ├── manifest.json.erb │ │ │ │ └── service-worker.js │ │ ├── helpers │ │ │ └── application_helper.rb │ │ ├── channels │ │ │ └── application_cable │ │ │ │ ├── channel.rb │ │ │ │ └── connection.rb │ │ ├── mailers │ │ │ └── application_mailer.rb │ │ └── jobs │ │ │ └── application_job.rb │ ├── public │ │ ├── icon.png │ │ ├── robots.txt │ │ └── icon.svg │ ├── bin │ │ ├── rake │ │ ├── rails │ │ ├── brakeman │ │ ├── rubocop │ │ └── docker-entrypoint │ ├── config │ │ ├── boot.rb │ │ ├── environment.rb │ │ ├── cable.yml │ │ ├── database.tmpl.yml │ │ ├── credentials.yml.enc │ │ ├── initializers │ │ │ ├── filter_parameter_logging.rb │ │ │ ├── permissions_policy.rb │ │ │ └── inflections.rb │ │ ├── routes.rb │ │ └── locales │ │ │ └── en.yml │ ├── certs │ │ └── v2_key │ ├── config.ru │ ├── Rakefile │ ├── .rubocop.yml │ ├── .github │ │ └── dependabot.yml │ ├── .gitattributes │ ├── README.md │ ├── db │ │ └── seeds.rb │ └── .gitignore ├── support │ ├── yaml_alias_load_as_unsafe_load.rb │ ├── reserved_model_helper.rb │ ├── migration_name_helper.rb │ ├── migration_stubs.rb │ ├── migration_id_regions_helper.rb │ ├── database_helper.rb │ ├── constant_watcher.rb │ └── shared_examples_for_column_migration.rb ├── migrations │ ├── 20190531161732_add_guid_to_miq_databases_spec.rb │ ├── 20190304192641_add_provider_guids_spec.rb │ ├── 20200519213913_change_hardware_mem_types_spec.rb │ ├── 20190712135032_set_provisioned_state_to_services_spec.rb │ ├── 20200409175736_add_failed_login_attempts_to_users_spec.rb │ ├── 20200103191549_remove_miq_vim_broker_worker_rows_spec.rb │ ├── 20180112171348_drop_unnecessary_blob_parts_md5_spec.rb │ ├── 20190912152014_remove_embedded_ansible_workers_spec.rb │ ├── 20190108163812_remove_cinder_manager_event_worker_rows_spec.rb │ ├── 20210407183310_remove_google_network_refresh_workers_spec.rb │ ├── 20190228210310_service_templates_should_have_names_spec.rb │ ├── 20230830134742_delete_nil_timestamp_event_streams_spec.rb │ ├── 20180130165200_drop_webmks_spec.rb │ ├── 20180618084054_init_zones_visibility_spec.rb │ ├── 20181203224640_remove_renamed_ansible_tower_configuration_manager_refresh_worker_rows_spec.rb │ ├── 20210330012001_remove_regex_from_settings_spec.rb │ ├── 20180718132840_remove_transformation_product_setting_spec.rb │ ├── 20210817182147_remove_memcache_server_opts_spec.rb │ ├── 20210726194608_delete_rhn_authentications_spec.rb │ ├── 20200717181436_delete_workers_with_json_queue_names_spec.rb │ ├── 20190918133037_remove_rails_server_from_settings_spec.rb │ ├── 20210810191933_remove_update_repo_names_from_settings_spec.rb │ ├── 20191002103406_remove_quadicon_settings_spec.rb │ ├── 20210118185402_subclass_cinder_manager_openstack_spec.rb │ ├── 20230322171110_delete_foreman_provisioning_refresh_settings_spec.rb │ ├── 20200122215829_upgrade_dropbox_to_support_tool_spec.rb │ ├── 20180810144738_update_default_internal_attribute_spec.rb │ ├── 20191114131917_remove_miqwidget_rss_spec.rb │ ├── 20181119154009_set_vm_connection_state_spec.rb │ ├── 20180201152816_remove_invalid_server_hostnames_spec.rb │ ├── 20200128122000_add_type_column_to_service_order_spec.rb │ ├── 20221010195912_update_placement_group_view_feature_identifier_spec.rb │ ├── 20201208092011_append_alert_statuses_feature_spec.rb │ ├── 20171109225052_remove_string_column_limits_spec.rb │ ├── 20190909195908_set_zone_visible_column_default_true_spec.rb │ ├── 20181130203334_classification_parent_null_spec.rb │ └── 20240214165402_remove_openstack_network_manager_metrics_collector_workers_spec.rb ├── automated_review │ ├── belongs_to_required_by_default_spec.rb │ ├── column_documentation_spec.rb │ ├── empty_database_spec.rb │ └── data_migrations_need_tests_spec.rb ├── replication │ └── util │ │ └── primary_key_spec.rb └── spec_helper.rb ├── lib ├── manageiq-schema.rb ├── manageiq │ ├── schema │ │ ├── version.rb │ │ ├── command_recorder.rb │ │ └── migrate_with_cleared_schema_cache.rb │ └── schema.rb ├── reserve.rb ├── migration_stub_helper.rb ├── tasks │ └── README.md ├── reserved_mixin.rb ├── reserved_migration_mixin.rb ├── generators │ └── migration │ │ └── templates │ │ └── migration_spec.rb.tt └── reserved_shared_mixin.rb ├── .rspec ├── .rspec_ci ├── .whitesource ├── .rubocop.yml ├── db └── migrate │ ├── 20180215164010_add_hostname_to_vm.rb │ ├── 20200819184941_add_user_to_sessions.rb │ ├── 20180618083035_add_visible_to_zone.rb │ ├── 20180625120055_add_ems_ref_to_lans.rb │ ├── 20190801025013_add_ems_ref_to_disk.rb │ ├── 20191210162908_add_type_to_storages.rb │ ├── 20190325160127_add_state_to_services.rb │ ├── 20180611131314_add_status_to_storages.rb │ ├── 20190916150002_add_application_url.rb │ ├── 20200424183342_add_read_only_to_dialogs.rb │ ├── 20180213204846_link_queue_and_task.rb │ ├── 20190521172822_rename_service_state.rb │ ├── 20191128111630_add_restart_needed_to_vms.rb │ ├── 20200728025005_add_hidden_to_clusters.rb │ ├── 20180206140653_add_switch_id_to_hardwares.rb │ ├── 20190801025156_add_ems_ref_to_guest_device.rb │ ├── 20190830133434_add_speed_to_guest_devices.rb │ ├── 20191118161213_add_type_to_resource_pools.rb │ ├── 20180216173931_add_emf_ref_to_physical_rack.rb │ ├── 20180620170052_add_aws_region_to_file_depot.rb │ ├── 20180713194229_add_canister_id_to_hardwares.rb │ ├── 20201105151502_add_system_uid_to_miq_workers.rb │ ├── 20180613200937_add_firmware_type_to_hardware.rb │ ├── 20180924144957_rename_physical_disk_type.rb │ ├── 20190201173247_add_host_id_to_switch.rb │ ├── 20190318190517_add_zone_to_service_templates.rb │ ├── 20191209162705_drop_ems_ref_from_host_storage.rb │ ├── 20210317135305_add_ems_ref_to_authentications.rb │ ├── 20210329120600_add_shared_to_network_service.rb │ ├── 20210729132849_add_options_to_endpoints.rb │ ├── 20180323204738_add_part_number_to_asset_details.rb │ ├── 20180827145819_add_link_to_notification_types.rb │ ├── 20190123210452_add_accessible_to_host_storages.rb │ ├── 20190827141149_rename_service_display_to_visible.rb │ ├── 20190916132550_add_application_build_time.rb │ ├── 20200109190758_add_desc_string_to_miq_group.rb │ ├── 20200924151045_add_vendor_to_configured_systems.rb │ ├── 20210808125201_add_health_state_to_cloud_volume.rb │ ├── 20251105160058_drop_miq_schedule_file_depot.rb │ ├── 20180606201908_rename_towhat_to_resource_type.rb │ ├── 20180706115011_add_loc_led_name_asset_details.rb │ ├── 20190731175747_add_initiator_type_to_miq_requests.rb │ ├── 20200428144000_add_description_to_cloud_network.rb │ ├── 20210217201406_add_capabilities_to_provider.rb │ ├── 20211124180240_add_type_to_host_initiator_groups.rb │ ├── 20220927184751_add_type_to_snapshots.rb │ ├── 20180306194651_add_peer_mac_address_to_guest_devices.rb │ ├── 20181002123523_add_total_space_to_physical_storages.rb │ ├── 20190110201414_add_multi_attachment_to_cloud_volume.rb │ ├── 20190225142729_add_last_inventory_date_to_ems.rb │ ├── 20220202122417_add_parent_relation_to_miq_requests.rb │ ├── 20220617140212_add_become_method_to_authentications.rb │ ├── 20171031000000_add_migrations_ran_to_miq_regions.rb │ ├── 20200219125312_add_thin_and_format_to_disk.rb │ ├── 20210824231354_add_timestamps_to_binary_blobs.rb │ ├── 20220324143540_add_validation_message_to_dialog_fields.rb │ ├── 20220527165347_add_last_refresh_success_date.rb │ ├── 20180530160321_add_report_base_model_to_chargeback_rate.rb │ ├── 20180830121026_add_port_status_to_physical_network_ports.rb │ ├── 20180920085721_add_maintenance_zone_id_to_region.rb │ ├── 20190723023214_add_authentication_id_to_git_repository.rb │ ├── 20200921142257_rename_container_label_tag_mapping.rb │ ├── 20250603164519_drop_tenant_use_config_for_attributes.rb │ ├── 20190520174739_add_price_to_services.rb │ ├── 20191114131917_remove_miqwidget_rss.rb │ ├── 20230426164308_add_configuration_script_to_resource_action.rb │ ├── 20180713201539_add_physical_chassis_id_to_physical_storage.rb │ ├── 20181012160010_remove_special_characters_from_ansible_rabbitmq_password.rb │ ├── 20190729165913_add_ems_id_to_storages.rb │ ├── 20201008185329_add_orchestration_stacks_to_configured_systems.rb │ ├── 20210223085046_add_last_perf_capture_on_to_container_images.rb │ ├── 20180525111220_add_connected_port_to_physical_network_port.rb │ ├── 20180607134817_add_network_router_id_to_floating_ip.rb │ ├── 20180817152201_add_cloud_subnet_id_to_security_group.rb │ ├── 20180905144610_remove_report_base_model_from_chargeback_rate.rb │ ├── 20190930054416_add_resource_group_id_to_network_port.rb │ ├── 20200914005000_add_target_platform_to_configuration_profiles.rb │ ├── 20230710181609_drop_container_project_old_container_group.rb │ ├── 20250624062003_add_type_to_container_projects.rb │ ├── 20180817152200_add_network_router_id_to_security_group.rb │ ├── 20190930054405_add_resource_group_id_to_cloud_network.rb │ ├── 20190930054424_add_resource_group_id_to_security_group.rb │ ├── 20200922180455_add_family_to_physical_storages.rb │ ├── 20210217201401_add_capabilities_to_ext_management_system.rb │ ├── 20191001174700_rename_chargeback_rate_detail_currency_to_currency.rb │ ├── 20201012120000_update_comment_to_vms_table_format.rb │ ├── 20180202194924_add_vlan_info_to_guest_devices.rb │ ├── 20180219151037_add_last_updated_on_to_configuration_script_source.rb │ ├── 20180828092111_add_parent_physical_chassis_id_to_physical_chassis.rb │ ├── 20190716210326_add_git_repository_to_configuration_script_source.rb │ ├── 20191210135022_add_maintenance_mode_to_storages.rb │ ├── 20180329141018_add_last_update_error_to_configuration_script_source.rb │ ├── 20210726060426_add_fields_to_host_initiators.rb │ ├── 20180313135925_add_vm_ems_ref_to_event_streams.rb │ ├── 20190513155251_add_price_to_service_templates.rb │ ├── 20181023171353_add_tenant_id_and_tenant_node_to_miq_product_features.rb │ ├── 20240105173129_add_orchestration_stack_configuration_script.rb │ ├── 20180605210436_add_title_cves_to_openscap_rule_results.rb │ ├── 20180618084757_add_zone_before_pause_id_to_ext_management_system.rb │ ├── 20210211174438_add_type_to_volume_mappings_and_host_initiators.rb │ ├── 20190517093412_create_firmware_targets.rb │ ├── 20180705190447_add_chassis_and_switch_to_event_stream.rb │ ├── 20220719151539_add_physical_storage_to_event_streams.rb │ ├── 20171219162756_add_options_and_status_to_service_resource.rb │ ├── 20180813141056_add_cancelation_status_to_miq_request.rb │ ├── 20181003122633_add_canister_id_and_ems_ref_to_physical_disks.rb │ ├── 20190305181255_add_provider_services_supported_to_availability_zone.rb │ ├── 20200227195911_drop_region_migrations_ran.rb │ ├── 20200806112501_expand_cloud_volume.rb │ ├── 20231108172936_add_valid_to_configuration_scripts.rb │ ├── 20180209180035_add_compliance_information_to_physical_servers.rb │ ├── 20210923144304_add_host_initiator_group_references.rb │ ├── 20220808064045_create_request_log.rb │ ├── 20230609190136_create_container_indexes.rb │ ├── 20200103191549_remove_miq_vim_broker_worker_rows.rb │ ├── 20210330172200_add_destinations_sources_excluded_to_security_policy_rule.rb │ ├── 20180201152816_remove_invalid_server_hostnames.rb │ ├── 20210622184700_rename_flavors_cpus_to_match_hardware.rb │ ├── 20171130164503_add_unique_set_size_to_miq_servers_miq_workers.rb │ ├── 20190613214747_add_ansible_columns_to_authentications.rb │ ├── 20210519200613_add_miq_set_memberships.rb │ ├── 20171031010000_add_schema_migrations_ran.rb │ ├── 20190909195908_set_zone_visible_column_default_true.rb │ ├── 20190918133037_remove_rails_server_from_settings.rb │ ├── 20190514115219_create_firmware_registries.rb │ ├── 20210407183310_remove_google_network_refresh_workers.rb │ ├── 20171109225052_remove_string_column_limits.rb │ ├── 20191115164358_create_miq_worker_types.rb │ ├── 20200717181436_delete_workers_with_json_queue_names.rb │ ├── 20180130165200_drop_webmks.rb │ ├── 20180718132840_remove_transformation_product_setting.rb │ ├── 20230830134742_delete_nil_timestamp_event_streams.rb │ ├── 20180116210505_create_physical_racks_and_add_to_physical_servers.rb │ ├── 20210817182147_remove_memcache_server_opts.rb │ ├── 20210831202037_drop_database_backups_table.rb │ ├── 20171117201600_downcase_resource_group_ems_ref_for_azure.rb │ ├── 20181010134649_add_evm_owner_to_orchestration_stacks.rb │ ├── 20171219161635_create_transformation_mappings.rb │ ├── 20180129152935_remove_hawkular_ems.rb │ ├── 20180618212608_create_cloud_volume_types.rb │ ├── 20200608163713_create_physical_storage_families.rb │ ├── 20251105160057_drop_miq_schedule_file_depot_records.rb │ ├── 20190912152014_remove_embedded_ansible_workers.rb │ ├── 20180323204821_remove_switch_details_from_switches.rb │ ├── 20180618084054_init_zones_visibility.rb │ ├── 20190327132620_dialog_field_load_values_on_init.rb │ ├── 20180810144738_update_default_internal_attribute.rb │ ├── 20210824000038_default_admin_state_up.rb │ ├── 20210810191933_remove_update_repo_names_from_settings.rb │ ├── 20190314110421_create_join_table_service_template_tenant.rb │ ├── 20190514124322_create_firmware_binaries.rb │ ├── 20210330012001_remove_regex_from_settings.rb │ ├── 20221117080009_create_physical_server_profile_templates.rb │ ├── 20180917151300_add_limits_to_conversion_host.rb │ ├── 20210726194608_delete_rhn_authentications.rb │ ├── 20221116104013_add_capabilities_to_physical_storage_models.rb │ ├── 20190604090631_create_external_urls.rb │ ├── 20201111154314_create_host_initiators.rb │ ├── 20210728143006_remove_old_ems_id_from_container_tables.rb │ ├── 20230322171110_delete_foreman_provisioning_refresh_settings.rb │ ├── 20200409175736_add_failed_login_attempts_to_users.rb │ ├── 20180817212259_add_api_version_and_domain_id_and_security_protocol_and_openstack_region_to_file_depot.rb │ ├── 20200521150213_create_storage_services.rb │ ├── 20210925144400_create_wwpn_candidates.rb │ ├── 20190531161732_add_guid_to_miq_databases.rb │ ├── 20191023180149_add_ems_ref_type.rb │ ├── 20180719162710_add_owner_and_group_to_auth.rb │ ├── 20200519213913_change_hardware_mem_types.rb │ ├── 20180807152553_drop_vim_performance_tag_values.rb │ ├── 20171213223553_move_ems_refresh_openstack_settings.rb │ ├── 20190712135032_set_provisioned_state_to_services.rb │ ├── 20191113200451_remove_ems_ref_obj.rb │ ├── 20230407170430_add_payload_credentials_configuration_scripts.rb │ ├── 20181119154009_set_vm_connection_state.rb │ ├── 20190528161746_add_ems_extensions.rb │ ├── 20180118131417_change_container_quota_items_to_decimals.rb │ ├── 20190517093516_create_firmware_binary_firmware_targets.rb │ ├── 20210810114405_create_host_initiator_groups.rb │ ├── 20190228210310_service_templates_should_have_names.rb │ ├── 20240214165402_remove_openstack_network_manager_metrics_collector_workers.rb │ ├── 20190304192641_add_provider_guids.rb │ ├── 20190301174502_remove_rss_feeds.rb │ ├── 20190528160313_add_ems_licenses.rb │ ├── 20180726142030_create_physical_disk.rb │ ├── 20181203224640_remove_renamed_ansible_tower_configuration_manager_refresh_worker_rows.rb │ ├── 20171219151634_create_transformation_mapping_items.rb │ ├── 20201220133400_create_volume_mappings.rb │ ├── 20210118185402_subclass_cinder_manager_openstack.rb │ ├── 20190108163812_remove_cinder_manager_event_worker_rows.rb │ ├── 20230919143746_remove_vim_strings_from_miq_queue.rb │ ├── 20200122215829_upgrade_dropbox_to_support_tool.rb │ ├── 20180319113755_add_product_details_columns_to_asset_details.rb │ ├── 20181002192054_fix_conversion_host_resource_type.rb │ ├── 20200519141015_create_storage_resources.rb │ ├── 20201124063738_create_san_addresses.rb │ ├── 20191002103406_remove_quadicon_settings.rb │ ├── 20221107195559_drop_iso_datastore.rb │ ├── 20220909190221_drop_cockpit_role.rb │ ├── 20180426163655_create_physical_storage.rb │ ├── 20191017211747_add_general_indexes.rb │ ├── 20200427122455_remove_vim_strings_from_notifications.rb │ ├── 20171117201519_update_resource_group_type_for_azure.rb │ ├── 20180807153714_add_conversion_host_table.rb │ ├── 20230220204405_delete_ovirt_rhv_network_event_catcher_workers.rb │ ├── 20180126144529_add_extra_information_to_switches.rb │ ├── 20220407210610_placement_group_additions.rb │ ├── 20220707150906_create_cloud_database_server.rb │ ├── 20180409120422_create_physical_network_ports.rb │ ├── 20221111201223_remove_vim_strings_from_custom_attributes.rb │ ├── 20211119152213_remove_hawkular_authentications.rb │ ├── 20220401093502_create_physical_server_profiles.rb │ ├── 20221114165219_remove_vim_string_from_miq_request_task_options.rb │ ├── 20200629194033_remove_vim_strings_from_miq_provision.rb │ ├── 20241017013023_reencrypt_password_scramsha.rb │ ├── 20181130203334_classification_parent_null.rb │ ├── 20200524074928_create_storage_service_resource_attachments.rb │ ├── 20230709181609_drop_archived_container_projects.rb │ ├── 20191112132759_copy_owner_id_to_group_id_for_dashboards.rb │ ├── 20230310183805_delete_ovn_event_catcher_settings.rb │ ├── 20180827083140_create_service_instances_table.rb │ ├── 20180713194201_create_canister.rb │ ├── 20221010195912_update_placement_group_view_feature_identifier.rb │ ├── 20201208092011_append_alert_statuses_feature.rb │ ├── 20180405145642_remove_provider_region_for_google_provider.rb │ ├── 20210819145618_update_network_router_admin_state_up.rb │ ├── 20180112171348_drop_unnecessary_blob_parts_md5.rb │ ├── 20180507134810_azure_normalize_image_name.rb │ ├── 20180327162308_create_physical_chassis.rb │ ├── 20191023180130_update_openstack_hosts_uid_ems.rb │ ├── 20240227184516_update_audit_managed_resources_queue_name.rb │ ├── 20181012161000_remove_special_characters_from_ansible_rabbitmq_password_two.rb │ ├── 20190726204302_remove_local_default_embedded_ansible_repos.rb │ ├── 20210105162025_subclass_swift_manager_openstack.rb │ ├── 20180712122000_remove_host_provisioning.rb │ ├── 20250603164430_update_tenant_name.rb │ ├── 20200910163614_adjust_control_explorer_features.rb │ ├── 20180605135438_add_resource_to_miq_schedule.rb │ ├── 20190201173316_add_missing_ems_id_to_switch.rb │ ├── 20200212171537_remove_ovirt_sdk4_from_event_stream.rb │ ├── 20191122203218_replace_server_capabilities_with_vix_disk_lib.rb │ ├── 20190809193031_move_embedded_ansible_proxy_setting_to_git_repository_proxy_settings.rb │ ├── 20210521192754_update_product_features_where_identifier_was_renamed_since_lasker.rb │ ├── 20190307131832_removing_authentication_for_container_deployments.rb │ ├── 20191126204129_remove_middleware_columns_in_event_streams.rb │ ├── 20180525171150_add_deleted_on_to_service_template.rb │ ├── 20220223095704_remove_col3_from_miq_widget_set.rb │ ├── 20180606083431_convert_quadicon_settings_keys.rb │ ├── 20200128122000_add_type_column_to_service_order.rb │ ├── 20210106201124_update_policy_log_startpage_url.rb │ ├── 20200428143000_create_network_service.rb │ ├── 20210106180202_update_policy_rsop_startpage_url.rb │ ├── 20201022201901_update_amazon_tag_mapper_resource_type.rb │ └── 20210106200226_update_policy_export_startpage_url.rb ├── renovate.json ├── .rubocop_local.yml ├── .yamllint ├── .gitignore ├── Rakefile └── Gemfile /locale/.keep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /bin/update: -------------------------------------------------------------------------------- 1 | ./setup -------------------------------------------------------------------------------- /bundler.d/.keep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /config/settings.yml: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /spec/dummy/log/.keep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /spec/dummy/tmp/.keep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /spec/dummy/vendor/.keep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /spec/dummy/lib/assets/.keep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /spec/dummy/lib/tasks/.keep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /spec/dummy/storage/.keep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /spec/dummy/test/models/.keep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /spec/dummy/test/system/.keep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /spec/dummy/tmp/pids/.keep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /spec/dummy/tmp/storage/.keep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /spec/dummy/test/controllers/.keep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /spec/dummy/test/helpers/.keep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /spec/dummy/test/integration/.keep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /spec/dummy/test/mailers/.keep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /spec/dummy/app/assets/images/.keep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /spec/dummy/app/models/concerns/.keep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /spec/dummy/test/fixtures/files/.keep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /spec/dummy/app/controllers/concerns/.keep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /lib/manageiq-schema.rb: -------------------------------------------------------------------------------- 1 | require "manageiq/schema" 2 | -------------------------------------------------------------------------------- /spec/dummy/app/views/layouts/mailer.text.erb: -------------------------------------------------------------------------------- 1 | <%= yield %> 2 | -------------------------------------------------------------------------------- /.rspec: -------------------------------------------------------------------------------- 1 | --require spec_helper 2 | --color 3 | --order defined 4 | -------------------------------------------------------------------------------- /spec/dummy/app/helpers/application_helper.rb: -------------------------------------------------------------------------------- 1 | module ApplicationHelper 2 | end 3 | -------------------------------------------------------------------------------- /.rspec_ci: -------------------------------------------------------------------------------- 1 | --require spec_helper 2 | --color 3 | --order defined 4 | --profile 25 5 | -------------------------------------------------------------------------------- /.whitesource: -------------------------------------------------------------------------------- 1 | { 2 | "settingsInheritedFrom": "ManageIQ/whitesource-config@master" 3 | } 4 | -------------------------------------------------------------------------------- /spec/dummy/app/assets/config/manifest.js: -------------------------------------------------------------------------------- 1 | //= link_tree ../images 2 | //= link_directory ../stylesheets .css 3 | -------------------------------------------------------------------------------- /spec/dummy/public/icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ManageIQ/manageiq-schema/HEAD/spec/dummy/public/icon.png -------------------------------------------------------------------------------- /.rubocop.yml: -------------------------------------------------------------------------------- 1 | inherit_gem: 2 | manageiq-style: ".rubocop_base.yml" 3 | inherit_from: 4 | - ".rubocop_local.yml" 5 | -------------------------------------------------------------------------------- /config/initializers/activerecord-id_regions.rb: -------------------------------------------------------------------------------- 1 | ActiveRecord::Migration.include(ActiveRecord::IdRegions::Migration) 2 | -------------------------------------------------------------------------------- /lib/manageiq/schema/version.rb: -------------------------------------------------------------------------------- 1 | module ManageIQ 2 | module Schema 3 | VERSION = '0.1.0'.freeze 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /spec/dummy/bin/rake: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | require_relative "../config/boot" 3 | require "rake" 4 | Rake.application.run 5 | -------------------------------------------------------------------------------- /spec/dummy/app/models/application_record.rb: -------------------------------------------------------------------------------- 1 | class ApplicationRecord < ActiveRecord::Base 2 | primary_abstract_class 3 | end 4 | -------------------------------------------------------------------------------- /spec/dummy/public/robots.txt: -------------------------------------------------------------------------------- 1 | # See https://www.robotstxt.org/robotstxt.html for documentation on how to use the robots.txt file 2 | -------------------------------------------------------------------------------- /lib/reserve.rb: -------------------------------------------------------------------------------- 1 | class Reserve < ActiveRecord::Base 2 | belongs_to :resource, :polymorphic => true 3 | 4 | serialize :reserved 5 | end 6 | -------------------------------------------------------------------------------- /spec/dummy/app/channels/application_cable/channel.rb: -------------------------------------------------------------------------------- 1 | module ApplicationCable 2 | class Channel < ActionCable::Channel::Base 3 | end 4 | end 5 | -------------------------------------------------------------------------------- /spec/dummy/app/channels/application_cable/connection.rb: -------------------------------------------------------------------------------- 1 | module ApplicationCable 2 | class Connection < ActionCable::Connection::Base 3 | end 4 | end 5 | -------------------------------------------------------------------------------- /spec/dummy/app/mailers/application_mailer.rb: -------------------------------------------------------------------------------- 1 | class ApplicationMailer < ActionMailer::Base 2 | default from: "from@example.com" 3 | layout "mailer" 4 | end 5 | -------------------------------------------------------------------------------- /spec/dummy/public/icon.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /spec/support/yaml_alias_load_as_unsafe_load.rb: -------------------------------------------------------------------------------- 1 | if Psych::VERSION >= "4.0" 2 | require 'yaml' 3 | YAML.singleton_class.alias_method :load, :unsafe_load 4 | end 5 | -------------------------------------------------------------------------------- /spec/dummy/config/boot.rb: -------------------------------------------------------------------------------- 1 | ENV['BUNDLE_GEMFILE'] ||= File.expand_path("../../../Gemfile", __dir__) 2 | 3 | require "bundler/setup" # Set up gems listed in the Gemfile. 4 | -------------------------------------------------------------------------------- /bin/setup: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | if [ -z "$CI" ]; then 4 | bundle update --jobs=3 5 | fi 6 | 7 | cp -n spec/dummy/config/database.{tmpl.,}yml 8 | bundle exec rake spec:setup 9 | -------------------------------------------------------------------------------- /spec/dummy/bin/rails: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | APP_PATH = File.expand_path("../config/application", __dir__) 3 | require_relative "../config/boot" 4 | require "rails/commands" 5 | -------------------------------------------------------------------------------- /db/migrate/20180215164010_add_hostname_to_vm.rb: -------------------------------------------------------------------------------- 1 | class AddHostnameToVm < ActiveRecord::Migration[5.0] 2 | def change 3 | add_column :vms, :hostname, :string 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20200819184941_add_user_to_sessions.rb: -------------------------------------------------------------------------------- 1 | class AddUserToSessions < ActiveRecord::Migration[5.2] 2 | def change 3 | add_reference :sessions, :user 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /renovate.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://docs.renovatebot.com/renovate-schema.json", 3 | "inheritConfig": true, 4 | "inheritConfigRepoName": "manageiq/renovate-config" 5 | } 6 | -------------------------------------------------------------------------------- /spec/dummy/config/environment.rb: -------------------------------------------------------------------------------- 1 | # Load the Rails application. 2 | require_relative "application" 3 | 4 | # Initialize the Rails application. 5 | Rails.application.initialize! 6 | -------------------------------------------------------------------------------- /db/migrate/20180618083035_add_visible_to_zone.rb: -------------------------------------------------------------------------------- 1 | class AddVisibleToZone < ActiveRecord::Migration[5.0] 2 | def change 3 | add_column :zones, :visible, :boolean 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20180625120055_add_ems_ref_to_lans.rb: -------------------------------------------------------------------------------- 1 | class AddEmsRefToLans < ActiveRecord::Migration[5.0] 2 | def change 3 | add_column :lans, :ems_ref, :string 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20190801025013_add_ems_ref_to_disk.rb: -------------------------------------------------------------------------------- 1 | class AddEmsRefToDisk < ActiveRecord::Migration[5.1] 2 | def change 3 | add_column :disks, :ems_ref, :string 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20191210162908_add_type_to_storages.rb: -------------------------------------------------------------------------------- 1 | class AddTypeToStorages < ActiveRecord::Migration[5.1] 2 | def change 3 | add_column :storages, :type, :string 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20190325160127_add_state_to_services.rb: -------------------------------------------------------------------------------- 1 | class AddStateToServices < ActiveRecord::Migration[5.0] 2 | def change 3 | add_column :services, :state, :string 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /spec/dummy/bin/brakeman: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | require "rubygems" 3 | require "bundler/setup" 4 | 5 | ARGV.unshift("--ensure-latest") 6 | 7 | load Gem.bin_path("brakeman", "brakeman") 8 | -------------------------------------------------------------------------------- /db/migrate/20180611131314_add_status_to_storages.rb: -------------------------------------------------------------------------------- 1 | class AddStatusToStorages < ActiveRecord::Migration[5.0] 2 | def change 3 | add_column :storages, :status, :string 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20190916150002_add_application_url.rb: -------------------------------------------------------------------------------- 1 | class AddApplicationUrl < ActiveRecord::Migration[5.0] 2 | def change 3 | add_column :guest_applications, :url, :string 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20200424183342_add_read_only_to_dialogs.rb: -------------------------------------------------------------------------------- 1 | class AddReadOnlyToDialogs < ActiveRecord::Migration[5.1] 2 | def change 3 | add_column :dialogs, :system, :boolean 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /spec/dummy/certs/v2_key: -------------------------------------------------------------------------------- 1 | --- 2 | :EZCRYPTO KEY FILE: KEEP THIS SECURE ! 3 | :created: 2014-02-28 09:59:47 -0500 4 | :algorithm: aes-256-cbc 5 | :key: uXfIgSAUq5Oz8goc/zI8HOOo0SI++Sd9mfpgBanYIM4= 6 | -------------------------------------------------------------------------------- /db/migrate/20180213204846_link_queue_and_task.rb: -------------------------------------------------------------------------------- 1 | class LinkQueueAndTask < ActiveRecord::Migration[5.0] 2 | def change 3 | add_reference :miq_queue, :miq_task, :type => :bigint 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20190521172822_rename_service_state.rb: -------------------------------------------------------------------------------- 1 | class RenameServiceState < ActiveRecord::Migration[5.0] 2 | def change 3 | rename_column :services, :state, :lifecycle_state 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20191128111630_add_restart_needed_to_vms.rb: -------------------------------------------------------------------------------- 1 | class AddRestartNeededToVms < ActiveRecord::Migration[5.1] 2 | def change 3 | add_column :vms, :restart_needed, :boolean 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20200728025005_add_hidden_to_clusters.rb: -------------------------------------------------------------------------------- 1 | class AddHiddenToClusters < ActiveRecord::Migration[5.2] 2 | def change 3 | add_column :ems_clusters, :hidden, :boolean 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20180206140653_add_switch_id_to_hardwares.rb: -------------------------------------------------------------------------------- 1 | class AddSwitchIdToHardwares < ActiveRecord::Migration[5.0] 2 | def change 3 | add_column :hardwares, :switch_id, :bigint 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20190801025156_add_ems_ref_to_guest_device.rb: -------------------------------------------------------------------------------- 1 | class AddEmsRefToGuestDevice < ActiveRecord::Migration[5.1] 2 | def change 3 | add_column :guest_devices, :ems_ref, :string 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20190830133434_add_speed_to_guest_devices.rb: -------------------------------------------------------------------------------- 1 | class AddSpeedToGuestDevices < ActiveRecord::Migration[5.1] 2 | def change 3 | add_column :guest_devices, :speed, :bigint 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20191118161213_add_type_to_resource_pools.rb: -------------------------------------------------------------------------------- 1 | class AddTypeToResourcePools < ActiveRecord::Migration[5.1] 2 | def change 3 | add_column :resource_pools, :type, :string 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /spec/dummy/config.ru: -------------------------------------------------------------------------------- 1 | # This file is used by Rack-based servers to start the application. 2 | 3 | require_relative "config/environment" 4 | 5 | run Rails.application 6 | Rails.application.load_server 7 | -------------------------------------------------------------------------------- /db/migrate/20180216173931_add_emf_ref_to_physical_rack.rb: -------------------------------------------------------------------------------- 1 | class AddEmfRefToPhysicalRack < ActiveRecord::Migration[5.0] 2 | def change 3 | add_column :physical_racks, :ems_ref, :string 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20180620170052_add_aws_region_to_file_depot.rb: -------------------------------------------------------------------------------- 1 | class AddAwsRegionToFileDepot < ActiveRecord::Migration[5.0] 2 | def change 3 | add_column :file_depots, :aws_region, :string 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20180713194229_add_canister_id_to_hardwares.rb: -------------------------------------------------------------------------------- 1 | class AddCanisterIdToHardwares < ActiveRecord::Migration[5.0] 2 | def change 3 | add_column :hardwares, :canister_id, :bigint 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20201105151502_add_system_uid_to_miq_workers.rb: -------------------------------------------------------------------------------- 1 | class AddSystemUidToMiqWorkers < ActiveRecord::Migration[5.2] 2 | def change 3 | add_column :miq_workers, :system_uid, :string 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /.rubocop_local.yml: -------------------------------------------------------------------------------- 1 | AllCops: 2 | Exclude: 3 | - 'spec/dummy/**/*' 4 | 5 | Rails/ApplicationRecord: 6 | Enabled: false 7 | 8 | Rails/SkipsModelValidations: 9 | AllowedMethods: 10 | - update_all 11 | -------------------------------------------------------------------------------- /.yamllint: -------------------------------------------------------------------------------- 1 | --- 2 | ignore: | 3 | /vendor/** 4 | /spec/manageiq/** 5 | 6 | extends: relaxed 7 | 8 | rules: 9 | indentation: 10 | indent-sequences: false 11 | line-length: 12 | max: 120 13 | -------------------------------------------------------------------------------- /db/migrate/20180613200937_add_firmware_type_to_hardware.rb: -------------------------------------------------------------------------------- 1 | class AddFirmwareTypeToHardware < ActiveRecord::Migration[5.0] 2 | def change 3 | add_column :hardwares, :firmware_type, :string 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20180924144957_rename_physical_disk_type.rb: -------------------------------------------------------------------------------- 1 | class RenamePhysicalDiskType < ActiveRecord::Migration[5.0] 2 | def change 3 | rename_column :physical_disks, :type, :controller_type 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20190201173247_add_host_id_to_switch.rb: -------------------------------------------------------------------------------- 1 | class AddHostIdToSwitch < ActiveRecord::Migration[5.0] 2 | def change 3 | add_reference :switches, :host, :type => :bigint, :index => true 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20190318190517_add_zone_to_service_templates.rb: -------------------------------------------------------------------------------- 1 | class AddZoneToServiceTemplates < ActiveRecord::Migration[5.0] 2 | def change 3 | add_column :service_templates, :zone_id, :bigint 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20191209162705_drop_ems_ref_from_host_storage.rb: -------------------------------------------------------------------------------- 1 | class DropEmsRefFromHostStorage < ActiveRecord::Migration[5.1] 2 | def change 3 | remove_column :host_storages, :ems_ref, :string 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20210317135305_add_ems_ref_to_authentications.rb: -------------------------------------------------------------------------------- 1 | class AddEmsRefToAuthentications < ActiveRecord::Migration[6.0] 2 | def change 3 | add_column :authentications, :ems_ref, :string 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20210329120600_add_shared_to_network_service.rb: -------------------------------------------------------------------------------- 1 | class AddSharedToNetworkService < ActiveRecord::Migration[6.0] 2 | def change 3 | add_column :network_services, :shared, :boolean 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20210729132849_add_options_to_endpoints.rb: -------------------------------------------------------------------------------- 1 | class AddOptionsToEndpoints < ActiveRecord::Migration[6.0] 2 | def change 3 | add_column :endpoints, :options, :jsonb, :default => {} 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20180323204738_add_part_number_to_asset_details.rb: -------------------------------------------------------------------------------- 1 | class AddPartNumberToAssetDetails < ActiveRecord::Migration[5.0] 2 | def change 3 | add_column :asset_details, :part_number, :string 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20180827145819_add_link_to_notification_types.rb: -------------------------------------------------------------------------------- 1 | class AddLinkToNotificationTypes < ActiveRecord::Migration[5.0] 2 | def change 3 | add_column :notification_types, :link_to, :string 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20190123210452_add_accessible_to_host_storages.rb: -------------------------------------------------------------------------------- 1 | class AddAccessibleToHostStorages < ActiveRecord::Migration[5.0] 2 | def change 3 | add_column :host_storages, :accessible, :boolean 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20190827141149_rename_service_display_to_visible.rb: -------------------------------------------------------------------------------- 1 | class RenameServiceDisplayToVisible < ActiveRecord::Migration[5.0] 2 | def change 3 | rename_column :services, :display, :visible 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20190916132550_add_application_build_time.rb: -------------------------------------------------------------------------------- 1 | class AddApplicationBuildTime < ActiveRecord::Migration[5.0] 2 | def change 3 | add_column :guest_applications, :build_time, :timestamp 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20200109190758_add_desc_string_to_miq_group.rb: -------------------------------------------------------------------------------- 1 | class AddDescStringToMiqGroup < ActiveRecord::Migration[5.1] 2 | def change 3 | add_column :miq_groups, :detailed_description, :string 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20200924151045_add_vendor_to_configured_systems.rb: -------------------------------------------------------------------------------- 1 | class AddVendorToConfiguredSystems < ActiveRecord::Migration[5.2] 2 | def change 3 | add_column :configured_systems, :vendor, :string 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20210808125201_add_health_state_to_cloud_volume.rb: -------------------------------------------------------------------------------- 1 | class AddHealthStateToCloudVolume < ActiveRecord::Migration[6.0] 2 | def change 3 | add_column :cloud_volumes, :health_state, :string 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20251105160058_drop_miq_schedule_file_depot.rb: -------------------------------------------------------------------------------- 1 | class DropMiqScheduleFileDepot < ActiveRecord::Migration[7.2] 2 | def change 3 | remove_column :miq_schedules, :file_depot_id, :bigint 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20180606201908_rename_towhat_to_resource_type.rb: -------------------------------------------------------------------------------- 1 | class RenameTowhatToResourceType < ActiveRecord::Migration[5.0] 2 | def change 3 | rename_column :miq_schedules, :towhat, :resource_type 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20180706115011_add_loc_led_name_asset_details.rb: -------------------------------------------------------------------------------- 1 | class AddLocLedNameAssetDetails < ActiveRecord::Migration[5.0] 2 | def change 3 | add_column :asset_details, :location_led_ems_ref, :string 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20190731175747_add_initiator_type_to_miq_requests.rb: -------------------------------------------------------------------------------- 1 | class AddInitiatorTypeToMiqRequests < ActiveRecord::Migration[5.0] 2 | def change 3 | add_column :miq_requests, :initiated_by, :string 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20200428144000_add_description_to_cloud_network.rb: -------------------------------------------------------------------------------- 1 | class AddDescriptionToCloudNetwork < ActiveRecord::Migration[5.1] 2 | def change 3 | add_column :cloud_networks, :description, :string 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20210217201406_add_capabilities_to_provider.rb: -------------------------------------------------------------------------------- 1 | class AddCapabilitiesToProvider < ActiveRecord::Migration[6.0] 2 | def change 3 | add_column :providers, :capabilities, :jsonb, :default => {} 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20211124180240_add_type_to_host_initiator_groups.rb: -------------------------------------------------------------------------------- 1 | class AddTypeToHostInitiatorGroups < ActiveRecord::Migration[6.0] 2 | def change 3 | add_column :host_initiator_groups, :type, :string 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20220927184751_add_type_to_snapshots.rb: -------------------------------------------------------------------------------- 1 | class AddTypeToSnapshots < ActiveRecord::Migration[6.1] 2 | def change 3 | add_column :snapshots, :type, :string 4 | add_index :snapshots, :type 5 | end 6 | end 7 | -------------------------------------------------------------------------------- /db/migrate/20180306194651_add_peer_mac_address_to_guest_devices.rb: -------------------------------------------------------------------------------- 1 | class AddPeerMacAddressToGuestDevices < ActiveRecord::Migration[5.0] 2 | def change 3 | add_column :guest_devices, :peer_mac_address, :string 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20181002123523_add_total_space_to_physical_storages.rb: -------------------------------------------------------------------------------- 1 | class AddTotalSpaceToPhysicalStorages < ActiveRecord::Migration[5.0] 2 | def change 3 | add_column :physical_storages, :total_space, :bigint 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20190110201414_add_multi_attachment_to_cloud_volume.rb: -------------------------------------------------------------------------------- 1 | class AddMultiAttachmentToCloudVolume < ActiveRecord::Migration[5.0] 2 | def change 3 | add_column :cloud_volumes, :multi_attachment, :boolean 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20190225142729_add_last_inventory_date_to_ems.rb: -------------------------------------------------------------------------------- 1 | class AddLastInventoryDateToEms < ActiveRecord::Migration[5.0] 2 | def change 3 | add_column :ext_management_systems, :last_inventory_date, :datetime 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20220202122417_add_parent_relation_to_miq_requests.rb: -------------------------------------------------------------------------------- 1 | class AddParentRelationToMiqRequests < ActiveRecord::Migration[6.0] 2 | def change 3 | add_reference :miq_requests, :parent, :type => :bigint 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20220617140212_add_become_method_to_authentications.rb: -------------------------------------------------------------------------------- 1 | class AddBecomeMethodToAuthentications < ActiveRecord::Migration[6.0] 2 | def change 3 | add_column :authentications, :become_method, :string 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /spec/dummy/test/application_system_test_case.rb: -------------------------------------------------------------------------------- 1 | require "test_helper" 2 | 3 | class ApplicationSystemTestCase < ActionDispatch::SystemTestCase 4 | driven_by :selenium, using: :headless_chrome, screen_size: [ 1400, 1400 ] 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20171031000000_add_migrations_ran_to_miq_regions.rb: -------------------------------------------------------------------------------- 1 | class AddMigrationsRanToMiqRegions < ActiveRecord::Migration[5.0] 2 | def change 3 | add_column :miq_regions, :migrations_ran, :string, :array => true 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20200219125312_add_thin_and_format_to_disk.rb: -------------------------------------------------------------------------------- 1 | class AddThinAndFormatToDisk < ActiveRecord::Migration[5.1] 2 | def change 3 | add_column :disks, :thin, :boolean 4 | add_column :disks, :format, :string 5 | end 6 | end 7 | -------------------------------------------------------------------------------- /db/migrate/20210824231354_add_timestamps_to_binary_blobs.rb: -------------------------------------------------------------------------------- 1 | class AddTimestampsToBinaryBlobs < ActiveRecord::Migration[6.0] 2 | def change 3 | add_timestamps :binary_blobs, :null => false, :default => -> { 'NOW()' } 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20220324143540_add_validation_message_to_dialog_fields.rb: -------------------------------------------------------------------------------- 1 | class AddValidationMessageToDialogFields < ActiveRecord::Migration[6.0] 2 | def change 3 | add_column :dialog_fields, :validator_message, :string 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20220527165347_add_last_refresh_success_date.rb: -------------------------------------------------------------------------------- 1 | class AddLastRefreshSuccessDate < ActiveRecord::Migration[6.0] 2 | def change 3 | add_column :ext_management_systems, :last_refresh_success_date, :datetime 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20180530160321_add_report_base_model_to_chargeback_rate.rb: -------------------------------------------------------------------------------- 1 | class AddReportBaseModelToChargebackRate < ActiveRecord::Migration[5.0] 2 | def change 3 | add_column :chargeback_rates, :report_base_model, :string 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20180830121026_add_port_status_to_physical_network_ports.rb: -------------------------------------------------------------------------------- 1 | class AddPortStatusToPhysicalNetworkPorts < ActiveRecord::Migration[5.0] 2 | def change 3 | add_column :physical_network_ports, :port_status, :string 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20180920085721_add_maintenance_zone_id_to_region.rb: -------------------------------------------------------------------------------- 1 | class AddMaintenanceZoneIdToRegion < ActiveRecord::Migration[5.0] 2 | def change 3 | add_column :miq_regions, :maintenance_zone_id, :bigint, :index => true 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20190723023214_add_authentication_id_to_git_repository.rb: -------------------------------------------------------------------------------- 1 | class AddAuthenticationIdToGitRepository < ActiveRecord::Migration[5.1] 2 | def change 3 | add_column :git_repositories, :authentication_id, :bigint 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20200921142257_rename_container_label_tag_mapping.rb: -------------------------------------------------------------------------------- 1 | class RenameContainerLabelTagMapping < ActiveRecord::Migration[5.2] 2 | def change 3 | rename_table :container_label_tag_mappings, :provider_tag_mappings 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20250603164519_drop_tenant_use_config_for_attributes.rb: -------------------------------------------------------------------------------- 1 | class DropTenantUseConfigForAttributes < ActiveRecord::Migration[7.0] 2 | def change 3 | remove_column :tenants, :use_config_for_attributes, :boolean 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20190520174739_add_price_to_services.rb: -------------------------------------------------------------------------------- 1 | class AddPriceToServices < ActiveRecord::Migration[5.0] 2 | def change 3 | add_reference :services, :currency, :type => :bigint 4 | add_column :services, :price, :float 5 | end 6 | end 7 | -------------------------------------------------------------------------------- /db/migrate/20191114131917_remove_miqwidget_rss.rb: -------------------------------------------------------------------------------- 1 | class RemoveMiqwidgetRss < ActiveRecord::Migration[5.1] 2 | class MiqWidget < ActiveRecord::Base; end 3 | 4 | def up 5 | MiqWidget.where(:content_type => 'rss').delete_all 6 | end 7 | end 8 | -------------------------------------------------------------------------------- /db/migrate/20230426164308_add_configuration_script_to_resource_action.rb: -------------------------------------------------------------------------------- 1 | class AddConfigurationScriptToResourceAction < ActiveRecord::Migration[6.1] 2 | def change 3 | add_reference :resource_actions, :configuration_script 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20180713201539_add_physical_chassis_id_to_physical_storage.rb: -------------------------------------------------------------------------------- 1 | class AddPhysicalChassisIdToPhysicalStorage < ActiveRecord::Migration[5.0] 2 | def change 3 | add_column :physical_storages, :physical_chassis_id, :bigint 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20181012160010_remove_special_characters_from_ansible_rabbitmq_password.rb: -------------------------------------------------------------------------------- 1 | class RemoveSpecialCharactersFromAnsibleRabbitmqPassword < ActiveRecord::Migration[5.0] 2 | # noop - see RemoveSpecialCharactersFromAnsibleRabbitmqPasswordTwo 3 | end 4 | -------------------------------------------------------------------------------- /db/migrate/20190729165913_add_ems_id_to_storages.rb: -------------------------------------------------------------------------------- 1 | class AddEmsIdToStorages < ActiveRecord::Migration[5.0] 2 | def change 3 | add_reference :storages, :ems, :type => :bigint, :index => true, :references => :ext_management_system 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20201008185329_add_orchestration_stacks_to_configured_systems.rb: -------------------------------------------------------------------------------- 1 | class AddOrchestrationStacksToConfiguredSystems < ActiveRecord::Migration[5.2] 2 | def change 3 | add_reference :configured_systems, :orchestration_stack 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20210223085046_add_last_perf_capture_on_to_container_images.rb: -------------------------------------------------------------------------------- 1 | class AddLastPerfCaptureOnToContainerImages < ActiveRecord::Migration[6.0] 2 | def change 3 | add_column :container_images, :last_perf_capture_on, :datetime 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20180525111220_add_connected_port_to_physical_network_port.rb: -------------------------------------------------------------------------------- 1 | class AddConnectedPortToPhysicalNetworkPort < ActiveRecord::Migration[5.0] 2 | def change 3 | add_column :physical_network_ports, :connected_port_uid, :string 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20180607134817_add_network_router_id_to_floating_ip.rb: -------------------------------------------------------------------------------- 1 | class AddNetworkRouterIdToFloatingIp < ActiveRecord::Migration[5.0] 2 | def change 3 | add_reference(:floating_ips, :network_router, :type => :bigint, :index => true) 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20180817152201_add_cloud_subnet_id_to_security_group.rb: -------------------------------------------------------------------------------- 1 | class AddCloudSubnetIdToSecurityGroup < ActiveRecord::Migration[5.0] 2 | def change 3 | add_reference :security_groups, :cloud_subnet, :type => :bigint, :index => true 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20180905144610_remove_report_base_model_from_chargeback_rate.rb: -------------------------------------------------------------------------------- 1 | class RemoveReportBaseModelFromChargebackRate < ActiveRecord::Migration[5.0] 2 | def change 3 | remove_column :chargeback_rates, :report_base_model, :string 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20190930054416_add_resource_group_id_to_network_port.rb: -------------------------------------------------------------------------------- 1 | class AddResourceGroupIdToNetworkPort < ActiveRecord::Migration[5.1] 2 | def change 3 | add_reference :network_ports, :resource_group, :type => :bigint, :index => true 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20200914005000_add_target_platform_to_configuration_profiles.rb: -------------------------------------------------------------------------------- 1 | class AddTargetPlatformToConfigurationProfiles < ActiveRecord::Migration[5.2] 2 | def change 3 | add_column :configuration_profiles, :target_platform, :string 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20230710181609_drop_container_project_old_container_group.rb: -------------------------------------------------------------------------------- 1 | class DropContainerProjectOldContainerGroup < ActiveRecord::Migration[6.1] 2 | def change 3 | remove_column :container_groups, :old_container_project_id, :bigint 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20250624062003_add_type_to_container_projects.rb: -------------------------------------------------------------------------------- 1 | class AddTypeToContainerProjects < ActiveRecord::Migration[7.0] 2 | def change 3 | add_column :container_projects, :type, :string 4 | add_index :container_projects, :type 5 | end 6 | end 7 | -------------------------------------------------------------------------------- /db/migrate/20180817152200_add_network_router_id_to_security_group.rb: -------------------------------------------------------------------------------- 1 | class AddNetworkRouterIdToSecurityGroup < ActiveRecord::Migration[5.0] 2 | def change 3 | add_reference :security_groups, :network_router, :type => :bigint, :index => true 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20190930054405_add_resource_group_id_to_cloud_network.rb: -------------------------------------------------------------------------------- 1 | class AddResourceGroupIdToCloudNetwork < ActiveRecord::Migration[5.1] 2 | def change 3 | add_reference :cloud_networks, :resource_group, :type => :bigint, :index => true 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20190930054424_add_resource_group_id_to_security_group.rb: -------------------------------------------------------------------------------- 1 | class AddResourceGroupIdToSecurityGroup < ActiveRecord::Migration[5.1] 2 | def change 3 | add_reference :security_groups, :resource_group, :type => :bigint, :index => true 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20200922180455_add_family_to_physical_storages.rb: -------------------------------------------------------------------------------- 1 | class AddFamilyToPhysicalStorages < ActiveRecord::Migration[5.2] 2 | def change 3 | add_reference :physical_storages, :physical_storage_family, :type => :bigint, :index => true 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20210217201401_add_capabilities_to_ext_management_system.rb: -------------------------------------------------------------------------------- 1 | class AddCapabilitiesToExtManagementSystem < ActiveRecord::Migration[6.0] 2 | def change 3 | add_column :ext_management_systems, :capabilities, :jsonb, :default => {} 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /spec/dummy/config/cable.yml: -------------------------------------------------------------------------------- 1 | development: 2 | adapter: async 3 | 4 | test: 5 | adapter: test 6 | 7 | production: 8 | adapter: redis 9 | url: <%= ENV.fetch("REDIS_URL") { "redis://localhost:6379/1" } %> 10 | channel_prefix: dummy_production 11 | -------------------------------------------------------------------------------- /db/migrate/20191001174700_rename_chargeback_rate_detail_currency_to_currency.rb: -------------------------------------------------------------------------------- 1 | class RenameChargebackRateDetailCurrencyToCurrency < ActiveRecord::Migration[5.1] 2 | def change 3 | rename_table :chargeback_rate_detail_currencies, :currencies 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20201012120000_update_comment_to_vms_table_format.rb: -------------------------------------------------------------------------------- 1 | class UpdateCommentToVmsTableFormat < ActiveRecord::Migration[5.2] 2 | def up 3 | change_column_comment :vms, :format, "The format of the VM's disk, such as vmdk, qcow2, and tier1." 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /spec/dummy/Rakefile: -------------------------------------------------------------------------------- 1 | # Add your own tasks in files placed in lib/tasks ending in .rake, 2 | # for example lib/tasks/capistrano.rake, and they will automatically be available to Rake. 3 | 4 | require_relative "config/application" 5 | 6 | Rails.application.load_tasks 7 | -------------------------------------------------------------------------------- /spec/dummy/app/controllers/application_controller.rb: -------------------------------------------------------------------------------- 1 | class ApplicationController < ActionController::Base 2 | # Only allow modern browsers supporting webp images, web push, badges, import maps, CSS nesting, and CSS :has. 3 | allow_browser versions: :modern 4 | end 5 | -------------------------------------------------------------------------------- /db/migrate/20180202194924_add_vlan_info_to_guest_devices.rb: -------------------------------------------------------------------------------- 1 | class AddVlanInfoToGuestDevices < ActiveRecord::Migration[5.0] 2 | def change 3 | add_column :guest_devices, :vlan_key, :string 4 | add_column :guest_devices, :vlan_enabled, :boolean 5 | end 6 | end 7 | -------------------------------------------------------------------------------- /db/migrate/20180219151037_add_last_updated_on_to_configuration_script_source.rb: -------------------------------------------------------------------------------- 1 | class AddLastUpdatedOnToConfigurationScriptSource < ActiveRecord::Migration[5.0] 2 | def change 3 | add_column :configuration_script_sources, :last_updated_on, :timestamp 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20180828092111_add_parent_physical_chassis_id_to_physical_chassis.rb: -------------------------------------------------------------------------------- 1 | class AddParentPhysicalChassisIdToPhysicalChassis < ActiveRecord::Migration[5.0] 2 | def change 3 | add_column :physical_chassis, :parent_physical_chassis_id, :bigint 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20190716210326_add_git_repository_to_configuration_script_source.rb: -------------------------------------------------------------------------------- 1 | class AddGitRepositoryToConfigurationScriptSource < ActiveRecord::Migration[5.1] 2 | def change 3 | add_column :configuration_script_sources, :git_repository_id, :bigint 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20191210135022_add_maintenance_mode_to_storages.rb: -------------------------------------------------------------------------------- 1 | class AddMaintenanceModeToStorages < ActiveRecord::Migration[5.1] 2 | def change 3 | add_column :storages, :maintenance, :boolean 4 | add_column :storages, :maintenance_reason, :string 5 | end 6 | end 7 | -------------------------------------------------------------------------------- /spec/support/reserved_model_helper.rb: -------------------------------------------------------------------------------- 1 | def reserved_model(module_to_include) 2 | Class.new(ActiveRecord::Base) do 3 | def self.name 4 | "TestClass" 5 | end 6 | 7 | self.table_name = "vms" 8 | include module_to_include 9 | end 10 | end 11 | -------------------------------------------------------------------------------- /db/migrate/20180329141018_add_last_update_error_to_configuration_script_source.rb: -------------------------------------------------------------------------------- 1 | class AddLastUpdateErrorToConfigurationScriptSource < ActiveRecord::Migration[5.0] 2 | def change 3 | add_column :configuration_script_sources, :last_update_error, :text 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20210726060426_add_fields_to_host_initiators.rb: -------------------------------------------------------------------------------- 1 | class AddFieldsToHostInitiators < ActiveRecord::Migration[6.0] 2 | def change 3 | add_column :host_initiators, :status, :string 4 | add_column :host_initiators, :host_cluster_name, :string 5 | end 6 | end 7 | -------------------------------------------------------------------------------- /db/migrate/20180313135925_add_vm_ems_ref_to_event_streams.rb: -------------------------------------------------------------------------------- 1 | class AddVmEmsRefToEventStreams < ActiveRecord::Migration[5.0] 2 | def change 3 | add_column :event_streams, :vm_ems_ref, :string 4 | add_column :event_streams, :dest_vm_ems_ref, :string 5 | end 6 | end 7 | -------------------------------------------------------------------------------- /db/migrate/20190513155251_add_price_to_service_templates.rb: -------------------------------------------------------------------------------- 1 | class AddPriceToServiceTemplates < ActiveRecord::Migration[5.0] 2 | def change 3 | add_reference :service_templates, :currency, :type => :bigint 4 | add_column :service_templates, :price, :float 5 | end 6 | end 7 | -------------------------------------------------------------------------------- /db/migrate/20181023171353_add_tenant_id_and_tenant_node_to_miq_product_features.rb: -------------------------------------------------------------------------------- 1 | class AddTenantIdAndTenantNodeToMiqProductFeatures < ActiveRecord::Migration[5.0] 2 | def change 3 | add_reference :miq_product_features, :tenant, :type => :bigint, :index => true 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20240105173129_add_orchestration_stack_configuration_script.rb: -------------------------------------------------------------------------------- 1 | class AddOrchestrationStackConfigurationScript < ActiveRecord::Migration[6.1] 2 | def change 3 | add_reference :orchestration_stacks, :configuration_script, :type => :bigint, :index => true 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20180605210436_add_title_cves_to_openscap_rule_results.rb: -------------------------------------------------------------------------------- 1 | class AddTitleCvesToOpenscapRuleResults < ActiveRecord::Migration[5.0] 2 | def change 3 | add_column :openscap_rule_results, :title, :string 4 | add_column :openscap_rule_results, :cves, :string 5 | end 6 | end 7 | -------------------------------------------------------------------------------- /db/migrate/20180618084757_add_zone_before_pause_id_to_ext_management_system.rb: -------------------------------------------------------------------------------- 1 | class AddZoneBeforePauseIdToExtManagementSystem < ActiveRecord::Migration[5.0] 2 | def change 3 | add_reference :ext_management_systems, :zone_before_pause, :type => :bigint, :index => true 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20210211174438_add_type_to_volume_mappings_and_host_initiators.rb: -------------------------------------------------------------------------------- 1 | class AddTypeToVolumeMappingsAndHostInitiators < ActiveRecord::Migration[6.0] 2 | def change 3 | add_column :volume_mappings, :type, :string 4 | add_column :host_initiators, :type, :string 5 | end 6 | end 7 | -------------------------------------------------------------------------------- /spec/support/migration_name_helper.rb: -------------------------------------------------------------------------------- 1 | def require_migration 2 | require migration_path 3 | end 4 | 5 | def migration_path 6 | spec_name = caller_locations.detect {|loc| loc.path.end_with?("_spec.rb")}.path 7 | spec_name.sub("spec/migrations", "db/migrate").sub("_spec.rb", ".rb") 8 | end 9 | -------------------------------------------------------------------------------- /db/migrate/20190517093412_create_firmware_targets.rb: -------------------------------------------------------------------------------- 1 | class CreateFirmwareTargets < ActiveRecord::Migration[5.0] 2 | def change 3 | create_table :firmware_targets do |t| 4 | t.string :manufacturer 5 | t.string :model 6 | t.timestamps 7 | end 8 | end 9 | end 10 | -------------------------------------------------------------------------------- /db/migrate/20180705190447_add_chassis_and_switch_to_event_stream.rb: -------------------------------------------------------------------------------- 1 | class AddChassisAndSwitchToEventStream < ActiveRecord::Migration[5.0] 2 | def change 3 | add_column :event_streams, :physical_chassis_id, :bigint 4 | add_column :event_streams, :physical_switch_id, :bigint 5 | end 6 | end 7 | -------------------------------------------------------------------------------- /db/migrate/20220719151539_add_physical_storage_to_event_streams.rb: -------------------------------------------------------------------------------- 1 | class AddPhysicalStorageToEventStreams < ActiveRecord::Migration[6.0] 2 | def change 3 | add_column :event_streams, :physical_storage_id, :bigint 4 | add_column :event_streams, :physical_storage_name, :string 5 | end 6 | end 7 | -------------------------------------------------------------------------------- /spec/dummy/.rubocop.yml: -------------------------------------------------------------------------------- 1 | # Omakase Ruby styling for Rails 2 | inherit_gem: { rubocop-rails-omakase: rubocop.yml } 3 | 4 | # Overwrite or add rules to create your own house style 5 | # 6 | # # Use `[a, [b, c]]` not `[ a, [ b, c ] ]` 7 | # Layout/SpaceInsideArrayLiteralBrackets: 8 | # Enabled: false 9 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | /.bundle/ 2 | /.yardoc 3 | /Gemfile.lock 4 | /_yardoc/ 5 | /coverage/ 6 | /doc/ 7 | /pkg/ 8 | /spec/reports/ 9 | /tmp/ 10 | 11 | .rubocop-* 12 | /bundler.d/* 13 | !/bundler.d/.keep 14 | /config/settings.local.yml 15 | /config/settings/*.local.yml 16 | /config/environments/*.local.yml 17 | -------------------------------------------------------------------------------- /db/migrate/20171219162756_add_options_and_status_to_service_resource.rb: -------------------------------------------------------------------------------- 1 | class AddOptionsAndStatusToServiceResource < ActiveRecord::Migration[5.0] 2 | def change 3 | add_column :service_resources, :options, :jsonb, :default => {} 4 | add_column :service_resources, :status, :string 5 | end 6 | end 7 | -------------------------------------------------------------------------------- /db/migrate/20180813141056_add_cancelation_status_to_miq_request.rb: -------------------------------------------------------------------------------- 1 | class AddCancelationStatusToMiqRequest < ActiveRecord::Migration[5.0] 2 | def change 3 | add_column :miq_requests, :cancelation_status, :string 4 | add_column :miq_request_tasks, :cancelation_status, :string 5 | end 6 | end 7 | -------------------------------------------------------------------------------- /db/migrate/20181003122633_add_canister_id_and_ems_ref_to_physical_disks.rb: -------------------------------------------------------------------------------- 1 | class AddCanisterIdAndEmsRefToPhysicalDisks < ActiveRecord::Migration[5.0] 2 | def change 3 | add_reference :physical_disks, :canister, :type => :bigint 4 | add_column :physical_disks, :ems_ref, :string 5 | end 6 | end 7 | -------------------------------------------------------------------------------- /db/migrate/20190305181255_add_provider_services_supported_to_availability_zone.rb: -------------------------------------------------------------------------------- 1 | class AddProviderServicesSupportedToAvailabilityZone < ActiveRecord::Migration[5.0] 2 | def change 3 | add_column :availability_zones, :provider_services_supported, :string, :array => true, :default => [] 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20200227195911_drop_region_migrations_ran.rb: -------------------------------------------------------------------------------- 1 | class DropRegionMigrationsRan < ActiveRecord::Migration[5.1] 2 | def up 3 | remove_column :miq_regions, :migrations_ran 4 | end 5 | 6 | def down 7 | add_column :miq_regions, :migrations_ran, :string, :array => true 8 | end 9 | end 10 | -------------------------------------------------------------------------------- /db/migrate/20200806112501_expand_cloud_volume.rb: -------------------------------------------------------------------------------- 1 | class ExpandCloudVolume < ActiveRecord::Migration[5.2] 2 | def change 3 | add_reference :cloud_volumes, :storage_resource, :type => :bigint, :index => true 4 | add_reference :cloud_volumes, :storage_service, :type => :bigint, :index => true 5 | end 6 | end 7 | -------------------------------------------------------------------------------- /db/migrate/20231108172936_add_valid_to_configuration_scripts.rb: -------------------------------------------------------------------------------- 1 | class AddValidToConfigurationScripts < ActiveRecord::Migration[6.1] 2 | def change 3 | add_column :configuration_scripts, :payload_valid, :boolean, :default => true 4 | add_column :configuration_scripts, :payload_error, :string 5 | end 6 | end 7 | -------------------------------------------------------------------------------- /spec/dummy/bin/rubocop: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | require "rubygems" 3 | require "bundler/setup" 4 | 5 | # explicit rubocop config increases performance slightly while avoiding config confusion. 6 | ARGV.unshift("--config", File.expand_path("../.rubocop.yml", __dir__)) 7 | 8 | load Gem.bin_path("rubocop", "rubocop") 9 | -------------------------------------------------------------------------------- /db/migrate/20180209180035_add_compliance_information_to_physical_servers.rb: -------------------------------------------------------------------------------- 1 | class AddComplianceInformationToPhysicalServers < ActiveRecord::Migration[5.0] 2 | def change 3 | add_column :physical_servers, :ems_compliance_name, :string 4 | add_column :physical_servers, :ems_compliance_status, :string 5 | end 6 | end 7 | -------------------------------------------------------------------------------- /db/migrate/20210923144304_add_host_initiator_group_references.rb: -------------------------------------------------------------------------------- 1 | class AddHostInitiatorGroupReferences < ActiveRecord::Migration[6.0] 2 | def change 3 | add_reference :host_initiators, :host_initiator_group, :type => :bigint 4 | add_reference :volume_mappings, :host_initiator_group, :type => :bigint 5 | end 6 | end 7 | -------------------------------------------------------------------------------- /db/migrate/20220808064045_create_request_log.rb: -------------------------------------------------------------------------------- 1 | class CreateRequestLog < ActiveRecord::Migration[6.0] 2 | def change 3 | create_table :request_logs do |t| 4 | t.string :message 5 | t.string :severity 6 | t.references :resource, :type => :bigint 7 | t.timestamps 8 | end 9 | end 10 | end 11 | -------------------------------------------------------------------------------- /db/migrate/20230609190136_create_container_indexes.rb: -------------------------------------------------------------------------------- 1 | class CreateContainerIndexes < ActiveRecord::Migration[6.1] 2 | def change 3 | add_index :containers, :container_group_id 4 | add_index :containers, :container_image_id 5 | add_index :containers, :ems_id 6 | add_index :container_images, :ems_id 7 | end 8 | end 9 | -------------------------------------------------------------------------------- /spec/dummy/app/jobs/application_job.rb: -------------------------------------------------------------------------------- 1 | class ApplicationJob < ActiveJob::Base 2 | # Automatically retry jobs that encountered a deadlock 3 | # retry_on ActiveRecord::Deadlocked 4 | 5 | # Most jobs are safe to ignore if the underlying records are no longer available 6 | # discard_on ActiveJob::DeserializationError 7 | end 8 | -------------------------------------------------------------------------------- /spec/dummy/app/views/layouts/mailer.html.erb: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 8 | 9 | 10 | 11 | <%= yield %> 12 | 13 | 14 | -------------------------------------------------------------------------------- /spec/dummy/.github/dependabot.yml: -------------------------------------------------------------------------------- 1 | version: 2 2 | updates: 3 | - package-ecosystem: bundler 4 | directory: "/" 5 | schedule: 6 | interval: daily 7 | open-pull-requests-limit: 10 8 | - package-ecosystem: github-actions 9 | directory: "/" 10 | schedule: 11 | interval: daily 12 | open-pull-requests-limit: 10 13 | -------------------------------------------------------------------------------- /db/migrate/20200103191549_remove_miq_vim_broker_worker_rows.rb: -------------------------------------------------------------------------------- 1 | class RemoveMiqVimBrokerWorkerRows < ActiveRecord::Migration[5.1] 2 | class MiqWorker < ActiveRecord::Base 3 | self.inheritance_column = :_type_disabled 4 | end 5 | 6 | def up 7 | MiqWorker.where(:type => "MiqVimBrokerWorker").delete_all 8 | end 9 | end 10 | -------------------------------------------------------------------------------- /db/migrate/20210330172200_add_destinations_sources_excluded_to_security_policy_rule.rb: -------------------------------------------------------------------------------- 1 | class AddDestinationsSourcesExcludedToSecurityPolicyRule < ActiveRecord::Migration[6.0] 2 | def change 3 | add_column :security_policy_rules, :sources_excluded, :boolean 4 | add_column :security_policy_rules, :destinations_excluded, :boolean 5 | end 6 | end 7 | -------------------------------------------------------------------------------- /db/migrate/20180201152816_remove_invalid_server_hostnames.rb: -------------------------------------------------------------------------------- 1 | class RemoveInvalidServerHostnames < ActiveRecord::Migration[5.0] 2 | class MiqServer < ActiveRecord::Base; end 3 | def up 4 | MiqServer.where.not(:hostname => nil).find_each do |server| 5 | server.update(:hostname => nil) unless server.hostname.hostname? 6 | end 7 | end 8 | end 9 | -------------------------------------------------------------------------------- /db/migrate/20210622184700_rename_flavors_cpus_to_match_hardware.rb: -------------------------------------------------------------------------------- 1 | class RenameFlavorsCpusToMatchHardware < ActiveRecord::Migration[6.0] 2 | def change 3 | rename_column :flavors, :cpus, :cpu_total_cores 4 | rename_column :flavors, :cpu_cores, :cpu_cores_per_socket 5 | add_column :flavors, :cpu_sockets, :integer, :default => 1 6 | end 7 | end 8 | -------------------------------------------------------------------------------- /db/migrate/20171130164503_add_unique_set_size_to_miq_servers_miq_workers.rb: -------------------------------------------------------------------------------- 1 | class AddUniqueSetSizeToMiqServersMiqWorkers < ActiveRecord::Migration[5.0] 2 | def change 3 | add_column :miq_servers, :unique_set_size, :decimal, :precision => 20, :scale => 0 4 | add_column :miq_workers, :unique_set_size, :decimal, :precision => 20, :scale => 0 5 | end 6 | end 7 | -------------------------------------------------------------------------------- /db/migrate/20190613214747_add_ansible_columns_to_authentications.rb: -------------------------------------------------------------------------------- 1 | class AddAnsibleColumnsToAuthentications < ActiveRecord::Migration[5.0] 2 | def change 3 | add_column :authentications, :become_username, :string 4 | add_column :authentications, :become_password, :string 5 | add_column :authentications, :auth_key_password, :string 6 | end 7 | end 8 | -------------------------------------------------------------------------------- /db/migrate/20210519200613_add_miq_set_memberships.rb: -------------------------------------------------------------------------------- 1 | class AddMiqSetMemberships < ActiveRecord::Migration[5.0] 2 | def change 3 | create_table :miq_set_memberships do |t| 4 | t.belongs_to :member, :polymorphic => true, :type => :bigint 5 | t.belongs_to :miq_set, :type => :bigint 6 | 7 | t.timestamps 8 | end 9 | end 10 | end 11 | -------------------------------------------------------------------------------- /db/migrate/20171031010000_add_schema_migrations_ran.rb: -------------------------------------------------------------------------------- 1 | class AddSchemaMigrationsRan < ActiveRecord::Migration[5.0] 2 | def up 3 | create_table :schema_migrations_ran do |t| 4 | t.string :version 5 | t.datetime :created_at, :null => false 6 | end 7 | end 8 | 9 | def down 10 | drop_table :schema_migrations_ran 11 | end 12 | end 13 | -------------------------------------------------------------------------------- /db/migrate/20190909195908_set_zone_visible_column_default_true.rb: -------------------------------------------------------------------------------- 1 | class SetZoneVisibleColumnDefaultTrue < ActiveRecord::Migration[5.0] 2 | class Zone < ActiveRecord::Base 3 | end 4 | 5 | def change 6 | change_column_default(:zones, :visible, :from => nil, :to => true) 7 | Zone.where(:visible => nil).update_all(:visible => true) 8 | end 9 | end 10 | -------------------------------------------------------------------------------- /db/migrate/20190918133037_remove_rails_server_from_settings.rb: -------------------------------------------------------------------------------- 1 | class RemoveRailsServerFromSettings < ActiveRecord::Migration[5.1] 2 | class SettingsChange < ActiveRecord::Base 3 | end 4 | 5 | def up 6 | say_with_time("Remove rails_server settings") do 7 | SettingsChange.where(:key => "/server/rails_server").delete_all 8 | end 9 | end 10 | end 11 | -------------------------------------------------------------------------------- /db/migrate/20190514115219_create_firmware_registries.rb: -------------------------------------------------------------------------------- 1 | class CreateFirmwareRegistries < ActiveRecord::Migration[5.0] 2 | def change 3 | create_table :firmware_registries do |t| 4 | t.string :name 5 | t.datetime :last_refresh_on 6 | t.text :last_refresh_error 7 | t.string :type 8 | t.timestamps 9 | end 10 | end 11 | end 12 | -------------------------------------------------------------------------------- /db/migrate/20210407183310_remove_google_network_refresh_workers.rb: -------------------------------------------------------------------------------- 1 | class RemoveGoogleNetworkRefreshWorkers < ActiveRecord::Migration[6.0] 2 | class MiqWorker < ActiveRecord::Base 3 | self.inheritance_column = :_type_disabled 4 | end 5 | 6 | def up 7 | MiqWorker.where(:type => "ManageIQ::Providers::Google::NetworkManager::RefreshWorker").delete_all 8 | end 9 | end 10 | -------------------------------------------------------------------------------- /spec/support/migration_stubs.rb: -------------------------------------------------------------------------------- 1 | module Spec 2 | module Support 3 | module MigrationStubs 4 | def self.reserved_stub 5 | Class.new(ActiveRecord::Base) do 6 | self.table_name = "reserves" 7 | self.inheritance_column = :_type_disabled # disable STI 8 | serialize :reserved 9 | end 10 | end 11 | end 12 | end 13 | end 14 | -------------------------------------------------------------------------------- /spec/dummy/test/channels/application_cable/connection_test.rb: -------------------------------------------------------------------------------- 1 | require "test_helper" 2 | 3 | module ApplicationCable 4 | class ConnectionTest < ActionCable::Connection::TestCase 5 | # test "connects with cookies" do 6 | # cookies.signed[:user_id] = 42 7 | # 8 | # connect 9 | # 10 | # assert_equal connection.user_id, "42" 11 | # end 12 | end 13 | end 14 | -------------------------------------------------------------------------------- /db/migrate/20171109225052_remove_string_column_limits.rb: -------------------------------------------------------------------------------- 1 | class RemoveStringColumnLimits < ActiveRecord::Migration[5.0] 2 | def up 3 | connection.tables.sort.each do |t| 4 | connection.columns(t).each do |col| 5 | next unless col.type == :string && !col.limit.nil? 6 | change_column t, col.name, :string, :limit => nil 7 | end 8 | end 9 | end 10 | end 11 | -------------------------------------------------------------------------------- /db/migrate/20191115164358_create_miq_worker_types.rb: -------------------------------------------------------------------------------- 1 | class CreateMiqWorkerTypes < ActiveRecord::Migration[5.1] 2 | def change 3 | create_table :miq_worker_types do |t| 4 | t.string :worker_type, :null => false 5 | t.string :bundler_groups, :array => true 6 | t.integer :kill_priority 7 | 8 | t.index :worker_type, :unique => true 9 | end 10 | end 11 | end 12 | -------------------------------------------------------------------------------- /db/migrate/20200717181436_delete_workers_with_json_queue_names.rb: -------------------------------------------------------------------------------- 1 | class DeleteWorkersWithJsonQueueNames < ActiveRecord::Migration[5.2] 2 | class MiqWorker < ActiveRecord::Base 3 | include ActiveRecord::IdRegions 4 | 5 | self.inheritance_column = :_type_disabled 6 | end 7 | 8 | def up 9 | MiqWorker.in_my_region.where("queue_name LIKE ?", "\[%\]").delete_all 10 | end 11 | end 12 | -------------------------------------------------------------------------------- /spec/migrations/20190531161732_add_guid_to_miq_databases_spec.rb: -------------------------------------------------------------------------------- 1 | require_migration 2 | 3 | describe AddGuidToMiqDatabases do 4 | let(:miq_database) { migration_stub(:MiqDatabase) } 5 | 6 | migration_context :up do 7 | it "sets miq_database guids" do 8 | db = miq_database.create! 9 | 10 | migrate 11 | 12 | expect(db.reload.guid).to be_guid 13 | end 14 | end 15 | end 16 | -------------------------------------------------------------------------------- /spec/dummy/.gitattributes: -------------------------------------------------------------------------------- 1 | # See https://git-scm.com/docs/gitattributes for more about git attribute files. 2 | 3 | # Mark the database schema as having been generated. 4 | db/schema.rb linguist-generated 5 | 6 | # Mark any vendored files as having been vendored. 7 | vendor/* linguist-vendored 8 | config/credentials/*.yml.enc diff=rails_credentials 9 | config/credentials.yml.enc diff=rails_credentials 10 | -------------------------------------------------------------------------------- /Rakefile: -------------------------------------------------------------------------------- 1 | require 'bundler/setup' 2 | 3 | begin 4 | require 'rspec/core/rake_task' 5 | 6 | APP_RAKEFILE = File.expand_path("spec/dummy/Rakefile", __dir__) 7 | load 'rails/tasks/engine.rake' 8 | load 'rails/tasks/statistics.rake' 9 | rescue LoadError 10 | end 11 | 12 | require 'bundler/gem_tasks' 13 | 14 | FileList['lib/tasks_private/**/*.rake'].each { |r| load r } 15 | 16 | task :default => :spec 17 | -------------------------------------------------------------------------------- /db/migrate/20180130165200_drop_webmks.rb: -------------------------------------------------------------------------------- 1 | class DropWebmks < ActiveRecord::Migration[5.0] 2 | class MiqServer < ActiveRecord::Base; end 3 | class SettingsChange < ActiveRecord::Base; end 4 | 5 | def up 6 | say_with_time "Remove all VMware MKS console-related records from settings" do 7 | SettingsChange.where(:key => '/server/remote_console_type', :value => 'MKS').delete_all 8 | end 9 | end 10 | end 11 | -------------------------------------------------------------------------------- /db/migrate/20180718132840_remove_transformation_product_setting.rb: -------------------------------------------------------------------------------- 1 | class RemoveTransformationProductSetting < ActiveRecord::Migration[5.0] 2 | class SettingsChange < ActiveRecord::Base 3 | serialize :value 4 | end 5 | 6 | def up 7 | say_with_time("Removing transformation product setting (v2v)") do 8 | SettingsChange.where(:key => "/product/transformation").delete_all 9 | end 10 | end 11 | end 12 | -------------------------------------------------------------------------------- /db/migrate/20230830134742_delete_nil_timestamp_event_streams.rb: -------------------------------------------------------------------------------- 1 | class DeleteNilTimestampEventStreams < ActiveRecord::Migration[6.1] 2 | class EventStream < ActiveRecord::Base 3 | self.inheritance_column = :_type_disabled 4 | end 5 | 6 | def up 7 | say_with_time("Deleting event_streams with nil timestamp values") do 8 | EventStream.where(:timestamp => nil).delete_all 9 | end 10 | end 11 | end 12 | -------------------------------------------------------------------------------- /db/migrate/20180116210505_create_physical_racks_and_add_to_physical_servers.rb: -------------------------------------------------------------------------------- 1 | class CreatePhysicalRacksAndAddToPhysicalServers < ActiveRecord::Migration[5.0] 2 | def change 3 | create_table :physical_racks do |t| 4 | t.bigint :ems_id 5 | t.string :uid_ems 6 | t.string :name 7 | t.timestamps 8 | end 9 | 10 | add_column :physical_servers, :physical_rack_id, :bigint 11 | end 12 | end 13 | -------------------------------------------------------------------------------- /db/migrate/20210817182147_remove_memcache_server_opts.rb: -------------------------------------------------------------------------------- 1 | class RemoveMemcacheServerOpts < ActiveRecord::Migration[6.0] 2 | class SettingsChange < ActiveRecord::Base 3 | include ActiveRecord::IdRegions 4 | end 5 | 6 | def up 7 | say_with_time("Remove memcache_server_opts settings") do 8 | SettingsChange.in_my_region.where(:key => "/session/memcache_server_opts").delete_all 9 | end 10 | end 11 | end 12 | -------------------------------------------------------------------------------- /db/migrate/20210831202037_drop_database_backups_table.rb: -------------------------------------------------------------------------------- 1 | class DropDatabaseBackupsTable < ActiveRecord::Migration[6.0] 2 | def up 3 | drop_table :database_backups 4 | end 5 | 6 | def down 7 | create_table "database_backups", :force => :cascade do |t| 8 | t.string "name" 9 | t.datetime "created_at", :null => false 10 | t.datetime "updated_at", :null => false 11 | end 12 | end 13 | end 14 | -------------------------------------------------------------------------------- /db/migrate/20171117201600_downcase_resource_group_ems_ref_for_azure.rb: -------------------------------------------------------------------------------- 1 | class DowncaseResourceGroupEmsRefForAzure < ActiveRecord::Migration[5.0] 2 | class ResourceGroup < ActiveRecord::Base 3 | self.inheritance_column = :_type_disabled 4 | end 5 | 6 | def up 7 | say_with_time("Downcase ems_ref for Azure resource groups") do 8 | ResourceGroup.update_all("ems_ref = lower(ems_ref)") 9 | end 10 | end 11 | end 12 | -------------------------------------------------------------------------------- /db/migrate/20181010134649_add_evm_owner_to_orchestration_stacks.rb: -------------------------------------------------------------------------------- 1 | class AddEvmOwnerToOrchestrationStacks < ActiveRecord::Migration[5.0] 2 | def change 3 | add_reference :orchestration_stacks, :evm_owner, :type => :bigint, :index => true 4 | add_reference :orchestration_stacks, :miq_group, :type => :bigint, :index => true 5 | add_reference :orchestration_stacks, :tenant, :type => :bigint, :index => true 6 | end 7 | end 8 | -------------------------------------------------------------------------------- /db/migrate/20171219161635_create_transformation_mappings.rb: -------------------------------------------------------------------------------- 1 | class CreateTransformationMappings < ActiveRecord::Migration[5.0] 2 | def change 3 | create_table :transformation_mappings do |t| 4 | t.string :name 5 | t.string :description 6 | t.string :comments 7 | t.string :state 8 | t.jsonb :options, :default => {} 9 | t.bigint :tenant_id 10 | t.timestamps 11 | end 12 | end 13 | end 14 | -------------------------------------------------------------------------------- /db/migrate/20180129152935_remove_hawkular_ems.rb: -------------------------------------------------------------------------------- 1 | class RemoveHawkularEms < ActiveRecord::Migration[5.0] 2 | class ExtManagementSystem < ActiveRecord::Base 3 | self.inheritance_column = :_type_disabled 4 | end 5 | 6 | def up 7 | say_with_time("Removing Hawkular MiddlewareManagers") do 8 | ExtManagementSystem.where(:type => 'ManageIQ::Providers::Hawkular::MiddlewareManager').delete_all 9 | end 10 | end 11 | end 12 | -------------------------------------------------------------------------------- /db/migrate/20180618212608_create_cloud_volume_types.rb: -------------------------------------------------------------------------------- 1 | class CreateCloudVolumeTypes < ActiveRecord::Migration[5.0] 2 | def change 3 | create_table :cloud_volume_types do |t| 4 | t.text :description 5 | t.string :name 6 | t.string :type 7 | t.string :backend_name 8 | t.string :ems_ref 9 | t.bigint :ems_id 10 | t.boolean :public 11 | 12 | t.timestamps 13 | end 14 | end 15 | end 16 | -------------------------------------------------------------------------------- /db/migrate/20200608163713_create_physical_storage_families.rb: -------------------------------------------------------------------------------- 1 | class CreatePhysicalStorageFamilies < ActiveRecord::Migration[5.2] 2 | def change 3 | create_table :physical_storage_families do |t| 4 | t.string :name 5 | t.string :version 6 | t.references :ems, :type => :bigint, :index => true, :references => :ext_management_system 7 | t.string :ems_ref 8 | t.timestamps 9 | end 10 | end 11 | end 12 | -------------------------------------------------------------------------------- /db/migrate/20251105160057_drop_miq_schedule_file_depot_records.rb: -------------------------------------------------------------------------------- 1 | class DropMiqScheduleFileDepotRecords < ActiveRecord::Migration[7.2] 2 | class MiqSchedule < ActiveRecord::Base 3 | include ActiveRecord::IdRegions 4 | end 5 | 6 | def up 7 | say_with_time("Dropping schedules attached to file_depot records") do 8 | MiqSchedule.in_my_region.where.not(:file_depot_id => nil).delete_all 9 | end 10 | end 11 | end 12 | -------------------------------------------------------------------------------- /spec/migrations/20190304192641_add_provider_guids_spec.rb: -------------------------------------------------------------------------------- 1 | require_migration 2 | 3 | describe AddProviderGuids do 4 | let(:provider) { migration_stub(:Provider) } 5 | 6 | migration_context :up do 7 | it "sets provider guids" do 8 | obj1 = provider.create! 9 | 10 | expect(obj1.reload.guid).to eq(nil) 11 | 12 | migrate 13 | 14 | expect(obj1.reload.guid).not_to eq(nil) 15 | end 16 | end 17 | end 18 | -------------------------------------------------------------------------------- /db/migrate/20190912152014_remove_embedded_ansible_workers.rb: -------------------------------------------------------------------------------- 1 | class RemoveEmbeddedAnsibleWorkers < ActiveRecord::Migration[5.1] 2 | class MiqWorker < ActiveRecord::Base 3 | self.inheritance_column = :_type_disabled 4 | end 5 | 6 | def up 7 | say_with_time "Remove EmbeddedAnsibleWorker records where the model was removed" do 8 | MiqWorker.where(:type => "EmbeddedAnsibleWorker").delete_all 9 | end 10 | end 11 | end 12 | -------------------------------------------------------------------------------- /db/migrate/20180323204821_remove_switch_details_from_switches.rb: -------------------------------------------------------------------------------- 1 | class RemoveSwitchDetailsFromSwitches < ActiveRecord::Migration[5.0] 2 | def change 3 | remove_column :switches, :product_name, :string 4 | remove_column :switches, :part_number, :string 5 | remove_column :switches, :serial_number, :string 6 | remove_column :switches, :description, :string 7 | remove_column :switches, :manufacturer, :string 8 | end 9 | end 10 | -------------------------------------------------------------------------------- /db/migrate/20180618084054_init_zones_visibility.rb: -------------------------------------------------------------------------------- 1 | class InitZonesVisibility < ActiveRecord::Migration[5.0] 2 | class Zone < ActiveRecord::Base 3 | end 4 | 5 | def up 6 | say_with_time("Updating all zones to visible") do 7 | Zone.update_all(:visible => true) 8 | end 9 | end 10 | 11 | def down 12 | say_with_time("Resetting zone visibility") do 13 | Zone.update_all(:visible => nil) 14 | end 15 | end 16 | end 17 | -------------------------------------------------------------------------------- /db/migrate/20190327132620_dialog_field_load_values_on_init.rb: -------------------------------------------------------------------------------- 1 | class DialogFieldLoadValuesOnInit < ActiveRecord::Migration[5.0] 2 | class DialogField < ActiveRecord::Base 3 | self.inheritance_column = :_type_disabled # disable STI 4 | end 5 | 6 | def up 7 | say_with_time("Updating Dialog Fields") do 8 | DialogField.where(:show_refresh_button => [false, nil]).update_all('load_values_on_init = true') 9 | end 10 | end 11 | end 12 | -------------------------------------------------------------------------------- /db/migrate/20180810144738_update_default_internal_attribute.rb: -------------------------------------------------------------------------------- 1 | class UpdateDefaultInternalAttribute < ActiveRecord::Migration[5.0] 2 | class ServiceTemplate < ActiveRecord::Base 3 | self.inheritance_column = :_type_disabled 4 | end 5 | 6 | def up 7 | say_with_time("Set ServiceTemplate internal") do 8 | ServiceTemplate.where.not(:type => "ServiceTemplateTransformationPlan").update_all(:internal => false) 9 | end 10 | end 11 | end 12 | -------------------------------------------------------------------------------- /db/migrate/20210824000038_default_admin_state_up.rb: -------------------------------------------------------------------------------- 1 | class DefaultAdminStateUp < ActiveRecord::Migration[6.0] 2 | def up 3 | change_column_default :network_ports, :admin_state_up, false 4 | 5 | change_column_null :network_routers, :admin_state_up, true 6 | end 7 | 8 | def down 9 | change_column_default :network_ports, :admin_state_up, false 10 | 11 | change_column_null :network_routers, :admin_state_up, false 12 | end 13 | end 14 | -------------------------------------------------------------------------------- /spec/automated_review/belongs_to_required_by_default_spec.rb: -------------------------------------------------------------------------------- 1 | describe "belongs_to_required_by_default" do 2 | it "should be the default value of true", :skip => "Skipped until all migrations specs are changed to work with the default value" do 3 | # NOTE: Once all migrations are changed, we can remove this test. It is here to act as a reminder. 4 | expect(Rails.application.config.active_record.belongs_to_required_by_default).to be true 5 | end 6 | end 7 | -------------------------------------------------------------------------------- /spec/support/migration_id_regions_helper.rb: -------------------------------------------------------------------------------- 1 | module Spec 2 | module Support 3 | module MigrationIdRegionsHelper 4 | def anonymous_class_with_id_regions 5 | ActiveRecord::IdRegions::Migration.anonymous_class_with_id_regions 6 | end 7 | 8 | def id_in_current_region(id) 9 | anonymous_class_with_id_regions.id_in_region(id, anonymous_class_with_id_regions.my_region_number) 10 | end 11 | end 12 | end 13 | end 14 | -------------------------------------------------------------------------------- /db/migrate/20210810191933_remove_update_repo_names_from_settings.rb: -------------------------------------------------------------------------------- 1 | class RemoveUpdateRepoNamesFromSettings < ActiveRecord::Migration[6.0] 2 | class SettingsChange < ActiveRecord::Base 3 | end 4 | 5 | def up 6 | say_with_time("deleting update_repo_names that are no longer used") do 7 | SettingsChange.where(:resource_type => "MiqRegion", :key => "/product/update_repo_names") 8 | .destroy_all 9 | end 10 | end 11 | end 12 | -------------------------------------------------------------------------------- /spec/dummy/bin/docker-entrypoint: -------------------------------------------------------------------------------- 1 | #!/bin/bash -e 2 | 3 | # Enable jemalloc for reduced memory usage and latency. 4 | if [ -z "${LD_PRELOAD+x}" ] && [ -f /usr/lib/*/libjemalloc.so.2 ]; then 5 | export LD_PRELOAD="$(echo /usr/lib/*/libjemalloc.so.2)" 6 | fi 7 | 8 | # If running the rails server then create or migrate existing database 9 | if [ "${1}" == "./bin/rails" ] && [ "${2}" == "server" ]; then 10 | ./bin/rails db:prepare 11 | fi 12 | 13 | exec "${@}" 14 | -------------------------------------------------------------------------------- /db/migrate/20190314110421_create_join_table_service_template_tenant.rb: -------------------------------------------------------------------------------- 1 | class CreateJoinTableServiceTemplateTenant < ActiveRecord::Migration[5.0] 2 | def change 3 | create_table :service_template_tenants do |t| 4 | t.bigint :service_template_id 5 | t.bigint :tenant_id 6 | t.index :service_template_id, :name => 'index_service_template_id' 7 | t.index :tenant_id, :name => 'index_tenant_id' 8 | t.timestamps 9 | end 10 | end 11 | end 12 | -------------------------------------------------------------------------------- /db/migrate/20190514124322_create_firmware_binaries.rb: -------------------------------------------------------------------------------- 1 | class CreateFirmwareBinaries < ActiveRecord::Migration[5.0] 2 | def change 3 | create_table :firmware_binaries do |t| 4 | t.string :name 5 | t.string :external_ref 6 | t.text :description 7 | t.string :version 8 | t.string :type 9 | t.references :firmware_registry, :type => :bigint, :index => true 10 | t.timestamps 11 | end 12 | end 13 | end 14 | -------------------------------------------------------------------------------- /db/migrate/20210330012001_remove_regex_from_settings.rb: -------------------------------------------------------------------------------- 1 | class RemoveRegexFromSettings < ActiveRecord::Migration[6.0] 2 | class SettingsChange < ActiveRecord::Base 3 | serialize :value 4 | end 5 | 6 | def up 7 | say_with_time("Changing regexps in configurations") do 8 | SettingsChange.where("value LIKE ?", "%!ruby/regexp%") 9 | .update_all("value = REGEXP_REPLACE(value, '!ruby/regexp ','','g')") 10 | end 11 | end 12 | end 13 | -------------------------------------------------------------------------------- /db/migrate/20221117080009_create_physical_server_profile_templates.rb: -------------------------------------------------------------------------------- 1 | class CreatePhysicalServerProfileTemplates < ActiveRecord::Migration[6.1] 2 | def change 3 | create_table :physical_server_profile_templates do |t| 4 | t.references :ems, :type => :bigint, :index => true, :references => :ext_management_system 5 | t.string :ems_ref 6 | t.string :name 7 | t.string :type, :index => true 8 | t.timestamps 9 | end 10 | end 11 | end 12 | -------------------------------------------------------------------------------- /spec/dummy/config/database.tmpl.yml: -------------------------------------------------------------------------------- 1 | --- 2 | base: &base 3 | adapter: postgresql 4 | encoding: utf8 5 | username: root 6 | password: smartvm 7 | pool: 5 8 | wait_timeout: 5 9 | min_messages: warning 10 | 11 | development: 12 | <<: *base 13 | database: dummy_development 14 | min_messages: notice 15 | 16 | production: 17 | <<: *base 18 | database: dummy_production 19 | 20 | test: &test 21 | <<: *base 22 | pool: 3 23 | database: dummy_test 24 | -------------------------------------------------------------------------------- /db/migrate/20180917151300_add_limits_to_conversion_host.rb: -------------------------------------------------------------------------------- 1 | class AddLimitsToConversionHost < ActiveRecord::Migration[5.0] 2 | def change 3 | add_column :conversion_hosts, :concurrent_transformation_limit, :string 4 | add_column :conversion_hosts, :cpu_limit, :string 5 | add_column :conversion_hosts, :memory_limit, :string 6 | add_column :conversion_hosts, :network_limit, :string 7 | add_column :conversion_hosts, :blockio_limit, :string 8 | end 9 | end 10 | -------------------------------------------------------------------------------- /db/migrate/20210726194608_delete_rhn_authentications.rb: -------------------------------------------------------------------------------- 1 | class DeleteRhnAuthentications < ActiveRecord::Migration[6.0] 2 | class Authentication < ActiveRecord::Base 3 | self.inheritance_column = :_type_disabled 4 | end 5 | 6 | def up 7 | say_with_time("removing authentication records for Red Hat Network") do 8 | Authentication.where(:authtype => %w[registration registration_http_proxy]) 9 | .destroy_all 10 | end 11 | end 12 | end 13 | -------------------------------------------------------------------------------- /spec/dummy/config/credentials.yml.enc: -------------------------------------------------------------------------------- 1 | RRPGFQ9OwvddsQReKDAp8U4S8h8jCP1ARBleTgK3DVpFefkbtMTu1cmUpgtPoWj0opdc7vYQjSwcIvuGCUbu3eA4KAGfPMneqxuPkQJHvmqAoNAvy1IXqJ1GPNpWtTbQfgjHjlfjIIz1r4UKp78+5g6A27nVbO6qbuve2FQsDVTBOgFFYOByF/9sHr8sClDnTYS4l2G1I99jeawhtKQ90TSFZKAfATahz6J+KlylepjnPnmkdyxPjBUBh4LMuMzwzatAjw/ojZHACy2rFACyPtnFXc999P5bwuf5DFbWwee0xCr6eBNtFh67x1suU9NUTlaKXljWvsGOOQ/FITqwQqMY8NQ7i/cnTNeDdKzmDpzCb4/tgUtikztu8Kuh06+umBZeA238gNrVxPr+0YMarEae/pUj--8e5t1RtcFiUSdw9K--NrIYlUPiixa5lFZD4ffsDQ== -------------------------------------------------------------------------------- /db/migrate/20221116104013_add_capabilities_to_physical_storage_models.rb: -------------------------------------------------------------------------------- 1 | class AddCapabilitiesToPhysicalStorageModels < ActiveRecord::Migration[6.1] 2 | def change 3 | add_column :physical_storage_families, :capabilities, :jsonb, :default => {} 4 | add_column :physical_storages, :capabilities, :jsonb, :default => {} 5 | add_column :storage_resources, :capabilities, :jsonb, :default => {} 6 | add_column :storage_services, :capabilities, :jsonb, :default => {} 7 | end 8 | end 9 | -------------------------------------------------------------------------------- /db/migrate/20190604090631_create_external_urls.rb: -------------------------------------------------------------------------------- 1 | class CreateExternalUrls < ActiveRecord::Migration[5.0] 2 | def change 3 | create_table :external_urls, :id => :bigserial do |t| 4 | t.references :resource, :polymorphic => true, :type => :bigint 5 | t.string :url 6 | t.belongs_to :user, :type => :bigint 7 | end 8 | 9 | add_index "external_urls", [:resource_id, :resource_type], :name => "external_urls_on_resource_id_and_resource_type" 10 | end 11 | end 12 | -------------------------------------------------------------------------------- /db/migrate/20201111154314_create_host_initiators.rb: -------------------------------------------------------------------------------- 1 | class CreateHostInitiators < ActiveRecord::Migration[5.2] 2 | def change 3 | create_table :host_initiators do |t| 4 | t.string :name 5 | t.references :ems, :type => :bigint, :index => true, :references => :ext_management_system 6 | t.string :ems_ref 7 | t.string :uid_ems 8 | t.references :physical_storage, :type => :bigint, :index => true 9 | 10 | t.timestamps 11 | end 12 | end 13 | end 14 | -------------------------------------------------------------------------------- /db/migrate/20210728143006_remove_old_ems_id_from_container_tables.rb: -------------------------------------------------------------------------------- 1 | class RemoveOldEmsIdFromContainerTables < ActiveRecord::Migration[6.0] 2 | def change 3 | remove_column :containers, :old_ems_id, :bigint 4 | remove_column :container_groups, :old_ems_id, :bigint 5 | remove_column :container_images, :old_ems_id, :bigint 6 | remove_column :container_nodes, :old_ems_id, :bigint 7 | remove_column :container_projects, :old_ems_id, :bigint 8 | end 9 | end 10 | -------------------------------------------------------------------------------- /db/migrate/20230322171110_delete_foreman_provisioning_refresh_settings.rb: -------------------------------------------------------------------------------- 1 | class DeleteForemanProvisioningRefreshSettings < ActiveRecord::Migration[6.1] 2 | class SettingsChange < ActiveRecord::Base 3 | include ActiveRecord::IdRegions 4 | end 5 | 6 | def up 7 | say_with_time("Deleting Foreman ProvisioningManager Refresh SettingsChanges") do 8 | SettingsChange.in_my_region.where("key LIKE '/ems_refresh/foreman_provisioning/%'").delete_all 9 | end 10 | end 11 | end 12 | -------------------------------------------------------------------------------- /db/migrate/20200409175736_add_failed_login_attempts_to_users.rb: -------------------------------------------------------------------------------- 1 | class AddFailedLoginAttemptsToUsers < ActiveRecord::Migration[5.1] 2 | class User < ActiveRecord::Base; end 3 | 4 | def up 5 | add_column :users, :failed_login_attempts, :integer 6 | 7 | say_with_time 'Zeroing failed_login_attempts for all users' do 8 | User.update_all(:failed_login_attempts => 0) 9 | end 10 | end 11 | 12 | def down 13 | remove_column :users, :failed_login_attempts 14 | end 15 | end 16 | -------------------------------------------------------------------------------- /spec/dummy/README.md: -------------------------------------------------------------------------------- 1 | # README 2 | 3 | This README would normally document whatever steps are necessary to get the 4 | application up and running. 5 | 6 | Things you may want to cover: 7 | 8 | * Ruby version 9 | 10 | * System dependencies 11 | 12 | * Configuration 13 | 14 | * Database creation 15 | 16 | * Database initialization 17 | 18 | * How to run the test suite 19 | 20 | * Services (job queues, cache servers, search engines, etc.) 21 | 22 | * Deployment instructions 23 | 24 | * ... 25 | -------------------------------------------------------------------------------- /spec/dummy/test/test_helper.rb: -------------------------------------------------------------------------------- 1 | ENV["RAILS_ENV"] ||= "test" 2 | require_relative "../config/environment" 3 | require "rails/test_help" 4 | 5 | module ActiveSupport 6 | class TestCase 7 | # Run tests in parallel with specified workers 8 | parallelize(workers: :number_of_processors) 9 | 10 | # Setup all fixtures in test/fixtures/*.yml for all tests in alphabetical order. 11 | fixtures :all 12 | 13 | # Add more helper methods to be used by all tests here... 14 | end 15 | end 16 | -------------------------------------------------------------------------------- /db/migrate/20180817212259_add_api_version_and_domain_id_and_security_protocol_and_openstack_region_to_file_depot.rb: -------------------------------------------------------------------------------- 1 | class AddApiVersionAndDomainIdAndSecurityProtocolAndOpenstackRegionToFileDepot < ActiveRecord::Migration[5.0] 2 | def change 3 | add_column :file_depots, :keystone_api_version, :string 4 | add_column :file_depots, :v3_domain_ident, :string 5 | add_column :file_depots, :security_protocol, :string 6 | add_column :file_depots, :openstack_region, :string 7 | end 8 | end 9 | -------------------------------------------------------------------------------- /db/migrate/20200521150213_create_storage_services.rb: -------------------------------------------------------------------------------- 1 | class CreateStorageServices < ActiveRecord::Migration[5.2] 2 | def change 3 | create_table :storage_services do |t| 4 | t.string :name 5 | t.string :description 6 | t.bigint :version 7 | t.references :ems, :type => :bigint, :index => true, :references => :ext_management_system 8 | t.string :ems_ref 9 | t.string :uid_ems 10 | t.string :type 11 | 12 | t.timestamps 13 | end 14 | end 15 | end 16 | -------------------------------------------------------------------------------- /db/migrate/20210925144400_create_wwpn_candidates.rb: -------------------------------------------------------------------------------- 1 | class CreateWwpnCandidates < ActiveRecord::Migration[6.0] 2 | def change 3 | create_table :wwpn_candidates do |t| 4 | # stores WWPN candidate 5 | t.string :candidate 6 | 7 | t.string :ems_ref 8 | t.references :ems, :type => :bigint, :index => true, :references => :ext_management_system 9 | t.references :physical_storage, :type => :bigint, :index => true 10 | 11 | t.timestamps 12 | end 13 | end 14 | end 15 | -------------------------------------------------------------------------------- /lib/manageiq/schema/command_recorder.rb: -------------------------------------------------------------------------------- 1 | module ManageIQ 2 | module Schema 3 | module CommandRecorder 4 | def add_trigger(*args) 5 | record(:add_trigger, args) 6 | end 7 | 8 | def drop_trigger(*args) 9 | record(:drop_trigger, args) 10 | end 11 | 12 | def create_view(*args) 13 | record(:create_view, args) 14 | end 15 | 16 | def drop_view(*args) 17 | record(:drop_view, args) 18 | end 19 | end 20 | end 21 | end 22 | -------------------------------------------------------------------------------- /spec/automated_review/column_documentation_spec.rb: -------------------------------------------------------------------------------- 1 | describe "Column documentation" do 2 | # Documented tables 3 | %w[miq_tasks].each do |table_name| 4 | it "#{table_name} columns are documented" do 5 | klass = Class.new(ActiveRecord::Base) do 6 | self.table_name = table_name 7 | end 8 | 9 | klass.columns.each do |column| 10 | expect(column.comment).not_to be_nil, "#{table_name}##{column.name} is not documented." 11 | end 12 | end 13 | end 14 | end 15 | -------------------------------------------------------------------------------- /db/migrate/20190531161732_add_guid_to_miq_databases.rb: -------------------------------------------------------------------------------- 1 | class AddGuidToMiqDatabases < ActiveRecord::Migration[5.0] 2 | class MiqDatabase < ActiveRecord::Base 3 | end 4 | 5 | def up 6 | add_column :miq_databases, :guid, :string, :limit => 36 7 | 8 | say_with_time("Create default guids for miq_databases") do 9 | MiqDatabase.all.each { |d| d.update!(:guid => SecureRandom.uuid) } 10 | end 11 | end 12 | 13 | def down 14 | remove_column :miq_databases, :guid 15 | end 16 | end 17 | -------------------------------------------------------------------------------- /db/migrate/20191023180149_add_ems_ref_type.rb: -------------------------------------------------------------------------------- 1 | class AddEmsRefType < ActiveRecord::Migration[5.1] 2 | def change 3 | add_column :ems_clusters, :ems_ref_type, :string 4 | add_column :ems_folders, :ems_ref_type, :string 5 | add_column :hosts, :ems_ref_type, :string 6 | add_column :resource_pools, :ems_ref_type, :string 7 | add_column :snapshots, :ems_ref_type, :string 8 | add_column :storages, :ems_ref_type, :string 9 | add_column :vms, :ems_ref_type, :string 10 | end 11 | end 12 | -------------------------------------------------------------------------------- /lib/manageiq/schema/migrate_with_cleared_schema_cache.rb: -------------------------------------------------------------------------------- 1 | module ManageIQ 2 | module Schema 3 | module MigrateWithClearedSchemaCache 4 | def migrate(*args) 5 | clearing_caches do 6 | super 7 | end 8 | end 9 | 10 | private 11 | 12 | def clear_caches 13 | ActiveRecord::Base.connection.schema_cache.clear! 14 | end 15 | 16 | def clearing_caches 17 | clear_caches 18 | yield 19 | end 20 | end 21 | end 22 | end 23 | -------------------------------------------------------------------------------- /spec/migrations/20200519213913_change_hardware_mem_types_spec.rb: -------------------------------------------------------------------------------- 1 | require_migration 2 | 3 | describe ChangeHardwareMemTypes do 4 | migration_context :down do 5 | let(:hardware) { migration_stub(:Hardware).create(:memory_mb => 2_147_483_648) } 6 | 7 | it "caps > 2147483647" do 8 | expect(hardware.memory_mb).to eq(2_147_483_648) 9 | 10 | migrate 11 | hardware.reload 12 | 13 | expect(hardware).to have_attributes(:memory_mb => 2_147_483_647) 14 | end 15 | end 16 | end 17 | -------------------------------------------------------------------------------- /db/migrate/20180719162710_add_owner_and_group_to_auth.rb: -------------------------------------------------------------------------------- 1 | class AddOwnerAndGroupToAuth < ActiveRecord::Migration[5.0] 2 | def up 3 | add_column :authentications, :evm_owner_id, :bigint 4 | add_column :authentications, :miq_group_id, :bigint 5 | add_column :authentications, :tenant_id, :bigint 6 | end 7 | 8 | def down 9 | remove_column :authentications, :evm_owner_id 10 | remove_column :authentications, :miq_group_id 11 | remove_column :authentications, :tenant_id 12 | end 13 | end 14 | -------------------------------------------------------------------------------- /db/migrate/20200519213913_change_hardware_mem_types.rb: -------------------------------------------------------------------------------- 1 | class ChangeHardwareMemTypes < ActiveRecord::Migration[5.2] 2 | class Hardware < ActiveRecord::Base 3 | end 4 | 5 | def up 6 | change_column :hardwares, :memory_mb, :bigint 7 | end 8 | 9 | def down 10 | say_with_time "clamp oversized memory_mb values" do 11 | Hardware.where("memory_mb > 2147483647").update_all(:memory_mb => 2_147_483_647) 12 | end 13 | 14 | change_column :hardwares, :memory_mb, :integer 15 | end 16 | end 17 | -------------------------------------------------------------------------------- /spec/migrations/20190712135032_set_provisioned_state_to_services_spec.rb: -------------------------------------------------------------------------------- 1 | require_migration 2 | 3 | describe SetProvisionedStateToServices do 4 | let(:service) { migration_stub(:Service) } 5 | 6 | migration_context :up do 7 | it "sets lifecycle state" do 8 | obj1 = service.create!(:lifecycle_state => nil) 9 | 10 | expect(obj1.reload.lifecycle_state).to eq(nil) 11 | 12 | migrate 13 | 14 | expect(obj1.reload.lifecycle_state).to eq('provisioned') 15 | end 16 | end 17 | end 18 | -------------------------------------------------------------------------------- /db/migrate/20180807152553_drop_vim_performance_tag_values.rb: -------------------------------------------------------------------------------- 1 | class DropVimPerformanceTagValues < ActiveRecord::Migration[5.0] 2 | def change 3 | drop_table :vim_performance_tag_values do |t| 4 | t.string :association_type 5 | t.string :category 6 | t.string :tag_name 7 | t.string :column_name 8 | t.float :value 9 | t.text :assoc_ids 10 | t.bigint :metric_id 11 | t.string :metric_type 12 | t.index [:metric_id, :metric_type] 13 | end 14 | end 15 | end 16 | -------------------------------------------------------------------------------- /db/migrate/20171213223553_move_ems_refresh_openstack_settings.rb: -------------------------------------------------------------------------------- 1 | class MoveEmsRefreshOpenstackSettings < ActiveRecord::Migration[5.0] 2 | class SettingsChange < ActiveRecord::Base 3 | end 4 | 5 | def up 6 | say_with_time('Move ems_refresh Openstack provider refresher settings under the root') do 7 | SettingsChange.where('key LIKE ?', '/ems/ems_refresh/openstack%').each do |s| 8 | s.key = s.key.sub('/ems/ems_refresh', '/ems_refresh') 9 | s.save! 10 | end 11 | end 12 | end 13 | end 14 | -------------------------------------------------------------------------------- /db/migrate/20190712135032_set_provisioned_state_to_services.rb: -------------------------------------------------------------------------------- 1 | class SetProvisionedStateToServices < ActiveRecord::Migration[5.1] 2 | class Service < ActiveRecord::Base 3 | include ActiveRecord::IdRegions 4 | self.inheritance_column = :_type_disabled # disable STI 5 | end 6 | 7 | def up 8 | say_with_time("Update service lifecycle state values") do 9 | Service.in_my_region.where(:lifecycle_state => nil, :retired => nil).update_all(:lifecycle_state => 'provisioned') 10 | end 11 | end 12 | end 13 | -------------------------------------------------------------------------------- /db/migrate/20191113200451_remove_ems_ref_obj.rb: -------------------------------------------------------------------------------- 1 | class RemoveEmsRefObj < ActiveRecord::Migration[5.1] 2 | def change 3 | remove_column :ems_clusters, :ems_ref_obj, :string 4 | remove_column :ems_folders, :ems_ref_obj, :string 5 | remove_column :hosts, :ems_ref_obj, :string 6 | remove_column :resource_pools, :ems_ref_obj, :string 7 | remove_column :snapshots, :ems_ref_obj, :string 8 | remove_column :storages, :ems_ref_obj, :string 9 | remove_column :vms, :ems_ref_obj, :string 10 | end 11 | end 12 | -------------------------------------------------------------------------------- /db/migrate/20230407170430_add_payload_credentials_configuration_scripts.rb: -------------------------------------------------------------------------------- 1 | class AddPayloadCredentialsConfigurationScripts < ActiveRecord::Migration[6.1] 2 | def change 3 | change_table :configuration_scripts do |t| 4 | t.string :run_by_userid 5 | t.string :payload 6 | t.string :payload_type 7 | t.jsonb :credentials 8 | t.jsonb :context 9 | t.jsonb :output 10 | t.string :status 11 | t.references :miq_task 12 | end 13 | end 14 | end 15 | -------------------------------------------------------------------------------- /db/migrate/20181119154009_set_vm_connection_state.rb: -------------------------------------------------------------------------------- 1 | class SetVmConnectionState < ActiveRecord::Migration[4.2] 2 | class VmOrTemplate < ActiveRecord::Base 3 | include ActiveRecord::IdRegions 4 | 5 | self.inheritance_column = :_type_disabled 6 | self.table_name = 'vms' 7 | end 8 | 9 | def up 10 | say_with_time('Filling nil connection_state to "connected"') do 11 | VmOrTemplate.in_my_region.where(:connection_state => nil).update_all(:connection_state => 'connected') 12 | end 13 | end 14 | end 15 | -------------------------------------------------------------------------------- /db/migrate/20190528161746_add_ems_extensions.rb: -------------------------------------------------------------------------------- 1 | class AddEmsExtensions < ActiveRecord::Migration[5.0] 2 | def change 3 | create_table :ems_extensions, :id => :bigserial, :force => :cascade do |t| 4 | t.references :ems, :type => :bigint, :index => true, :references => :ext_management_system 5 | 6 | t.string :ems_ref 7 | t.string :key 8 | t.string :company 9 | t.string :label 10 | t.string :summary 11 | t.string :version 12 | 13 | t.timestamps 14 | end 15 | end 16 | end 17 | -------------------------------------------------------------------------------- /spec/dummy/app/views/pwa/manifest.json.erb: -------------------------------------------------------------------------------- 1 | { 2 | "name": "Dummy", 3 | "icons": [ 4 | { 5 | "src": "/icon.png", 6 | "type": "image/png", 7 | "sizes": "512x512" 8 | }, 9 | { 10 | "src": "/icon.png", 11 | "type": "image/png", 12 | "sizes": "512x512", 13 | "purpose": "maskable" 14 | } 15 | ], 16 | "start_url": "/", 17 | "display": "standalone", 18 | "scope": "/", 19 | "description": "Dummy.", 20 | "theme_color": "red", 21 | "background_color": "red" 22 | } 23 | -------------------------------------------------------------------------------- /spec/dummy/config/initializers/filter_parameter_logging.rb: -------------------------------------------------------------------------------- 1 | # Be sure to restart your server when you modify this file. 2 | 3 | # Configure parameters to be partially matched (e.g. passw matches password) and filtered from the log file. 4 | # Use this to limit dissemination of sensitive information. 5 | # See the ActiveSupport::ParameterFilter documentation for supported notations and behaviors. 6 | Rails.application.config.filter_parameters += [ 7 | :passw, :email, :secret, :token, :_key, :crypt, :salt, :certificate, :otp, :ssn 8 | ] 9 | -------------------------------------------------------------------------------- /db/migrate/20180118131417_change_container_quota_items_to_decimals.rb: -------------------------------------------------------------------------------- 1 | class ChangeContainerQuotaItemsToDecimals < ActiveRecord::Migration[5.0] 2 | def up 3 | %i(quota_desired quota_enforced quota_observed).each do |column| 4 | change_column :container_quota_items, column, :decimal, :scale => 3, :precision => 30 5 | end 6 | end 7 | 8 | def down 9 | %i(quota_desired quota_enforced quota_observed).each do |column| 10 | change_column :container_quota_items, column, :float 11 | end 12 | end 13 | end 14 | -------------------------------------------------------------------------------- /db/migrate/20190517093516_create_firmware_binary_firmware_targets.rb: -------------------------------------------------------------------------------- 1 | class CreateFirmwareBinaryFirmwareTargets < ActiveRecord::Migration[5.0] 2 | def change 3 | create_table :firmware_binaries_firmware_targets do |t| 4 | t.references :firmware_binary, :type => :bigint, :index => false 5 | t.references :firmware_target, :type => :bigint, :index => false 6 | 7 | t.index %i[firmware_binary_id firmware_target_id], :unique => true, :name => :index_firmware_binaries_firmware_targets 8 | end 9 | end 10 | end 11 | -------------------------------------------------------------------------------- /db/migrate/20210810114405_create_host_initiator_groups.rb: -------------------------------------------------------------------------------- 1 | class CreateHostInitiatorGroups < ActiveRecord::Migration[6.0] 2 | def change 3 | create_table :host_initiator_groups do |t| 4 | t.references :ems, :type => :bigint, :index => true, :references => :ext_management_system 5 | t.references :physical_storage, :type => :bigint, :index => true 6 | 7 | t.string :name 8 | t.string :status 9 | t.string :ems_ref 10 | t.string :uid_ems 11 | 12 | t.timestamps 13 | end 14 | end 15 | end 16 | -------------------------------------------------------------------------------- /db/migrate/20190228210310_service_templates_should_have_names.rb: -------------------------------------------------------------------------------- 1 | class ServiceTemplatesShouldHaveNames < ActiveRecord::Migration[5.0] 2 | class ServiceTemplate < ActiveRecord::Base 3 | include ActiveRecord::IdRegions 4 | self.inheritance_column = :_type_disabled # disable STI 5 | end 6 | 7 | def up 8 | say_with_time("Checking service templates for names") do 9 | ServiceTemplate.in_my_region.where(:name => [nil, ""]).each { |t| t.update!(:name => "ServiceTemplate" + SecureRandom.uuid) } 10 | end 11 | end 12 | end 13 | -------------------------------------------------------------------------------- /db/migrate/20240214165402_remove_openstack_network_manager_metrics_collector_workers.rb: -------------------------------------------------------------------------------- 1 | class RemoveOpenstackNetworkManagerMetricsCollectorWorkers < ActiveRecord::Migration[6.1] 2 | class MiqWorker < ActiveRecord::Base 3 | self.inheritance_column = :_type_disabled 4 | end 5 | 6 | def up 7 | say_with_time("Deleting all Openstack NetworkManager MetricsCollectorWorker records") do 8 | MiqWorker.where(:type => "ManageIQ::Providers::Openstack::NetworkManager::MetricsCollectorWorker").delete_all 9 | end 10 | end 11 | end 12 | -------------------------------------------------------------------------------- /spec/dummy/db/seeds.rb: -------------------------------------------------------------------------------- 1 | # This file should ensure the existence of records required to run the application in every environment (production, 2 | # development, test). The code here should be idempotent so that it can be executed at any point in every environment. 3 | # The data can then be loaded with the bin/rails db:seed command (or created alongside the database with db:setup). 4 | # 5 | # Example: 6 | # 7 | # ["Action", "Comedy", "Drama", "Horror"].each do |genre_name| 8 | # MovieGenre.find_or_create_by!(name: genre_name) 9 | # end 10 | -------------------------------------------------------------------------------- /db/migrate/20190304192641_add_provider_guids.rb: -------------------------------------------------------------------------------- 1 | class AddProviderGuids < ActiveRecord::Migration[5.0] 2 | class Provider < ActiveRecord::Base 3 | include ActiveRecord::IdRegions 4 | validates :guid, :uniqueness => true 5 | self.inheritance_column = :_type_disabled # disable STI 6 | end 7 | 8 | def up 9 | say_with_time("Update provider guid values") do 10 | Provider.in_my_region.where(:guid => nil).each do |provider| 11 | provider.update!(:guid => SecureRandom.uuid) 12 | end 13 | end 14 | end 15 | end 16 | -------------------------------------------------------------------------------- /db/migrate/20190301174502_remove_rss_feeds.rb: -------------------------------------------------------------------------------- 1 | class RemoveRssFeeds < ActiveRecord::Migration[5.0] 2 | def up 3 | drop_table :rss_feeds 4 | end 5 | 6 | def down 7 | create_table "rss_feeds" do |t| 8 | t.string "name" 9 | t.text "title" 10 | t.text "link" 11 | t.text "description" 12 | t.datetime "created_on" 13 | t.datetime "updated_on" 14 | t.datetime "yml_file_mtime" 15 | end 16 | 17 | add_index "rss_feeds", ["name"], :name => "index_rss_feeds_on_name" 18 | end 19 | end 20 | -------------------------------------------------------------------------------- /db/migrate/20190528160313_add_ems_licenses.rb: -------------------------------------------------------------------------------- 1 | class AddEmsLicenses < ActiveRecord::Migration[5.0] 2 | def change 3 | create_table :ems_licenses, :id => :bigserial, :force => :cascade do |t| 4 | t.references :ems, :type => :bigint, :index => true, :references => :ext_management_system 5 | 6 | t.string :ems_ref 7 | t.string :name 8 | t.string :license_key 9 | t.string :license_edition 10 | t.integer :total_licenses 11 | t.integer :used_licenses 12 | 13 | t.timestamps 14 | end 15 | end 16 | end 17 | -------------------------------------------------------------------------------- /spec/migrations/20200409175736_add_failed_login_attempts_to_users_spec.rb: -------------------------------------------------------------------------------- 1 | require_migration 2 | 3 | describe AddFailedLoginAttemptsToUsers do 4 | let(:user_stub) { migration_stub(:User) } 5 | let(:user) { user_stub.create(:name => 'test', :userid => 'test') } 6 | 7 | migration_context :up do 8 | it 'creates a new field which defaults to 0' do 9 | expect(user).to_not respond_to(:failed_login_attempts) 10 | 11 | migrate 12 | user.reload 13 | 14 | expect(user.failed_login_attempts).to eq(0) 15 | end 16 | end 17 | end 18 | -------------------------------------------------------------------------------- /db/migrate/20180726142030_create_physical_disk.rb: -------------------------------------------------------------------------------- 1 | class CreatePhysicalDisk < ActiveRecord::Migration[5.0] 2 | def change 3 | create_table :physical_disks do |t| 4 | t.string :model 5 | t.string :vendor 6 | t.string :status 7 | t.string :location 8 | t.index :location 9 | t.string :serial_number 10 | t.string :health_state 11 | t.string :type 12 | t.string :disk_size 13 | t.bigint :physical_storage_id 14 | t.index :physical_storage_id 15 | t.timestamps 16 | end 17 | end 18 | end 19 | -------------------------------------------------------------------------------- /db/migrate/20181203224640_remove_renamed_ansible_tower_configuration_manager_refresh_worker_rows.rb: -------------------------------------------------------------------------------- 1 | class RemoveRenamedAnsibleTowerConfigurationManagerRefreshWorkerRows < ActiveRecord::Migration[5.0] 2 | class MiqWorker < ActiveRecord::Base 3 | self.inheritance_column = :_type_disabled 4 | end 5 | 6 | def up 7 | # Was renamed to ManageIQ::Providers::AnsibleTower::AutomationManager::RefreshWorker in 2f0ef1a90758f2 8 | MiqWorker.where(:type => "ManageIQ::Providers::AnsibleTower::ConfigurationManager::RefreshWorker").delete_all 9 | end 10 | end 11 | -------------------------------------------------------------------------------- /spec/automated_review/empty_database_spec.rb: -------------------------------------------------------------------------------- 1 | describe "Empty Database" do 2 | it "after migrated remains empty" do 3 | counts = ActiveRecord::Base.connection.tables.each_with_object([]) do |t, array| 4 | next if ManageIQ::Schema::SYSTEM_TABLES.include?(t) 5 | count = ActiveRecord::Base.connection.execute("SELECT COUNT(*) FROM #{t};").getvalue(0, 0) 6 | array << "#{t}: #{count}" if count.positive? 7 | end 8 | 9 | expect(counts.size).to eq(0), "Records were found in the following tables:\n#{counts.join("\n")}" 10 | end 11 | end 12 | -------------------------------------------------------------------------------- /spec/migrations/20200103191549_remove_miq_vim_broker_worker_rows_spec.rb: -------------------------------------------------------------------------------- 1 | require_migration 2 | 3 | describe RemoveMiqVimBrokerWorkerRows do 4 | migration_context :up do 5 | let(:miq_worker) { migration_stub(:MiqWorker) } 6 | 7 | it "deletes MiqVimBrokerWorker workers" do 8 | miq_worker.create!(:type => "MiqWorker") 9 | miq_worker.create!(:type => "MiqVimBrokerWorker") 10 | 11 | migrate 12 | 13 | expect(miq_worker.count).to eq(1) 14 | expect(miq_worker.first.type).to eq("MiqWorker") 15 | end 16 | end 17 | end 18 | -------------------------------------------------------------------------------- /db/migrate/20171219151634_create_transformation_mapping_items.rb: -------------------------------------------------------------------------------- 1 | class CreateTransformationMappingItems < ActiveRecord::Migration[5.0] 2 | def change 3 | create_table :transformation_mapping_items do |t| 4 | t.bigint :source_id 5 | t.string :source_type 6 | t.bigint :destination_id 7 | t.string :destination_type 8 | t.bigint :transformation_mapping_id 9 | t.jsonb :options, :default => {} 10 | t.timestamps 11 | end 12 | 13 | add_index :transformation_mapping_items, :transformation_mapping_id 14 | end 15 | end 16 | -------------------------------------------------------------------------------- /db/migrate/20201220133400_create_volume_mappings.rb: -------------------------------------------------------------------------------- 1 | class CreateVolumeMappings < ActiveRecord::Migration[5.2] 2 | def change 3 | create_table :volume_mappings do |t| 4 | t.references :ems, :type => :bigint, :index => true, :references => :ext_management_system 5 | t.references :cloud_volume, :type => :bigint, :index => true 6 | t.references :host_initiator, :type => :bigint, :index => true 7 | 8 | t.string :ems_ref 9 | t.string :uid_ems 10 | 11 | t.integer :lun 12 | 13 | t.timestamps 14 | end 15 | end 16 | end 17 | -------------------------------------------------------------------------------- /db/migrate/20210118185402_subclass_cinder_manager_openstack.rb: -------------------------------------------------------------------------------- 1 | class SubclassCinderManagerOpenstack < ActiveRecord::Migration[6.0] 2 | class ExtManagementSystem < ActiveRecord::Base 3 | self.inheritance_column = :_type_disabled 4 | end 5 | 6 | def up 7 | say_with_time("Subclass CinderManager under Openstack") do 8 | ExtManagementSystem.where(:type => "ManageIQ::Providers::StorageManager::CinderManager") 9 | .update_all(:type => "ManageIQ::Providers::Openstack::StorageManager::CinderManager") 10 | end 11 | end 12 | end 13 | -------------------------------------------------------------------------------- /lib/migration_stub_helper.rb: -------------------------------------------------------------------------------- 1 | # NOTE: If included, this must be included AFTER any autoloaded modules since it 2 | # modifies included.name. Rails autoload will not be able to detect 3 | # the other modules if included before them. 4 | # 5 | 6 | module MigrationStubHelper 7 | extend ActiveSupport::Concern 8 | included do 9 | # Fixes issues where reflections in stubs will use the class name in the 10 | # query, which is unexpectedly namespaced. 11 | def self.name 12 | super.split("::")[1..-1].join("::") 13 | end 14 | end 15 | end 16 | -------------------------------------------------------------------------------- /db/migrate/20190108163812_remove_cinder_manager_event_worker_rows.rb: -------------------------------------------------------------------------------- 1 | class RemoveCinderManagerEventWorkerRows < ActiveRecord::Migration[5.0] 2 | class MiqWorker < ActiveRecord::Base 3 | self.inheritance_column = :_type_disabled 4 | end 5 | 6 | def up 7 | # ManageIQ::Providers::StorageManager::CinderManager::EventCatcher was removed in 772bdc283360e99f9cf2209184297d1827f3a9e6 8 | # https://github.com/ManageIQ/manageiq/pull/14962 9 | MiqWorker.where(:type => "ManageIQ::Providers::StorageManager::CinderManager::EventCatcher").delete_all 10 | end 11 | end 12 | -------------------------------------------------------------------------------- /db/migrate/20230919143746_remove_vim_strings_from_miq_queue.rb: -------------------------------------------------------------------------------- 1 | class RemoveVimStringsFromMiqQueue < ActiveRecord::Migration[6.1] 2 | disable_ddl_transaction! 3 | include MigrationHelper 4 | 5 | class MiqQueue < ActiveRecord::Base 6 | end 7 | 8 | def up 9 | regex_replace_column_value(MiqQueue, 'args', '!ruby/string:VimString', '!ruby/string:String') 10 | regex_replace_column_value(MiqQueue, 'args', '!ruby/hash-with-ivars:VimHash', '!ruby/hash-with-ivars:Hash') 11 | end 12 | 13 | # this is very old, not rolling back 14 | def down 15 | end 16 | end 17 | -------------------------------------------------------------------------------- /spec/dummy/config/initializers/permissions_policy.rb: -------------------------------------------------------------------------------- 1 | # Be sure to restart your server when you modify this file. 2 | 3 | # Define an application-wide HTTP permissions policy. For further 4 | # information see: https://developers.google.com/web/updates/2018/06/feature-policy 5 | 6 | # Rails.application.config.permissions_policy do |policy| 7 | # policy.camera :none 8 | # policy.gyroscope :none 9 | # policy.microphone :none 10 | # policy.usb :none 11 | # policy.fullscreen :self 12 | # policy.payment :self, "https://secure.example.com" 13 | # end 14 | -------------------------------------------------------------------------------- /db/migrate/20200122215829_upgrade_dropbox_to_support_tool.rb: -------------------------------------------------------------------------------- 1 | class UpgradeDropboxToSupportTool < ActiveRecord::Migration[5.1] 2 | class FileDepot < ActiveRecord::Base 3 | self.inheritance_column = :_type_disabled # disable STI 4 | end 5 | 6 | def change 7 | # update_all is used here to avoid instantiating a possibly undefined class 8 | FileDepot.where(:type => "FileDepotFtpAnonymousRedhatDropbox").update_all( 9 | :type => "FileDepotRedhatSupport", 10 | :name => "Red Hat Support", 11 | :uri => "support://redhat.com" 12 | ) 13 | end 14 | end 15 | -------------------------------------------------------------------------------- /db/migrate/20180319113755_add_product_details_columns_to_asset_details.rb: -------------------------------------------------------------------------------- 1 | class AddProductDetailsColumnsToAssetDetails < ActiveRecord::Migration[5.0] 2 | def change 3 | add_column :asset_details, :product_name, :string 4 | add_column :asset_details, :manufacturer, :string 5 | add_column :asset_details, :machine_type, :string 6 | add_column :asset_details, :model, :string 7 | add_column :asset_details, :serial_number, :string 8 | add_column :asset_details, :field_replaceable_unit, :string 9 | end 10 | end 11 | -------------------------------------------------------------------------------- /db/migrate/20181002192054_fix_conversion_host_resource_type.rb: -------------------------------------------------------------------------------- 1 | class FixConversionHostResourceType < ActiveRecord::Migration[5.0] 2 | class ConversionHost < ActiveRecord::Base 3 | self.inheritance_column = :_type_disabled 4 | include ActiveRecord::IdRegions 5 | end 6 | 7 | def up 8 | say_with_time("Converting invalid resource_type to Host") do 9 | ConversionHost.in_my_region 10 | .where(:resource_type => "AddConversionHostIdToMiqRequestTasks::Host") 11 | .update_all(:resource_type => "Host") 12 | end 13 | end 14 | end 15 | -------------------------------------------------------------------------------- /db/migrate/20200519141015_create_storage_resources.rb: -------------------------------------------------------------------------------- 1 | class CreateStorageResources < ActiveRecord::Migration[5.2] 2 | def change 3 | create_table :storage_resources do |t| 4 | t.string :name 5 | t.references :ems, :type => :bigint, :index => true, :references => :ext_management_system 6 | t.string :ems_ref 7 | t.string :uid_ems 8 | t.bigint :logical_free 9 | t.bigint :logical_total 10 | t.references :physical_storage, :type => :bigint, :index => true 11 | t.string :type 12 | 13 | t.timestamps 14 | end 15 | end 16 | end 17 | -------------------------------------------------------------------------------- /db/migrate/20201124063738_create_san_addresses.rb: -------------------------------------------------------------------------------- 1 | class CreateSanAddresses < ActiveRecord::Migration[5.2] 2 | def change 3 | create_table :san_addresses do |t| 4 | t.references :ems, :type => :bigint, :index => true, :references => :ext_management_system 5 | t.string :ems_ref 6 | t.belongs_to :owner, :polymorphic => true, :type => :bigint 7 | t.string :iqn 8 | t.string :chap_name 9 | t.string :chap_secret 10 | t.string :wwpn 11 | t.string :wwnn 12 | t.string :type 13 | 14 | t.timestamps 15 | end 16 | end 17 | end 18 | -------------------------------------------------------------------------------- /spec/migrations/20180112171348_drop_unnecessary_blob_parts_md5_spec.rb: -------------------------------------------------------------------------------- 1 | require_migration 2 | 3 | describe DropUnnecessaryBlobPartsMd5 do 4 | let(:binary_blob_part_stub) { migration_stub :BinaryBlobPart } 5 | 6 | migration_context :down do 7 | it "restores the md5 sum and size of all records" do 8 | binary_blob_part_stub.create!(:data => "A test string") 9 | 10 | migrate 11 | 12 | expect(binary_blob_part_stub.first).to have_attributes( 13 | :md5 => "99ce4dbdc6db1ab876443113ae24b816", 14 | :size => 13, 15 | ) 16 | end 17 | end 18 | end 19 | -------------------------------------------------------------------------------- /db/migrate/20191002103406_remove_quadicon_settings.rb: -------------------------------------------------------------------------------- 1 | class RemoveQuadiconSettings < ActiveRecord::Migration[5.0] 2 | class User < ActiveRecord::Base 3 | serialize :settings, :type => Hash 4 | end 5 | 6 | def up 7 | say_with_time("Dropping quadicon settings keys from user settings") do 8 | User.where("settings like '%quadicons%'").each do |user| 9 | settings = user.settings 10 | 11 | next unless settings[:quadicons] 12 | 13 | settings.delete(:quadicons) 14 | user.update!(:settings => settings) 15 | end 16 | end 17 | end 18 | end 19 | -------------------------------------------------------------------------------- /db/migrate/20221107195559_drop_iso_datastore.rb: -------------------------------------------------------------------------------- 1 | class DropIsoDatastore < ActiveRecord::Migration[6.1] 2 | def up 3 | say_with_time("Drop IsoDatastore table") do 4 | remove_reference :iso_images, :iso_datastore 5 | drop_table :iso_datastores 6 | end 7 | end 8 | 9 | def down 10 | say_with_time("Create IsoDatastore table") do 11 | create_table :iso_datastores, :force => :cascade do |t| 12 | t.bigint :ems_id 13 | t.datetime :last_refresh_on 14 | end 15 | 16 | add_reference :iso_images, :iso_datastore 17 | end 18 | end 19 | end 20 | -------------------------------------------------------------------------------- /spec/support/database_helper.rb: -------------------------------------------------------------------------------- 1 | module DatabaseHelper 2 | def self.columns_for_table(table_name) 3 | ActiveRecord::Base.connection.data_source_exists?(table_name) ? ActiveRecord::Base.connection.columns(table_name).sort_by(&:name) : [] 4 | end 5 | 6 | def self.indexes_for_table(table_name) 7 | ActiveRecord::Base.connection.data_source_exists?(table_name) ? ActiveRecord::Base.connection.indexes(table_name).sort_by(&:name) : [] 8 | end 9 | 10 | def self.table_has_type_column?(table_name) 11 | columns_for_table(table_name).detect { |i| i.name == "type" } 12 | end 13 | end 14 | -------------------------------------------------------------------------------- /db/migrate/20220909190221_drop_cockpit_role.rb: -------------------------------------------------------------------------------- 1 | class DropCockpitRole < ActiveRecord::Migration[6.0] 2 | class SettingsChange < ActiveRecord::Base; end 3 | 4 | def up 5 | say_with_time("Deleting cockpit role configuration") do 6 | SettingsChange.where("key = '/server/role' AND value LIKE '%ws_cockpit%'").select('id', 'value').each do |row| 7 | if row.value == 'ws_cockpit' 8 | row.delete 9 | else 10 | row.update(:value => row.value.split(',').tap { |a| a.delete("ws_cockpit") }.join(',')) 11 | end 12 | end 13 | end 14 | end 15 | end 16 | -------------------------------------------------------------------------------- /db/migrate/20180426163655_create_physical_storage.rb: -------------------------------------------------------------------------------- 1 | class CreatePhysicalStorage < ActiveRecord::Migration[5.0] 2 | def change 3 | create_table :physical_storages do |t| 4 | t.string :ems_ref 5 | t.string :uid_ems 6 | t.string :name 7 | t.string :type 8 | t.string :access_state 9 | t.string :health_state 10 | t.string :overall_health_state 11 | t.bigint :ems_id 12 | t.bigint :physical_rack_id 13 | t.integer :drive_bays 14 | t.integer :enclosures 15 | t.integer :canister_slots 16 | t.timestamps 17 | end 18 | end 19 | end 20 | -------------------------------------------------------------------------------- /db/migrate/20191017211747_add_general_indexes.rb: -------------------------------------------------------------------------------- 1 | class AddGeneralIndexes < ActiveRecord::Migration[5.1] 2 | def change 3 | add_index :miq_schedules, :updated_at 4 | add_index :blacklisted_events, [:ems_id, :enabled] 5 | add_index :key_pairs_vms, :vm_id 6 | add_index :miq_requests, [:tenant_id, :approval_state] 7 | add_index :miq_roles_features, :miq_user_role_id 8 | add_index :miq_queue, [:state, :handler_type, :handler_id] 9 | add_index :vms, :tenant_id 10 | add_index :entitlements, :miq_group_id 11 | add_index :endpoints, [:resource_id, :resource_type] 12 | end 13 | end 14 | -------------------------------------------------------------------------------- /db/migrate/20200427122455_remove_vim_strings_from_notifications.rb: -------------------------------------------------------------------------------- 1 | class RemoveVimStringsFromNotifications < ActiveRecord::Migration[5.1] 2 | disable_ddl_transaction! 3 | include MigrationHelper 4 | 5 | class Notification < ActiveRecord::Base 6 | include ActiveRecord::IdRegions 7 | end 8 | 9 | def up 10 | regex_replace_column_value(Notification.in_my_region, 'options', '!ruby/string:VimString', '!ruby/string:String') 11 | end 12 | 13 | def down 14 | regex_replace_column_value(Notification.in_my_region, 'options', '!ruby/string:String', '!ruby/string:VimString') 15 | end 16 | end 17 | -------------------------------------------------------------------------------- /spec/migrations/20190912152014_remove_embedded_ansible_workers_spec.rb: -------------------------------------------------------------------------------- 1 | require_migration 2 | 3 | describe RemoveEmbeddedAnsibleWorkers do 4 | migration_context :up do 5 | let(:worker_stub) { migration_stub(:MiqWorker) } 6 | 7 | it "Removes rows where the model was deleted" do 8 | worker_stub.create!(:type => "EmbeddedAnsibleWorker") 9 | not_orphaned = worker_stub.create! 10 | 11 | expect(worker_stub.count).to eql 2 12 | 13 | migrate 14 | 15 | expect(worker_stub.first).to eql not_orphaned 16 | expect(worker_stub.count).to eql 1 17 | end 18 | end 19 | end 20 | -------------------------------------------------------------------------------- /db/migrate/20171117201519_update_resource_group_type_for_azure.rb: -------------------------------------------------------------------------------- 1 | class UpdateResourceGroupTypeForAzure < ActiveRecord::Migration[5.0] 2 | class ResourceGroup < ActiveRecord::Base 3 | self.inheritance_column = :_type_disabled 4 | end 5 | 6 | def up 7 | say_with_time("Update Azure resource group type") do 8 | ResourceGroup.update_all(:type => 'ManageIQ::Providers::Azure::ResourceGroup') 9 | end 10 | end 11 | 12 | def down 13 | say_with_time("Set Azure resource group type to base value") do 14 | ResourceGroup.update_all(:type => 'ResourceGroup') 15 | end 16 | end 17 | end 18 | -------------------------------------------------------------------------------- /db/migrate/20180807153714_add_conversion_host_table.rb: -------------------------------------------------------------------------------- 1 | class AddConversionHostTable < ActiveRecord::Migration[5.0] 2 | def change 3 | create_table :conversion_hosts do |t| 4 | t.string :name 5 | t.string :address 6 | t.string :type 7 | t.references :resource, :type => :bigint, :polymorphic => true 8 | t.string :version 9 | t.integer :max_concurrent_tasks 10 | t.boolean :vddk_transport_supported 11 | t.boolean :ssh_transport_supported 12 | t.timestamps 13 | t.index %w(resource_id resource_type) 14 | end 15 | end 16 | end 17 | -------------------------------------------------------------------------------- /db/migrate/20230220204405_delete_ovirt_rhv_network_event_catcher_workers.rb: -------------------------------------------------------------------------------- 1 | class DeleteOvirtRhvNetworkEventCatcherWorkers < ActiveRecord::Migration[6.1] 2 | class MiqWorker < ActiveRecord::Base 3 | self.inheritance_column = :_type_disabled 4 | end 5 | 6 | def up 7 | say_with_time("Deleting Ovirt/RHV Network Event Catcher Workers") do 8 | MiqWorker.where( 9 | :type => %w[ 10 | ManageIQ::Providers::Ovirt::NetworkManager::EventCatcher 11 | ManageIQ::Providers::Redhat::NetworkManager::EventCatcher 12 | ] 13 | ).delete_all 14 | end 15 | end 16 | end 17 | -------------------------------------------------------------------------------- /db/migrate/20180126144529_add_extra_information_to_switches.rb: -------------------------------------------------------------------------------- 1 | class AddExtraInformationToSwitches < ActiveRecord::Migration[5.0] 2 | def change 3 | add_column :switches, :ems_id, :bigint 4 | add_column :switches, :type, :string 5 | add_column :switches, :health_state, :string 6 | add_column :switches, :power_state, :string 7 | add_column :switches, :product_name, :string 8 | add_column :switches, :part_number, :string 9 | add_column :switches, :serial_number, :string 10 | add_column :switches, :description, :string 11 | add_column :switches, :manufacturer, :string 12 | end 13 | end 14 | -------------------------------------------------------------------------------- /spec/support/constant_watcher.rb: -------------------------------------------------------------------------------- 1 | module Spec 2 | module Support 3 | module ConstantWatcher 4 | mattr_accessor :classes_by_file 5 | 6 | def inherited(other) 7 | Spec::Support::ConstantWatcher.add(other) 8 | super 9 | end 10 | 11 | def self.add(const) 12 | path = caller_locations(2..2).first.path 13 | self.classes_by_file ||= {} 14 | self.classes_by_file[path] ||= [] 15 | self.classes_by_file[path] << const.name 16 | end 17 | end 18 | end 19 | end 20 | 21 | ActiveRecord::Base.singleton_class.prepend(Spec::Support::ConstantWatcher) 22 | -------------------------------------------------------------------------------- /spec/migrations/20190108163812_remove_cinder_manager_event_worker_rows_spec.rb: -------------------------------------------------------------------------------- 1 | require_migration 2 | 3 | describe RemoveCinderManagerEventWorkerRows do 4 | migration_context :up do 5 | let(:miq_worker) { migration_stub(:MiqWorker) } 6 | 7 | it "deletes Openstack Cinder event workers" do 8 | miq_worker.create!(:type => "MiqWorker") 9 | miq_worker.create!(:type => "ManageIQ::Providers::StorageManager::CinderManager::EventCatcher") 10 | 11 | migrate 12 | 13 | expect(miq_worker.count).to eq(1) 14 | expect(miq_worker.first.type).to eq("MiqWorker") 15 | end 16 | end 17 | end 18 | -------------------------------------------------------------------------------- /spec/migrations/20210407183310_remove_google_network_refresh_workers_spec.rb: -------------------------------------------------------------------------------- 1 | require_migration 2 | 3 | describe RemoveGoogleNetworkRefreshWorkers do 4 | migration_context :up do 5 | let(:miq_worker) { migration_stub(:MiqWorker) } 6 | 7 | it "deletes Google NetworkManager RefreshWorker workers" do 8 | miq_worker.create!(:type => "MiqWorker") 9 | miq_worker.create!(:type => "ManageIQ::Providers::Google::NetworkManager::RefreshWorker") 10 | 11 | migrate 12 | 13 | expect(miq_worker.count).to eq(1) 14 | expect(miq_worker.first.type).to eq("MiqWorker") 15 | end 16 | end 17 | end 18 | -------------------------------------------------------------------------------- /db/migrate/20220407210610_placement_group_additions.rb: -------------------------------------------------------------------------------- 1 | class PlacementGroupAdditions < ActiveRecord::Migration[6.0] 2 | def change 3 | create_table :placement_groups do |t| 4 | t.string :name 5 | t.string :policy 6 | t.string :ems_ref 7 | t.string :type, :index => true 8 | 9 | t.references :availability_zone, :type => :bigint 10 | t.references :cloud_tenant, :type => :bigint 11 | t.references :ems, :type => :bigint 12 | 13 | t.timestamps 14 | end 15 | 16 | add_reference :vms, :placement_group, :type => :bigint 17 | end 18 | end 19 | -------------------------------------------------------------------------------- /db/migrate/20220707150906_create_cloud_database_server.rb: -------------------------------------------------------------------------------- 1 | class CreateCloudDatabaseServer < ActiveRecord::Migration[6.0] 2 | def change 3 | create_table :cloud_database_servers do |t| 4 | t.string :name 5 | t.string :type, :index => true 6 | t.string :ems_ref 7 | t.string :server_type 8 | t.string :status 9 | t.string :version 10 | t.bigint :resource_group_id 11 | t.references :ems, :type => :bigint, :index => true, :references => :ext_management_system 12 | t.timestamps 13 | end 14 | 15 | add_reference :cloud_databases, :cloud_database_server 16 | end 17 | end 18 | -------------------------------------------------------------------------------- /lib/tasks/README.md: -------------------------------------------------------------------------------- 1 | Tasks (.rake files) in this directory will be available as public tasks in the main 2 | ManageIQ app. They can be executed in the plugin gem via the app: namespace 3 | 4 | ```shell 5 | bin/rails app: 6 | ``` 7 | 8 | Since these tasks are public, please namespace them, as in the following example: 9 | 10 | ```ruby 11 | namespace "manageiq:schema" do 12 | desc "Explaining what the task does" 13 | task :your_task do 14 | # Task goes here 15 | end 16 | end 17 | ``` 18 | 19 | Tasks places in the lib/tasks_private directory will be private to the plugin 20 | and not available in the ManageIQ app. 21 | -------------------------------------------------------------------------------- /bin/rails: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | # This command will automatically be run when you run "rails" with Rails gems 3 | # installed from the root of your application. 4 | 5 | ENGINE_ROOT = File.expand_path('../..', __FILE__) 6 | ENGINE_PATH = File.expand_path('../../lib/manageiq/schema/engine', __FILE__) 7 | APP_PATH = File.expand_path('../../spec/dummy/config/application', __FILE__) 8 | 9 | # Set up gems listed in the Gemfile. 10 | ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__) 11 | require 'bundler/setup' if File.exist?(ENV['BUNDLE_GEMFILE']) 12 | 13 | require 'rails/all' 14 | require 'rails/engine/commands' 15 | -------------------------------------------------------------------------------- /db/migrate/20180409120422_create_physical_network_ports.rb: -------------------------------------------------------------------------------- 1 | class CreatePhysicalNetworkPorts < ActiveRecord::Migration[5.0] 2 | def change 3 | create_table :physical_network_ports do |t| 4 | t.string :ems_ref 5 | t.string :uid_ems 6 | t.string :type 7 | t.string :port_name 8 | t.string :port_type 9 | t.string :peer_mac_address 10 | t.string :vlan_key 11 | t.string :mac_address 12 | t.integer :port_index 13 | t.boolean :vlan_enabled 14 | t.bigint :guest_device_id 15 | t.bigint :switch_id 16 | 17 | t.timestamps 18 | end 19 | end 20 | end 21 | -------------------------------------------------------------------------------- /spec/migrations/20190228210310_service_templates_should_have_names_spec.rb: -------------------------------------------------------------------------------- 1 | require_migration 2 | 3 | describe ServiceTemplatesShouldHaveNames do 4 | let(:service_template) { migration_stub(:ServiceTemplate) } 5 | 6 | migration_context :up do 7 | it "sets template_names" do 8 | obj1 = service_template.create! 9 | obj2 = service_template.create!(:name => "") 10 | 11 | expect(obj1.reload.name).to eq(nil) 12 | expect(obj2.reload.name).to eq("") 13 | 14 | migrate 15 | 16 | expect(obj1.reload.name).not_to eq(nil) 17 | expect(obj2.reload.name).not_to eq("") 18 | end 19 | end 20 | end 21 | -------------------------------------------------------------------------------- /config/initializers/inflections.rb: -------------------------------------------------------------------------------- 1 | ActiveSupport::Inflector.inflections do |inflect| 2 | inflect.singular(/Chassis$/, "Chassis") 3 | inflect.plural(/Chassis$/, "Chassis") 4 | inflect.singular(/chassis$/, "chassis") 5 | inflect.plural(/chassis$/, "chassis") 6 | inflect.singular(/Queue$/, "Queue") 7 | inflect.plural(/Queue$/, "Queue") 8 | inflect.singular(/queue$/, "queue") 9 | inflect.plural(/queue$/, "queue") 10 | inflect.singular(/quota$/, "quota") 11 | inflect.plural(/quota$/, "quotas") 12 | inflect.singular(/Quota$/, "Quota") 13 | inflect.plural(/Quota$/, "Quotas") 14 | 15 | inflect.acronym 'ManageIQ' 16 | end 17 | -------------------------------------------------------------------------------- /db/migrate/20221111201223_remove_vim_strings_from_custom_attributes.rb: -------------------------------------------------------------------------------- 1 | class RemoveVimStringsFromCustomAttributes < ActiveRecord::Migration[6.1] 2 | disable_ddl_transaction! 3 | include MigrationHelper 4 | 5 | class CustomAttribute < ActiveRecord::Base 6 | include ActiveRecord::IdRegions 7 | end 8 | 9 | def up 10 | regex_replace_column_value(CustomAttribute.in_my_region, 'serialized_value', '!ruby/string:VimString', '!ruby/string:String') 11 | end 12 | 13 | def down 14 | regex_replace_column_value(CustomAttribute.in_my_region, 'serialized_value', '!ruby/string:String', '!ruby/string:VimString') 15 | end 16 | end 17 | -------------------------------------------------------------------------------- /lib/manageiq/schema.rb: -------------------------------------------------------------------------------- 1 | require "manageiq/schema/version" 2 | require "manageiq/schema/engine" 3 | 4 | require 'activerecord-id_regions' 5 | require 'manageiq-password' 6 | require 'more_core_extensions/all' # TODO: Move this into specific migrations that need it 7 | 8 | require 'migration_helper' 9 | require 'migration_stub_helper' 10 | 11 | require 'reserve' 12 | require 'reserved_shared_mixin' 13 | require 'reserved_migration_mixin' 14 | require 'reserved_mixin' 15 | 16 | module ManageIQ 17 | module Schema 18 | SYSTEM_TABLES = %w(ar_internal_metadata schema_migrations repl_events repl_monitor repl_nodes).freeze 19 | end 20 | end 21 | -------------------------------------------------------------------------------- /db/migrate/20211119152213_remove_hawkular_authentications.rb: -------------------------------------------------------------------------------- 1 | class RemoveHawkularAuthentications < ActiveRecord::Migration[6.0] 2 | class Authentication < ActiveRecord::Base 3 | include ActiveRecord::IdRegions 4 | self.inheritance_column = :_type_disabled 5 | end 6 | 7 | class Endpoint < ActiveRecord::Base 8 | include ActiveRecord::IdRegions 9 | end 10 | 11 | def up 12 | say_with_time("Delete all hawkular authentications and endpoints") do 13 | Authentication.in_my_region.where(:authtype => "hawkular").delete_all 14 | Endpoint.in_my_region.where(:role => "hawkular").delete_all 15 | end 16 | end 17 | end 18 | -------------------------------------------------------------------------------- /db/migrate/20220401093502_create_physical_server_profiles.rb: -------------------------------------------------------------------------------- 1 | class CreatePhysicalServerProfiles < ActiveRecord::Migration[6.0] 2 | def change 3 | create_table :physical_server_profiles do |t| 4 | t.references :ems, :type => :bigint, :index => true, :references => :ext_management_system 5 | t.string :ems_ref 6 | t.string :name 7 | t.string :type, :index => true 8 | t.references :assigned_server, :type => :bigint, :index => true, :references => :physical_server 9 | t.references :associated_server, :type => :bigint, :index => true, :references => :physical_server 10 | 11 | t.timestamps 12 | end 13 | end 14 | end 15 | -------------------------------------------------------------------------------- /db/migrate/20221114165219_remove_vim_string_from_miq_request_task_options.rb: -------------------------------------------------------------------------------- 1 | class RemoveVimStringFromMiqRequestTaskOptions < ActiveRecord::Migration[6.1] 2 | disable_ddl_transaction! 3 | include MigrationHelper 4 | 5 | class MiqRequestTask < ActiveRecord::Base 6 | include ActiveRecord::IdRegions 7 | 8 | self.inheritance_column = :_type_disabled 9 | end 10 | 11 | def up 12 | regex_replace_column_value(MiqRequestTask, 'options', '!ruby/string:VimString', '!ruby/string:String') 13 | end 14 | 15 | def down 16 | regex_replace_column_value(MiqRequestTask, 'options', '!ruby/string:String', '!ruby/string:VimString') 17 | end 18 | end 19 | -------------------------------------------------------------------------------- /spec/migrations/20230830134742_delete_nil_timestamp_event_streams_spec.rb: -------------------------------------------------------------------------------- 1 | require_migration 2 | 3 | describe DeleteNilTimestampEventStreams do 4 | let(:event_stream_stub) { migration_stub(:EventStream) } 5 | 6 | migration_context :up do 7 | it "removes nil timestamp events, leaving others" do 8 | good = event_stream_stub.create!(:timestamp => Time.now.utc) 9 | event_stream_stub.create!(:timestamp => nil) 10 | 11 | migrate 12 | 13 | expect(event_stream_stub.count).to eq(1) 14 | expect(event_stream_stub.first.id).to eq(good.id) 15 | expect(event_stream_stub.first.timestamp).to be_present 16 | end 17 | end 18 | end 19 | -------------------------------------------------------------------------------- /spec/migrations/20180130165200_drop_webmks_spec.rb: -------------------------------------------------------------------------------- 1 | require_migration 2 | 3 | describe DropWebmks do 4 | let(:server_stub) { migration_stub(:MiqServer) } 5 | let(:settings_stub) { migration_stub(:SettingsChange) } 6 | 7 | migration_context :up do 8 | let(:server) { server_stub.create } 9 | 10 | it 'resets the remote_console_type to default' do 11 | settings_stub.create(:resource_id => server.id, :resource_type => server.class, :key => '/server/remote_console_type', :value => 'MKS') 12 | migrate 13 | 14 | expect(settings_stub.where(:key => '/server/remote_console_type', :value => 'MKS')).not_to exist 15 | end 16 | end 17 | end 18 | -------------------------------------------------------------------------------- /db/migrate/20200629194033_remove_vim_strings_from_miq_provision.rb: -------------------------------------------------------------------------------- 1 | class RemoveVimStringsFromMiqProvision < ActiveRecord::Migration[5.1] 2 | disable_ddl_transaction! 3 | include MigrationHelper 4 | 5 | class MiqRequestTask < ActiveRecord::Base 6 | include ActiveRecord::IdRegions 7 | 8 | self.inheritance_column = :_type_disabled 9 | end 10 | 11 | def up 12 | regex_replace_column_value(MiqRequestTask.in_my_region, 'phase_context', '!ruby/string:VimString', '!ruby/string:String') 13 | end 14 | 15 | def down 16 | regex_replace_column_value(MiqRequestTask.in_my_region, 'phase_context', '!ruby/string:String', '!ruby/string:VimString') 17 | end 18 | end 19 | -------------------------------------------------------------------------------- /db/migrate/20241017013023_reencrypt_password_scramsha.rb: -------------------------------------------------------------------------------- 1 | class ReencryptPasswordScramsha < ActiveRecord::Migration[6.1] 2 | def up 3 | say_with_time('Reencrypting database user password with scram-sha-256') do 4 | db_config = ActiveRecord::Base.connection_db_config.configuration_hash 5 | return if db_config[:username].blank? || db_config[:password].blank? 6 | 7 | username = db_config[:username] 8 | password = connection.raw_connection.encrypt_password(db_config[:password], username, "scram-sha-256") 9 | 10 | connection.execute <<-SQL 11 | ALTER ROLE #{username} WITH PASSWORD '#{password}'; 12 | SQL 13 | end 14 | end 15 | end 16 | -------------------------------------------------------------------------------- /spec/migrations/20180618084054_init_zones_visibility_spec.rb: -------------------------------------------------------------------------------- 1 | require_migration 2 | describe InitZonesVisibility do 3 | let(:zone_stub) { migration_stub(:Zone) } 4 | 5 | migration_context :up do 6 | it "makes zones visible" do 7 | zone = zone_stub.create!(:name => 'zone1') 8 | 9 | migrate 10 | zone.reload 11 | 12 | expect(zone.visible).to be_truthy 13 | end 14 | end 15 | 16 | migration_context :down do 17 | it 'resets zone visibility' do 18 | zone = zone_stub.create!(:name => 'zone_visible', :visible => true) 19 | 20 | migrate 21 | zone.reload 22 | 23 | expect(zone.visible).to be_nil 24 | end 25 | end 26 | end 27 | -------------------------------------------------------------------------------- /db/migrate/20181130203334_classification_parent_null.rb: -------------------------------------------------------------------------------- 1 | class ClassificationParentNull < ActiveRecord::Migration[5.0] 2 | class Classification < ActiveRecord::Base 3 | end 4 | 5 | def up 6 | change_column_default(:classifications, :parent_id, nil) 7 | 8 | say_with_time("Updating Classification parent_ids to nil") do 9 | Classification.where(:parent_id => 0).update_all(:parent_id => nil) 10 | end 11 | end 12 | 13 | def down 14 | change_column_default(:classifications, :parent_id, 0) 15 | 16 | say_with_time("Updating Classification parent_ids to 0") do 17 | Classification.where(:parent_id => nil).update_all(:parent_id => 0) 18 | end 19 | end 20 | end 21 | -------------------------------------------------------------------------------- /lib/reserved_mixin.rb: -------------------------------------------------------------------------------- 1 | module ReservedMixin 2 | extend ActiveSupport::Concern 3 | 4 | include ReservedSharedMixin 5 | 6 | module ClassMethods 7 | # Dynamically creates a getter, setter, and ? method that uses the 8 | # reserved column as a Hash to store the value. 9 | def reserve_attribute(name, type) 10 | name = name.to_sym 11 | 12 | attribute name, type 13 | 14 | define_method(name) { reserved_hash_get(name) } 15 | define_method("#{name}?") { !!reserved_hash_get(name) } 16 | define_method("#{name}=") do |val| 17 | send("#{name}_will_change!") 18 | reserved_hash_set(name, val) 19 | end 20 | end 21 | end 22 | end 23 | -------------------------------------------------------------------------------- /db/migrate/20200524074928_create_storage_service_resource_attachments.rb: -------------------------------------------------------------------------------- 1 | class CreateStorageServiceResourceAttachments < ActiveRecord::Migration[5.2] 2 | def change 3 | create_table :storage_service_resource_attachments do |t| 4 | t.references :storage_service, :type => :bigint, :index => {:name => "index_storage_svc_resource_attachments_on_storage_service_id"} 5 | t.references :storage_resource, :type => :bigint, :index => {:name => "index_storage_svc_resource_attachments_on_storage_resource_id"} 6 | t.references :ems, :type => :bigint, :index => true, :references => :ext_management_system 7 | t.string :ems_ref 8 | 9 | t.timestamps 10 | end 11 | end 12 | end 13 | -------------------------------------------------------------------------------- /spec/dummy/config/routes.rb: -------------------------------------------------------------------------------- 1 | Rails.application.routes.draw do 2 | # Define your application routes per the DSL in https://guides.rubyonrails.org/routing.html 3 | 4 | # Reveal health status on /up that returns 200 if the app boots with no exceptions, otherwise 500. 5 | # Can be used by load balancers and uptime monitors to verify that the app is live. 6 | get "up" => "rails/health#show", as: :rails_health_check 7 | 8 | # Render dynamic PWA files from app/views/pwa/* 9 | get "service-worker" => "rails/pwa#service_worker", as: :pwa_service_worker 10 | get "manifest" => "rails/pwa#manifest", as: :pwa_manifest 11 | 12 | # Defines the root path route ("/") 13 | # root "posts#index" 14 | end 15 | -------------------------------------------------------------------------------- /db/migrate/20230709181609_drop_archived_container_projects.rb: -------------------------------------------------------------------------------- 1 | class DropArchivedContainerProjects < ActiveRecord::Migration[6.1] 2 | class ContainerGroup < ActiveRecord::Base 3 | self.inheritance_column = :_type_disabled 4 | end 5 | 6 | def up 7 | ContainerGroup.where.not(:old_container_project_id => nil) 8 | .where(:container_project_id => nil) 9 | .update_all('container_project_id = old_container_project_id') 10 | end 11 | 12 | def down 13 | # Sorry. No down available (but not a problem) 14 | 15 | # The new format (with container_project_id assigned) 16 | # is valid before and after this migration and has been for years. 17 | end 18 | end 19 | -------------------------------------------------------------------------------- /spec/migrations/20181203224640_remove_renamed_ansible_tower_configuration_manager_refresh_worker_rows_spec.rb: -------------------------------------------------------------------------------- 1 | require_migration 2 | 3 | describe RemoveRenamedAnsibleTowerConfigurationManagerRefreshWorkerRows do 4 | migration_context :up do 5 | let(:miq_worker) { migration_stub(:MiqWorker) } 6 | 7 | it "deletes ansible tower configuration manager refresh workers" do 8 | miq_worker.create!(:type => "MiqWorker") 9 | miq_worker.create!(:type => "ManageIQ::Providers::AnsibleTower::ConfigurationManager::RefreshWorker") 10 | 11 | migrate 12 | 13 | expect(miq_worker.count).to eq(1) 14 | expect(miq_worker.first.type).to eq("MiqWorker") 15 | end 16 | end 17 | end 18 | -------------------------------------------------------------------------------- /spec/support/shared_examples_for_column_migration.rb: -------------------------------------------------------------------------------- 1 | # it tests data migration for one column 2 | # Example: 3 | # include_examples "column migration", :type, :ExtManagementSystem, ["Old Data Field", "New Data Field"] 4 | shared_examples_for "column migration" do |column, klass, data_to_convert| 5 | let(:stub) { migration_stub(klass) } 6 | let(:old_data_field) { data_to_convert.first } 7 | let(:new_data_field) { data_to_convert.second } 8 | 9 | it "migrates column #{column} of #{klass}" do 10 | rec = stub.create!(column => old_data_field) 11 | 12 | migrate 13 | 14 | column_value = rec.reload.send(column) 15 | expect(column_value).to eq(new_data_field) 16 | end 17 | end 18 | -------------------------------------------------------------------------------- /db/migrate/20191112132759_copy_owner_id_to_group_id_for_dashboards.rb: -------------------------------------------------------------------------------- 1 | class CopyOwnerIdToGroupIdForDashboards < ActiveRecord::Migration[5.1] 2 | class MiqSet < ActiveRecord::Base; end 3 | 4 | def up 5 | say_with_time("Copying owner_id to group_id in miq_sets table for each dashboard assigned to group") do 6 | MiqSet.where(:set_type => "MiqWidgetSet", :owner_type => "MiqGroup").update_all("group_id = owner_id") 7 | end 8 | end 9 | 10 | def down 11 | say_with_time("Nullifying group_id column in miw_sets table for each dashboard assigned to group") do 12 | MiqSet.where(:set_type => "MiqWidgetSet", :owner_type => "MiqGroup").update_all(:group_id => nil) 13 | end 14 | end 15 | end 16 | -------------------------------------------------------------------------------- /spec/migrations/20210330012001_remove_regex_from_settings_spec.rb: -------------------------------------------------------------------------------- 1 | require_migration 2 | 3 | describe RemoveRegexFromSettings do 4 | let(:settings_change_stub) { migration_stub(:SettingsChange) } 5 | 6 | migration_context :up do 7 | it "converts regular expression object to a string" do 8 | record = settings_change_stub.create!( 9 | :resource_type => "MiqServer", 10 | :key => "/ems/ems_nuage/event_handling/event_groups/addition/critical", 11 | :value => ["/hello/","beautiful",/world/] 12 | 13 | ) 14 | migrate 15 | 16 | record.reload 17 | expect(record.value).to eq(["/hello/","beautiful","/world/"]) 18 | end 19 | end 20 | end 21 | -------------------------------------------------------------------------------- /db/migrate/20230310183805_delete_ovn_event_catcher_settings.rb: -------------------------------------------------------------------------------- 1 | class DeleteOvnEventCatcherSettings < ActiveRecord::Migration[6.1] 2 | class SettingsChange < ActiveRecord::Base 3 | include ActiveRecord::IdRegions 4 | end 5 | 6 | def up 7 | say_with_time("Deleting Ovirt Network Event Catcher SettingsChanges") do 8 | SettingsChange.in_my_region.where("key LIKE '/workers/worker_base/event_catcher/event_catcher_ovirt_network/%'").delete_all 9 | end 10 | 11 | say_with_time("Deleting RHV Network Event Catcher SettingsChanges") do 12 | SettingsChange.in_my_region.where("key LIKE '/workers/worker_base/event_catcher/event_catcher_redhat_network/%'").delete_all 13 | end 14 | end 15 | end 16 | -------------------------------------------------------------------------------- /db/migrate/20180827083140_create_service_instances_table.rb: -------------------------------------------------------------------------------- 1 | class CreateServiceInstancesTable < ActiveRecord::Migration[5.0] 2 | def change 3 | create_table :service_instances, :id => :bigserial, :force => :cascade do |t| 4 | t.string :name 5 | t.string :ems_ref 6 | t.string :type 7 | 8 | t.references :ems, :type => :bigint, :index => true, :references => :ext_management_system 9 | t.references :service_offering, :type => :bigint, :index => true 10 | t.references :service_parameters_set, :type => :bigint, :index => true 11 | 12 | t.jsonb :extra 13 | 14 | t.datetime :deleted_on 15 | t.timestamps 16 | 17 | t.index :deleted_on 18 | end 19 | end 20 | end 21 | -------------------------------------------------------------------------------- /spec/migrations/20180718132840_remove_transformation_product_setting_spec.rb: -------------------------------------------------------------------------------- 1 | require_migration 2 | 3 | describe RemoveTransformationProductSetting do 4 | let(:settings_change_stub) { migration_stub(:SettingsChange) } 5 | 6 | migration_context :up do 7 | it "removes the /product/transformation key" do 8 | setting_changed = settings_change_stub.create!(:key => "/product/transformation", :value => true) 9 | setting_ignored = settings_change_stub.create!(:key => "/product/magic", :value => true) 10 | 11 | migrate 12 | 13 | expect { setting_changed.reload }.to raise_error(ActiveRecord::RecordNotFound) 14 | expect(setting_ignored.reload.value).to eq(true) 15 | end 16 | end 17 | end 18 | -------------------------------------------------------------------------------- /spec/migrations/20210817182147_remove_memcache_server_opts_spec.rb: -------------------------------------------------------------------------------- 1 | require_migration 2 | 3 | describe RemoveMemcacheServerOpts do 4 | let(:settings_change_stub) { migration_stub(:SettingsChange) } 5 | 6 | migration_context :up do 7 | it "Deletes memcache_server_opts settings" do 8 | settings_change_stub.create!(:key => "/session/memcache_server_opts") 9 | migrate 10 | expect(settings_change_stub.count).to be_zero 11 | end 12 | 13 | it "Doesn't impact unrelated settings" do 14 | session_timeout = settings_change_stub.create!(:key => "/session/timeout", :value => "3600") 15 | migrate 16 | expect(session_timeout.reload.value).to eq("3600") 17 | end 18 | end 19 | end 20 | -------------------------------------------------------------------------------- /db/migrate/20180713194201_create_canister.rb: -------------------------------------------------------------------------------- 1 | class CreateCanister < ActiveRecord::Migration[5.0] 2 | def change 3 | create_table :canisters do |t| 4 | t.string :ems_ref 5 | t.string :serial_number 6 | t.string :name 7 | t.string :position 8 | t.string :status 9 | t.string :health_state 10 | t.string :disk_bus_type 11 | t.string :phy_isolation 12 | t.string :controller_redundancy_status 13 | t.integer :disks 14 | t.integer :disk_channel 15 | t.integer :system_cache_memory 16 | t.string :power_state 17 | t.string :host_ports 18 | t.string :hardware_version 19 | t.bigint :physical_storage_id 20 | t.timestamps 21 | end 22 | end 23 | end 24 | -------------------------------------------------------------------------------- /spec/automated_review/data_migrations_need_tests_spec.rb: -------------------------------------------------------------------------------- 1 | describe "Data migrations" do 2 | def data_migration_files 3 | Spec::Support::ConstantWatcher.classes_by_file.keys.select { |file| file.include?("db/migrate") } 4 | end 5 | 6 | it "need tests" do 7 | Dir.glob(ManageIQ::Schema::Engine.root.join("db", "migrate", "*.rb")).each { |i| require i } 8 | 9 | data_migration_files.each do |data_migration_file| 10 | spec_file_basename = File.basename(data_migration_file).sub(".rb", "_spec.rb") 11 | spec_file = ManageIQ::Schema::Engine.root.join("spec", "migrations", spec_file_basename) 12 | 13 | expect(spec_file.file?).to eq(true), "Missing data migration spec at #{spec_file}" 14 | end 15 | end 16 | end 17 | -------------------------------------------------------------------------------- /db/migrate/20221010195912_update_placement_group_view_feature_identifier.rb: -------------------------------------------------------------------------------- 1 | class UpdatePlacementGroupViewFeatureIdentifier < ActiveRecord::Migration[6.0] 2 | class MiqProductFeature < ActiveRecord::Base; end 3 | 4 | def up 5 | say_with_time("Updating Placement Group list feature to view") do 6 | MiqProductFeature.find_by(:identifier => 'placement_group_list') 7 | &.update!(:identifier => 'placement_group_view') 8 | end 9 | end 10 | 11 | def down 12 | say_with_time("Resetting Placement Group view feature back to list") do 13 | MiqProductFeature.find_by(:identifier => 'placement_group_view') 14 | &.update!(:identifier => 'placement_group_list') 15 | end 16 | end 17 | end 18 | -------------------------------------------------------------------------------- /spec/dummy/config/initializers/inflections.rb: -------------------------------------------------------------------------------- 1 | # Be sure to restart your server when you modify this file. 2 | 3 | # Add new inflection rules using the following format. Inflections 4 | # are locale specific, and you may define rules for as many different 5 | # locales as you wish. All of these examples are active by default: 6 | # ActiveSupport::Inflector.inflections(:en) do |inflect| 7 | # inflect.plural /^(ox)$/i, "\\1en" 8 | # inflect.singular /^(ox)en/i, "\\1" 9 | # inflect.irregular "person", "people" 10 | # inflect.uncountable %w( fish sheep ) 11 | # end 12 | 13 | # These inflection rules are supported but not enabled by default: 14 | # ActiveSupport::Inflector.inflections(:en) do |inflect| 15 | # inflect.acronym "RESTful" 16 | # end 17 | -------------------------------------------------------------------------------- /spec/migrations/20210726194608_delete_rhn_authentications_spec.rb: -------------------------------------------------------------------------------- 1 | require_migration 2 | 3 | describe DeleteRhnAuthentications do 4 | let(:authentication_stub) { migration_stub(:Authentication) } 5 | 6 | migration_context :up do 7 | it "deletes" do 8 | authentication_stub.create!(:authtype => "registration") 9 | authentication_stub.create!(:authtype => "registration_http_proxy") 10 | 11 | migrate 12 | 13 | expect(authentication_stub.count).to eq(0) 14 | end 15 | 16 | it "leaves" do 17 | authentication_stub.create!(:authtype => "default") 18 | authentication_stub.create!(:authtype => nil) 19 | 20 | migrate 21 | 22 | expect(authentication_stub.count).to eq(2) 23 | end 24 | end 25 | end 26 | -------------------------------------------------------------------------------- /spec/migrations/20200717181436_delete_workers_with_json_queue_names_spec.rb: -------------------------------------------------------------------------------- 1 | require_migration 2 | 3 | describe DeleteWorkersWithJsonQueueNames do 4 | let(:miq_worker_stub) { migration_stub(:MiqWorker) } 5 | 6 | migration_context :up do 7 | it "deletes workers with a JSON type queue name" do 8 | worker = miq_worker_stub.create!(:queue_name => "[\"ems_4\", \"ems_5\", \"ems_6\"]") 9 | 10 | migrate 11 | 12 | expect(miq_worker_stub.find_by(:id => worker.id)).to be_nil 13 | end 14 | 15 | it "doesn't touch workers without JSON queue names" do 16 | worker = miq_worker_stub.create!(:queue_name => "ems_1") 17 | 18 | migrate 19 | 20 | expect(worker.reload.queue_name).to eq("ems_1") 21 | end 22 | end 23 | end 24 | -------------------------------------------------------------------------------- /db/migrate/20201208092011_append_alert_statuses_feature.rb: -------------------------------------------------------------------------------- 1 | class AppendAlertStatusesFeature < ActiveRecord::Migration[5.2] 2 | class MiqProductFeature < ActiveRecord::Base; end 3 | class MiqRolesFeature < ActiveRecord::Base; end 4 | 5 | def up 6 | return if MiqProductFeature.none? 7 | 8 | alert = MiqProductFeature.find_or_create_by!(:identifier => 'alert') 9 | alert_status = MiqProductFeature.find_or_create_by!(:identifier => 'alert_status') 10 | 11 | MiqRolesFeature.where(:miq_product_feature_id => alert.id).each do |feature| 12 | MiqRolesFeature.create!(:miq_product_feature_id => alert_status.id, :miq_user_role_id => feature.miq_user_role_id) 13 | end 14 | end 15 | 16 | def down 17 | # not reversible 18 | end 19 | end 20 | -------------------------------------------------------------------------------- /db/migrate/20180405145642_remove_provider_region_for_google_provider.rb: -------------------------------------------------------------------------------- 1 | class RemoveProviderRegionForGoogleProvider < ActiveRecord::Migration[5.0] 2 | class ExtManagementSystem < ActiveRecord::Base 3 | self.inheritance_column = :_type_disabled 4 | end 5 | 6 | def up 7 | say_with_time("Removing provider_region from ManageIQ::Providers::Google::CloudManager") do 8 | ExtManagementSystem.where(:type => 'ManageIQ::Providers::Google::CloudManager').update_all(:provider_region => nil) 9 | end 10 | say_with_time("Removing provider_region from ManageIQ::Providers::Google::NetworkManager") do 11 | ExtManagementSystem.where(:type => 'ManageIQ::Providers::Google::NetworkManager').update_all(:provider_region => nil) 12 | end 13 | end 14 | end 15 | -------------------------------------------------------------------------------- /spec/dummy/app/views/layouts/application.html.erb: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | <%= content_for(:title) || "Dummy" %> 5 | 6 | 7 | <%= csrf_meta_tags %> 8 | <%= csp_meta_tag %> 9 | 10 | <%= yield :head %> 11 | 12 | 13 | 14 | 15 | 16 | <%= stylesheet_link_tag "application", "data-turbo-track": "reload" %> 17 | 18 | 19 | 20 | <%= yield %> 21 | 22 | 23 | -------------------------------------------------------------------------------- /db/migrate/20210819145618_update_network_router_admin_state_up.rb: -------------------------------------------------------------------------------- 1 | class UpdateNetworkRouterAdminStateUp < ActiveRecord::Migration[6.0] 2 | class NetworkRouter < ActiveRecord::Base 3 | self.inheritance_column = :_type_disabled 4 | end 5 | 6 | def up 7 | change_column :network_routers, :admin_state_up, 8 | "BOOLEAN USING COALESCE(admin_state_up::BOOLEAN, FALSE)" 9 | 10 | change_column_default :network_routers, :admin_state_up, false 11 | change_column_null :network_routers, :admin_state_up, false 12 | end 13 | 14 | def down 15 | change_column_null :network_routers, :admin_state_up, true 16 | change_column_default :network_routers, :admin_state_up, nil 17 | 18 | change_column :network_routers, :admin_state_up, "varchar" 19 | end 20 | end 21 | -------------------------------------------------------------------------------- /spec/migrations/20190918133037_remove_rails_server_from_settings_spec.rb: -------------------------------------------------------------------------------- 1 | require_migration 2 | 3 | describe RemoveRailsServerFromSettings do 4 | let(:settings_change_stub) { migration_stub(:SettingsChange) } 5 | 6 | migration_context :up do 7 | let(:worker_stub) { migration_stub(:MiqWorker) } 8 | 9 | it "removes rows with /server/rails_server key" do 10 | setting_changed = settings_change_stub.create!(:key => "/server/rails_server", :value => "thin") 11 | setting_ignored = settings_change_stub.create!(:key => "/server/other_key", :value => "something") 12 | 13 | migrate 14 | 15 | expect { setting_changed.reload }.to raise_error(ActiveRecord::RecordNotFound) 16 | expect(setting_ignored.reload.value).to eq("something") 17 | end 18 | end 19 | end 20 | -------------------------------------------------------------------------------- /db/migrate/20180112171348_drop_unnecessary_blob_parts_md5.rb: -------------------------------------------------------------------------------- 1 | class DropUnnecessaryBlobPartsMd5 < ActiveRecord::Migration[5.0] 2 | class BinaryBlobPart < ActiveRecord::Base 3 | include ActiveRecord::IdRegions 4 | end 5 | 6 | def up 7 | remove_column :binary_blob_parts, :md5 8 | remove_column :binary_blob_parts, :size 9 | end 10 | 11 | def down 12 | add_column :binary_blob_parts, :md5, :string 13 | add_column :binary_blob_parts, :size, :decimal, :precision => 20, :scale => 0 14 | 15 | say_with_time("Calculating md5 and size of all BinaryBlobParts") do 16 | require 'digest' 17 | BinaryBlobPart.in_my_region.find_each do |part| 18 | part.update(:md5 => Digest::MD5.hexdigest(part.data), :size => part.data.bytesize) 19 | end 20 | end 21 | end 22 | end 23 | -------------------------------------------------------------------------------- /spec/migrations/20210810191933_remove_update_repo_names_from_settings_spec.rb: -------------------------------------------------------------------------------- 1 | require_migration 2 | 3 | describe RemoveUpdateRepoNamesFromSettings do 4 | let(:settings_change) { migration_stub(:SettingsChange) } 5 | 6 | migration_context :up do 7 | it "deletes only desired key" do 8 | settings_change.create!(:resource_type => "MiqRegion", :key => "/product/update_repo_names") 9 | 10 | migrate 11 | 12 | expect(settings_change.count).to eq(0) 13 | end 14 | 15 | it "leaves" do 16 | settings_change.create!(:resource_type => "MiqRegion", :key => "/product/keep_me") 17 | settings_change.create!(:resource_type => "MiqServer", :key => "/product/keep_me_too") 18 | 19 | migrate 20 | 21 | expect(settings_change.count).to eq(2) 22 | end 23 | end 24 | end 25 | -------------------------------------------------------------------------------- /db/migrate/20180507134810_azure_normalize_image_name.rb: -------------------------------------------------------------------------------- 1 | class AzureNormalizeImageName < ActiveRecord::Migration[5.0] 2 | class VmOrTemplate < ActiveRecord::Base 3 | self.inheritance_column = :_type_disabled 4 | self.table_name = 'vms' 5 | end 6 | 7 | def up 8 | say_with_time("Updating Azure template name") do 9 | VmOrTemplate.where("type = ? and uid_ems like ?", "ManageIQ::Providers::Azure::CloudManager::Template", "http%") 10 | .update_all("name = regexp_replace(name, '^./', '')") 11 | end 12 | end 13 | 14 | def down 15 | say_with_time("Reverting Azure template name") do 16 | VmOrTemplate.where("type = ? and uid_ems like ?", "ManageIQ::Providers::Azure::CloudManager::Template", "http%") 17 | .update_all("name = './' || name") 18 | end 19 | end 20 | end 21 | -------------------------------------------------------------------------------- /spec/migrations/20191002103406_remove_quadicon_settings_spec.rb: -------------------------------------------------------------------------------- 1 | require_migration 2 | 3 | describe RemoveQuadiconSettings do 4 | migration_context :up do 5 | let(:user_stub) { migration_stub(:User) } 6 | 7 | it "removes the quadicon from user settings" do 8 | u = user_stub.create!(:settings => { :quadicons => { :foo => :bar }, :foo => :bar }) 9 | 10 | expect(u.settings[:quadicons]).not_to be_nil 11 | 12 | migrate 13 | 14 | expect(u.reload.settings[:quadicons]).to be_nil 15 | expect(u.settings[:foo]).to eq(:bar) 16 | end 17 | 18 | it "doesn't affect users without a quadicon setting" do 19 | u = user_stub.create!(:settings => { :foo => :bar }) 20 | 21 | migrate 22 | 23 | expect(u.reload.settings[:foo]).to eq(:bar) 24 | end 25 | end 26 | end 27 | -------------------------------------------------------------------------------- /db/migrate/20180327162308_create_physical_chassis.rb: -------------------------------------------------------------------------------- 1 | class CreatePhysicalChassis < ActiveRecord::Migration[5.0] 2 | def change 3 | create_table :physical_chassis do |t| 4 | t.bigint :ems_id 5 | t.string :uid_ems 6 | t.string :ems_ref 7 | t.bigint :physical_rack_id 8 | t.string :name 9 | t.string :vendor 10 | t.string :type 11 | t.string :location_led_state 12 | t.string :health_state 13 | t.string :overall_health_state 14 | t.integer :management_module_slot_count 15 | t.integer :switch_slot_count 16 | t.integer :fan_slot_count 17 | t.integer :blade_slot_count 18 | t.integer :powersupply_slot_count 19 | t.timestamps 20 | end 21 | 22 | add_column :physical_servers, :physical_chassis_id, :bigint 23 | end 24 | end 25 | -------------------------------------------------------------------------------- /db/migrate/20191023180130_update_openstack_hosts_uid_ems.rb: -------------------------------------------------------------------------------- 1 | class UpdateOpenstackHostsUidEms < ActiveRecord::Migration[5.1] 2 | class Host < ActiveRecord::Base 3 | self.inheritance_column = :_type_disabled # disable STI 4 | include ActiveRecord::IdRegions 5 | end 6 | 7 | def up 8 | Host.in_my_region.where(:type => "ManageIQ::Providers::Openstack::InfraManager::Host").where.not(:ems_ref_obj => nil).find_each do |host| 9 | host.uid_ems = YAML.safe_load(host.ems_ref_obj) 10 | host.save! 11 | end 12 | end 13 | 14 | def down 15 | Host.in_my_region.where(:type => "ManageIQ::Providers::Openstack::InfraManager::Host").find_each do |host| 16 | host.ems_ref_obj = YAML.dump(host.uid_ems) 17 | host.uid_ems = host.ems_ref 18 | host.save! 19 | end 20 | end 21 | end 22 | -------------------------------------------------------------------------------- /db/migrate/20240227184516_update_audit_managed_resources_queue_name.rb: -------------------------------------------------------------------------------- 1 | class UpdateAuditManagedResourcesQueueName < ActiveRecord::Migration[6.1] 2 | class MiqQueue < ActiveRecord::Base; end 3 | 4 | def up 5 | say_with_time("Renaming audit_managed_resources queue items") do 6 | MiqQueue.where(:method_name => "audit_managed_resources").update_all(:method_name => "report_audit_details", :task_id => "report_audit_details", :tracking_label => "report_audit_details") 7 | end 8 | end 9 | 10 | def down 11 | say_with_time("Renaming report_audit_details queue items") do 12 | MiqQueue.where(:method_name => "report_audit_details").update_all(:method_name => "audit_managed_resources", :task_id => "audit_managed_resources", :tracking_label => "audit_managed_resources") 13 | end 14 | end 15 | end 16 | -------------------------------------------------------------------------------- /spec/dummy/app/assets/stylesheets/application.css: -------------------------------------------------------------------------------- 1 | /* 2 | * This is a manifest file that'll be compiled into application.css, which will include all the files 3 | * listed below. 4 | * 5 | * Any CSS (and SCSS, if configured) file within this directory, lib/assets/stylesheets, or any plugin's 6 | * vendor/assets/stylesheets directory can be referenced here using a relative path. 7 | * 8 | * You're free to add application-wide styles to this file and they'll appear at the bottom of the 9 | * compiled file so the styles you add here take precedence over styles defined in any other CSS 10 | * files in this directory. Styles in this file should be added after the last require_* statement. 11 | * It is generally better to create a new file per style scope. 12 | * 13 | *= require_tree . 14 | *= require_self 15 | */ 16 | -------------------------------------------------------------------------------- /spec/migrations/20210118185402_subclass_cinder_manager_openstack_spec.rb: -------------------------------------------------------------------------------- 1 | require_migration 2 | 3 | RSpec.describe SubclassCinderManagerOpenstack do 4 | let(:ems_stub) { migration_stub(:ExtManagementSystem) } 5 | 6 | migration_context :up do 7 | it "Updates the CinderManager :type" do 8 | ems = ems_stub.create!(:type => "ManageIQ::Providers::StorageManager::CinderManager") 9 | 10 | migrate 11 | 12 | expect(ems.reload.type).to eq("ManageIQ::Providers::Openstack::StorageManager::CinderManager") 13 | end 14 | 15 | it "Doesn't update other managers' types" do 16 | ems = ems_stub.create!(:type => "ManageIQ::Providers::Vmware::InfraManager") 17 | 18 | migrate 19 | 20 | expect(ems.reload.type).to eq("ManageIQ::Providers::Vmware::InfraManager") 21 | end 22 | end 23 | end 24 | -------------------------------------------------------------------------------- /spec/migrations/20230322171110_delete_foreman_provisioning_refresh_settings_spec.rb: -------------------------------------------------------------------------------- 1 | require_migration 2 | 3 | describe DeleteForemanProvisioningRefreshSettings do 4 | let(:settings_change_stub) { migration_stub(:SettingsChange) } 5 | 6 | migration_context :up do 7 | it "Deletes Foreman ProvisioningManager Refresh settings" do 8 | settings_change_stub.create(:key => "/ems_refresh/foreman_provisioning/refresh_interval", :value => "30.minutes") 9 | migrate 10 | expect(settings_change_stub.count).to be_zero 11 | end 12 | 13 | it "Doesn't impact unrelated settings" do 14 | settings_change_stub.create(:key => "/ems_refresh/foreman_configuration/refresh_interval", :value => "30.minutes") 15 | migrate 16 | expect(settings_change_stub.count).to eq(1) 17 | end 18 | end 19 | end 20 | -------------------------------------------------------------------------------- /spec/migrations/20200122215829_upgrade_dropbox_to_support_tool_spec.rb: -------------------------------------------------------------------------------- 1 | require_migration 2 | 3 | describe UpgradeDropboxToSupportTool do 4 | let(:file_depot) { migration_stub(:FileDepot) } 5 | 6 | migration_context :up do 7 | it "upgrades only existing dropbox depots to support tool" do 8 | dropbox_depot = file_depot.create!( 9 | :type => "FileDepotFtpAnonymousRedhatDropbox", 10 | :name => "Red Hat Dropbox" 11 | ) 12 | 13 | ftp_depot = file_depot.create!(:type => "FileDepotFtp") 14 | 15 | migrate 16 | 17 | dropbox_depot.reload 18 | expect(dropbox_depot.type).to eq "FileDepotRedhatSupport" 19 | expect(dropbox_depot.name).to eq "Red Hat Support" 20 | 21 | ftp_depot.reload 22 | expect(ftp_depot.type).to eq "FileDepotFtp" 23 | end 24 | end 25 | end 26 | -------------------------------------------------------------------------------- /spec/migrations/20180810144738_update_default_internal_attribute_spec.rb: -------------------------------------------------------------------------------- 1 | require_migration 2 | 3 | describe UpdateDefaultInternalAttribute do 4 | let(:service_template_stub) { migration_stub(:ServiceTemplate) } 5 | 6 | migration_context :up do 7 | it "sets internal to false when type is ServiceTemplateTransformationPlan" do 8 | st = service_template_stub.create!(:type => 'ServiceTemplateTransformationPlan', :internal => true) 9 | 10 | migrate 11 | 12 | expect(st.reload.internal).to be_truthy 13 | end 14 | 15 | it "sets internal to false when type is not ServiceTemplateTransformationPlan" do 16 | st = service_template_stub.create!(:type => 'OtherServiceTemplateTransformationPlan') 17 | 18 | migrate 19 | 20 | expect(st.reload.internal).to be(false) 21 | end 22 | end 23 | end 24 | -------------------------------------------------------------------------------- /lib/reserved_migration_mixin.rb: -------------------------------------------------------------------------------- 1 | module ReservedMigrationMixin 2 | extend ActiveSupport::Concern 3 | 4 | include ReservedSharedMixin 5 | 6 | # Migrate values from the reserved hash to a column. Accepts either 7 | # an Array of key names when the column names match the key names, or 8 | # a Hash of key names to column names if the column names do not match the 9 | # key names 10 | def reserved_hash_migrate(*keys) 11 | keys = keys.flatten 12 | if keys.last.kind_of?(Hash) 13 | keys = keys.last 14 | else 15 | keys = keys.zip(keys) # [:key1, :key2] => [[:key1, :key1], [:key2, :key2]] 16 | end 17 | 18 | keys.each do |key, attribute| 19 | val = reserved_hash_get(key) 20 | reserved_hash_set(key, nil) 21 | send("#{attribute}=", val) 22 | end 23 | self.save! 24 | end 25 | end 26 | -------------------------------------------------------------------------------- /db/migrate/20181012161000_remove_special_characters_from_ansible_rabbitmq_password_two.rb: -------------------------------------------------------------------------------- 1 | require 'securerandom' 2 | 3 | class RemoveSpecialCharactersFromAnsibleRabbitmqPasswordTwo < ActiveRecord::Migration[5.0] 4 | # used only in specs 5 | class MiqDatabase < ActiveRecord::Base; end 6 | 7 | class Authentication < ActiveRecord::Base 8 | self.inheritance_column = :_type_disabled 9 | include ActiveRecord::IdRegions 10 | end 11 | 12 | def up 13 | auth = Authentication.in_my_region.find_by( 14 | :authtype => "ansible_rabbitmq_auth", 15 | :type => "AuthUseridPassword" 16 | ) 17 | 18 | return unless auth 19 | 20 | current = ManageIQ::Password.decrypt(auth.password) 21 | auth.update!(:password => ManageIQ::Password.encrypt(SecureRandom.hex(18))) unless current =~ /^[a-zA-Z0-9]+$/ 22 | end 23 | end 24 | -------------------------------------------------------------------------------- /spec/migrations/20191114131917_remove_miqwidget_rss_spec.rb: -------------------------------------------------------------------------------- 1 | require_migration 2 | 3 | describe RemoveMiqwidgetRss do 4 | migration_context :up do 5 | let(:miq_widget) { migration_stub :MiqWidget } 6 | 7 | it 'does delete only MiqWidget with content_type set to RSS' do 8 | miq_widget.create!(:content_type => 'rss') 9 | miq_widget.create!(:content_type => 'menu') 10 | miq_widget.create!(:content_type => 'chart') 11 | miq_widget.create!(:content_type => 'report') 12 | 13 | migrate 14 | 15 | expect(miq_widget.where(:content_type => "rss").count).to eq 0 16 | expect(miq_widget.where(:content_type => "menu").count).to eq 1 17 | expect(miq_widget.where(:content_type => "chart").count).to eq 1 18 | expect(miq_widget.where(:content_type => "report").count).to eq 1 19 | end 20 | end 21 | end 22 | -------------------------------------------------------------------------------- /spec/migrations/20181119154009_set_vm_connection_state_spec.rb: -------------------------------------------------------------------------------- 1 | require_migration 2 | 3 | describe SetVmConnectionState do 4 | let(:vm_stub) { migration_stub(:VmOrTemplate) } 5 | let!(:vm) { vm_stub.create!(:connection_state => connection_state) } 6 | let(:connection_state) { nil } 7 | 8 | migration_context :up do 9 | context 'connection_state is nil' do 10 | it 'flips to "connected"' do 11 | migrate 12 | vm.reload 13 | expect(vm.connection_state).to eq('connected') 14 | end 15 | end 16 | 17 | context 'vm is disconnected' do 18 | let(:connection_state) { 'disconnected' } 19 | it 'disconnected stays disconnected' do 20 | migrate 21 | vm.reload 22 | expect(vm.connection_state).to eq(connection_state) 23 | end 24 | end 25 | end 26 | end 27 | -------------------------------------------------------------------------------- /db/migrate/20190726204302_remove_local_default_embedded_ansible_repos.rb: -------------------------------------------------------------------------------- 1 | class RemoveLocalDefaultEmbeddedAnsibleRepos < ActiveRecord::Migration[5.1] 2 | class ConfigurationScriptSource < ActiveRecord::Base 3 | include ActiveRecord::IdRegions 4 | self.inheritance_column = :_type_disabled # disable STI 5 | end 6 | 7 | class GitRepository < ActiveRecord::Base; end 8 | 9 | CONFIGURATION_SCRIPT_TYPE = "ManageIQ::Providers::EmbeddedAnsible::AutomationManager::ConfigurationScriptSource".freeze 10 | 11 | def up 12 | css = ConfigurationScriptSource.in_my_region.where(:type => CONFIGURATION_SCRIPT_TYPE).where("scm_url LIKE ? OR scm_url = ?", "%/content/ansible_consolidated", "file:///var/lib/awx_consolidated_source") 13 | 14 | GitRepository.where(:id => css.pluck(:git_repository_id).compact).delete_all 15 | css.delete_all 16 | end 17 | end 18 | -------------------------------------------------------------------------------- /db/migrate/20210105162025_subclass_swift_manager_openstack.rb: -------------------------------------------------------------------------------- 1 | class SubclassSwiftManagerOpenstack < ActiveRecord::Migration[5.2] 2 | class ExtManagementSystem < ActiveRecord::Base 3 | self.inheritance_column = :_type_disabled 4 | end 5 | 6 | def up 7 | say_with_time("Subclass SwiftManager under Openstack") do 8 | ExtManagementSystem.where(:type => "ManageIQ::Providers::StorageManager::SwiftManager") 9 | .update_all(:type => "ManageIQ::Providers::Openstack::StorageManager::SwiftManager") 10 | end 11 | end 12 | 13 | def down 14 | say_with_time("Move SwiftManager from Openstack") do 15 | ExtManagementSystem.where(:type => "ManageIQ::Providers::Openstack::StorageManager::SwiftManager") 16 | .update_all(:type => "ManageIQ::Providers::StorageManager::SwiftManager") 17 | end 18 | end 19 | end 20 | -------------------------------------------------------------------------------- /spec/migrations/20180201152816_remove_invalid_server_hostnames_spec.rb: -------------------------------------------------------------------------------- 1 | require_migration 2 | 3 | describe RemoveInvalidServerHostnames do 4 | let(:miq_server_stub) { migration_stub :MiqServer } 5 | 6 | migration_context :up do 7 | it "nil is unchanged" do 8 | miq_server_stub.create! 9 | 10 | migrate 11 | 12 | expect(miq_server_stub.pluck(:hostname)).to eq([nil]) 13 | end 14 | 15 | it "valid is unchanged" do 16 | miq_server_stub.create!(:hostname => "abc-def.example.com") 17 | 18 | migrate 19 | 20 | expect(miq_server_stub.pluck(:hostname)).to eq(["abc-def.example.com"]) 21 | end 22 | 23 | it "invalid is now nil" do 24 | miq_server_stub.create!(:hostname => "invalid_hostname.example.com") 25 | 26 | migrate 27 | 28 | expect(miq_server_stub.pluck(:hostname)).to eq([nil]) 29 | end 30 | end 31 | end 32 | -------------------------------------------------------------------------------- /spec/migrations/20200128122000_add_type_column_to_service_order_spec.rb: -------------------------------------------------------------------------------- 1 | require_migration 2 | 3 | describe AddTypeColumnToServiceOrder do 4 | let(:service_order) { migration_stub(:ServiceOrder) } 5 | let(:miq_request) { migration_stub(:MiqRequest) } 6 | 7 | migration_context :up do 8 | it "Updates service orders to v2v or cart" do 9 | v2v_service_order = service_order.create! 10 | miq_request.create!(:type => 'ServiceTemplateTransformationPlanRequest', 11 | :service_order_id => v2v_service_order.id) 12 | plain_service_order = service_order.create! 13 | 14 | migrate 15 | 16 | v2v_service_order.reload 17 | expect(v2v_service_order.type).to eq "ServiceOrderV2V" 18 | 19 | plain_service_order.reload 20 | expect(plain_service_order.type).to eq "ServiceOrderCart" 21 | end 22 | end 23 | end 24 | -------------------------------------------------------------------------------- /lib/generators/migration/templates/migration_spec.rb.tt: -------------------------------------------------------------------------------- 1 | require_migration 2 | 3 | # This is mostly necessary for data migrations, so feel free to delete this 4 | # file if you do no need it. 5 | describe <%= spec_class_name %> do 6 | # let(:my_model_stub) { migration_stub(:MyModel) } 7 | 8 | migration_context :up do 9 | # Create data 10 | # 11 | # Example: 12 | # 13 | # my_model_stub.create!(attributes) 14 | 15 | migrate 16 | 17 | # Ensure data exists 18 | # 19 | # Example: 20 | # 21 | # expect(record).to have_attributes() 22 | end 23 | 24 | migration_context :down do 25 | # Create data 26 | # 27 | # Example: 28 | # 29 | # my_model_stub.create!(attributes) 30 | 31 | migrate 32 | 33 | # Ensure data exists 34 | # 35 | # Example: 36 | # 37 | # expect(MyModel.count).to eq(0) 38 | end 39 | end 40 | -------------------------------------------------------------------------------- /db/migrate/20180712122000_remove_host_provisioning.rb: -------------------------------------------------------------------------------- 1 | class RemoveHostProvisioning < ActiveRecord::Migration[5.0] 2 | class MiqApproval < ActiveRecord::Base 3 | self.inheritance_column = :_type_disabled 4 | 5 | belongs_to :miq_request, :class_name => 'RemoveHostProvisioning::MiqRequest' 6 | end 7 | 8 | class MiqRequest < ActiveRecord::Base 9 | self.inheritance_column = :_type_disabled 10 | 11 | has_many :miq_approvals, :dependent => :destroy, :class_name => 'RemoveHostProvisioning::MiqApproval' 12 | end 13 | 14 | class MiqRequestTask < ActiveRecord::Base 15 | self.inheritance_column = :_type_disabled 16 | end 17 | 18 | def up 19 | say_with_time("Delete Host Provision Requests and Tasks") do 20 | MiqRequest.where(:type => :MiqHostProvisionRequest).destroy_all 21 | MiqRequestTask.where(:type => :MiqHostProvision).destroy_all 22 | end 23 | end 24 | end 25 | -------------------------------------------------------------------------------- /db/migrate/20250603164430_update_tenant_name.rb: -------------------------------------------------------------------------------- 1 | class UpdateTenantName < ActiveRecord::Migration[7.0] 2 | class SettingsChange < ActiveRecord::Base 3 | include ActiveRecord::IdRegions 4 | end 5 | 6 | class Tenant < ActiveRecord::Base 7 | include ActiveRecord::IdRegions 8 | end 9 | 10 | def change 11 | say_with_time("Updating root tenant's name from settings") do 12 | sc = SettingsChange.in_my_region.find_by(:key => "/server/company") 13 | Tenant.in_my_region.find_by(:ancestry => nil, :use_config_for_attributes => true)&.update(:name => sc&.value || "My Company", :use_config_for_attributes => false) 14 | SettingsChange.in_my_region.where(:key => "/server/company").destroy_all 15 | end 16 | end 17 | 18 | def revert 19 | # no real way to revert 20 | # the record remains as :use_config_for_attributes => false, and Tenant.root.name is used 21 | end 22 | end 23 | -------------------------------------------------------------------------------- /spec/migrations/20221010195912_update_placement_group_view_feature_identifier_spec.rb: -------------------------------------------------------------------------------- 1 | require_migration 2 | 3 | describe UpdatePlacementGroupViewFeatureIdentifier do 4 | let(:miq_product_feature_stub) { migration_stub(:MiqProductFeature) } 5 | 6 | migration_context :up do 7 | it "Update Placement Group '_list' feature to be '_view'" do 8 | miq_product_feature = miq_product_feature_stub.create(:identifier => 'placement_group_list') 9 | migrate 10 | expect(miq_product_feature.reload[:identifier]).to eq('placement_group_view') 11 | end 12 | end 13 | migration_context :down do 14 | it "Reset Placement Group '_view' feature back to '_list'" do 15 | miq_product_feature = miq_product_feature_stub.create(:identifier => 'placement_group_view') 16 | migrate 17 | expect(miq_product_feature.reload[:identifier]).to eq('placement_group_list') 18 | end 19 | end 20 | end 21 | -------------------------------------------------------------------------------- /lib/reserved_shared_mixin.rb: -------------------------------------------------------------------------------- 1 | module ReservedSharedMixin 2 | extend ActiveSupport::Concern 3 | 4 | included do 5 | has_one :reserved_rec, :class_name => "::Reserve", :as => :resource, 6 | :autosave => true, :dependent => :delete 7 | end 8 | 9 | def reserved_hash_get(key) 10 | res = reserved 11 | res && res[key] 12 | end 13 | 14 | def reserved_hash_set(key, val) 15 | res = (reserved || {}) 16 | if val.nil? 17 | res.delete(key) 18 | else 19 | res[key] = val 20 | end 21 | self.reserved = res 22 | val 23 | end 24 | 25 | def reserved 26 | reserved_rec.try(:reserved) 27 | end 28 | 29 | def reserved=(val) 30 | res = reserved_rec 31 | if val.blank? 32 | self.reserved_rec = nil 33 | elsif res.nil? 34 | build_reserved_rec(:reserved => val) 35 | else 36 | res.reserved = val 37 | end 38 | val 39 | end 40 | end 41 | -------------------------------------------------------------------------------- /spec/migrations/20201208092011_append_alert_statuses_feature_spec.rb: -------------------------------------------------------------------------------- 1 | require_migration 2 | 3 | describe AppendAlertStatusesFeature do 4 | let(:user_role_id) { id_in_current_region(1) } 5 | let(:feature_stub) { migration_stub :MiqProductFeature } 6 | let(:roles_feature_stub) { migration_stub :MiqRolesFeature } 7 | 8 | migration_context :up do 9 | it "appends the 'alert_status' feature to all roles with an 'alert' role" do 10 | alert = feature_stub.create!(:identifier => 'alert') 11 | 12 | roles_feature_stub.create!(:miq_product_feature_id => alert.id, :miq_user_role_id => user_role_id) 13 | 14 | migrate 15 | 16 | alert_status = feature_stub.find_by!(:identifier => 'alert_status') 17 | assigned = roles_feature_stub.where(:miq_product_feature_id => alert_status.id, :miq_user_role_id => user_role_id) 18 | 19 | expect(assigned.count).to eq(1) 20 | end 21 | end 22 | end 23 | -------------------------------------------------------------------------------- /db/migrate/20200910163614_adjust_control_explorer_features.rb: -------------------------------------------------------------------------------- 1 | class AdjustControlExplorerFeatures < ActiveRecord::Migration[5.2] 2 | class MiqProductFeature < ActiveRecord::Base; end 3 | 4 | FEATURE_MAPPING = { 5 | 'control_explorer' => 'control' 6 | }.freeze 7 | 8 | def up 9 | return if MiqProductFeature.none? 10 | 11 | say_with_time 'Adjusting control_explorer features for the split explorers' do 12 | # Direct renaming of features 13 | FEATURE_MAPPING.each do |from, to| 14 | MiqProductFeature.find_or_create_by!(:identifier => from)&.update!(:identifier => to) 15 | end 16 | end 17 | end 18 | 19 | def down 20 | say_with_time 'Adjusting split explorer features back to control explorer' do 21 | FEATURE_MAPPING.each do |to, from| 22 | MiqProductFeature.find_by(:identifier => from)&.update!(:identifier => to) 23 | end 24 | end 25 | end 26 | end 27 | -------------------------------------------------------------------------------- /db/migrate/20180605135438_add_resource_to_miq_schedule.rb: -------------------------------------------------------------------------------- 1 | class AddResourceToMiqSchedule < ActiveRecord::Migration[5.0] 2 | class MiqSchedule < ActiveRecord::Base 3 | self.inheritance_column = :_type_disabled 4 | 5 | include ReservedMigrationMixin 6 | end 7 | 8 | def up 9 | add_column :miq_schedules, :resource_id, :bigint 10 | 11 | say_with_time("Migrate data from reserved table to MiqSchedule") do 12 | MiqSchedule.includes(:reserved_rec).each do |schedule| 13 | schedule.reserved_hash_migrate(:resource_id) 14 | end 15 | end 16 | end 17 | 18 | def down 19 | say_with_time("Migrate data from MiqSchedule to reserved table") do 20 | MiqSchedule.includes(:reserved_rec).each do |schedule| 21 | schedule.reserved_hash_set(:resource_id, schedule.resource_id) 22 | schedule.save! 23 | end 24 | end 25 | 26 | remove_column :miq_schedules, :resource_id 27 | end 28 | end 29 | -------------------------------------------------------------------------------- /db/migrate/20190201173316_add_missing_ems_id_to_switch.rb: -------------------------------------------------------------------------------- 1 | class AddMissingEmsIdToSwitch < ActiveRecord::Migration[5.0] 2 | def up 3 | say_with_time("Add missing ems_id to switch") do 4 | connection.execute <<-SQL 5 | UPDATE switches 6 | SET ems_id=hosts.ems_id 7 | FROM host_switches 8 | INNER JOIN hosts ON hosts.id = host_switches.host_id 9 | WHERE host_switches.switch_id = switches.id 10 | AND hosts.ems_id IS NOT NULL 11 | AND switches.shared IS true 12 | SQL 13 | 14 | connection.execute <<-SQL 15 | UPDATE switches 16 | SET host_id=hosts.id 17 | FROM host_switches 18 | INNER JOIN hosts ON hosts.id = host_switches.host_id 19 | WHERE host_switches.switch_id = switches.id 20 | AND switches.ems_id IS NULL 21 | AND switches.shared IS NOT true 22 | SQL 23 | end 24 | end 25 | end 26 | -------------------------------------------------------------------------------- /db/migrate/20200212171537_remove_ovirt_sdk4_from_event_stream.rb: -------------------------------------------------------------------------------- 1 | class RemoveOvirtSdk4FromEventStream < ActiveRecord::Migration[5.1] 2 | disable_ddl_transaction! 3 | include MigrationHelper 4 | 5 | class EventStream < ActiveRecord::Base 6 | include ActiveRecord::IdRegions 7 | 8 | self.inheritance_column = :_type_disabled 9 | end 10 | 11 | def up 12 | say_with_time("Removing OvirtSDK4 types from EmsEvents") do 13 | base_relation = EventStream.in_my_region.where(:source => "RHEVM") 14 | .where("full_data LIKE ?", "%object:OvirtSDK4::Event%") 15 | 16 | say_batch_started(base_relation.size) 17 | 18 | loop do 19 | count = base_relation.limit(50_000) 20 | .update_all("full_data = REGEXP_REPLACE(full_data, '!ruby/object:OvirtSDK4::\\w+', '!ruby/object:Hash', 'g')") 21 | break if count == 0 22 | 23 | say_batch_processed(count) 24 | end 25 | end 26 | end 27 | end 28 | -------------------------------------------------------------------------------- /spec/migrations/20171109225052_remove_string_column_limits_spec.rb: -------------------------------------------------------------------------------- 1 | require_migration 2 | 3 | describe RemoveStringColumnLimits do 4 | let(:connection) { ActiveRecord::Base.connection } 5 | let(:table_name) { "remove_string_column_limits" } 6 | 7 | migration_context :up do 8 | it "removes the limit from string columns" do 9 | connection.execute(<<-SQL) 10 | CREATE TABLE #{table_name} (id bigint, string varchar(255), other_string varchar(36), more_string varchar) 11 | SQL 12 | 13 | migrate 14 | 15 | columns_by_name = connection.columns(table_name).each_with_object({}) do |col, hash| 16 | hash[col.name] = col 17 | end 18 | 19 | expect(columns_by_name["id"].limit).to eq(8) 20 | expect(columns_by_name["string"].limit).to be_nil 21 | expect(columns_by_name["other_string"].limit).to be_nil 22 | expect(columns_by_name["more_string"].limit).to be_nil 23 | end 24 | end 25 | end 26 | -------------------------------------------------------------------------------- /db/migrate/20191122203218_replace_server_capabilities_with_vix_disk_lib.rb: -------------------------------------------------------------------------------- 1 | class ReplaceServerCapabilitiesWithVixDiskLib < ActiveRecord::Migration[5.1] 2 | class MiqServer < ActiveRecord::Base 3 | serialize :capabilities 4 | include ActiveRecord::IdRegions 5 | end 6 | 7 | def up 8 | add_column :miq_servers, :has_vix_disk_lib, :boolean 9 | 10 | MiqServer.in_my_region.each do |miq_server| 11 | miq_server.update( 12 | :has_vix_disk_lib => miq_server.capabilities.try(:[], :vixDisk) || false 13 | ) 14 | end 15 | 16 | remove_column :miq_servers, :capabilities 17 | end 18 | 19 | def down 20 | add_column :miq_servers, :capabilities, :text 21 | 22 | MiqServer.in_my_region.each do |miq_server| 23 | miq_server.update( 24 | :capabilities => { :vixDisk => miq_server.has_vix_disk_lib || false } 25 | ) 26 | end 27 | 28 | remove_column :miq_servers, :has_vix_disk_lib 29 | end 30 | end 31 | -------------------------------------------------------------------------------- /Gemfile: -------------------------------------------------------------------------------- 1 | source "https://rubygems.org" 2 | 3 | # Declare your gem's dependencies in manageiq-schema.gemspec. 4 | # Bundler will treat runtime dependencies like base dependencies, and 5 | # development dependencies will be added by default to the :development group. 6 | gemspec 7 | 8 | plugin "bundler-inject", "~> 1.1" 9 | require File.join(Bundler::Plugin.index.load_paths("bundler-inject")[0], "bundler-inject") rescue nil 10 | 11 | # Declare any dependencies that are still in development here instead of in 12 | # your gemspec. These might include edge Rails or gems from your path or 13 | # Git. Remember to move these dependencies to your gemspec before releasing 14 | # your gem to rubygems.org. 15 | 16 | gem "rails", "~>7.2.3" 17 | 18 | # security fixes for indirect dependencies 19 | gem "rack", ">=2.2.20" # CVE-2025-61919 https://github.com/advisories/GHSA-6xw4-3v39-52mm 20 | gem "thor", ">= 1.4.0" # CVE-2025-54314 https://github.com/advisories/GHSA-mqcp-p2hv-vw6x (railties) 21 | -------------------------------------------------------------------------------- /db/migrate/20190809193031_move_embedded_ansible_proxy_setting_to_git_repository_proxy_settings.rb: -------------------------------------------------------------------------------- 1 | class MoveEmbeddedAnsibleProxySettingToGitRepositoryProxySettings < ActiveRecord::Migration[5.1] 2 | class SettingsChange < ActiveRecord::Base 3 | serialize :value 4 | end 5 | 6 | def up 7 | say_with_time("Moving embedded ansible proxy settings to git repository proxy settings") do 8 | SettingsChange.where("key LIKE ?", "/http_proxy/embedded_ansible/%").each do |s| 9 | s.key = s.key.sub("/http_proxy/embedded_ansible", "/git_repository_proxy") 10 | s.save! 11 | end 12 | end 13 | end 14 | 15 | def down 16 | say_with_time("Moving git repository proxy settings to embedded ansible proxy settings") do 17 | SettingsChange.where("key LIKE ?", "/git_repository_proxy/%").each do |s| 18 | s.key = s.key.sub("/git_repository_proxy", "/http_proxy/embedded_ansible") 19 | s.save! 20 | end 21 | end 22 | end 23 | end 24 | -------------------------------------------------------------------------------- /db/migrate/20210521192754_update_product_features_where_identifier_was_renamed_since_lasker.rb: -------------------------------------------------------------------------------- 1 | class UpdateProductFeaturesWhereIdentifierWasRenamedSinceLasker < ActiveRecord::Migration[6.0] 2 | class MiqProductFeature < ActiveRecord::Base; end 3 | 4 | FEATURE_MAPPING = {'automation_manager_add_provider' => 'ems_automation_add_provider'}.freeze 5 | 6 | def up 7 | return if MiqProductFeature.none? 8 | 9 | say_with_time 'Adjusting Automation Provider add provider feature' do 10 | FEATURE_MAPPING.each do |from, to| 11 | MiqProductFeature.find_by(:identifier => from)&.update!(:identifier => to) 12 | end 13 | end 14 | end 15 | 16 | def down 17 | return if MiqProductFeature.none? 18 | 19 | say_with_time 'Adjusting Automation Provider add provider feature' do 20 | FEATURE_MAPPING.each do |to, from| 21 | MiqProductFeature.find_by(:identifier => from)&.update!(:identifier => to) 22 | end 23 | end 24 | end 25 | end 26 | -------------------------------------------------------------------------------- /spec/migrations/20190909195908_set_zone_visible_column_default_true_spec.rb: -------------------------------------------------------------------------------- 1 | require_migration 2 | 3 | describe SetZoneVisibleColumnDefaultTrue do 4 | let(:zone_stub) { migration_stub(:Zone) } 5 | 6 | migration_context :up do 7 | it "changes visible => nil to true" do 8 | zone = zone_stub.create(:visible => nil) 9 | migrate 10 | zone.reload 11 | expect(zone.visible).to be true 12 | end 13 | end 14 | 15 | migration_context :down do 16 | it "leaves visible => true as true because we can't assume it was previously nil" do 17 | zone = zone_stub.create(:visible => true) 18 | migrate 19 | zone.reload 20 | expect(zone.visible).to be true 21 | end 22 | 23 | it "changes visible => nil to true, it doesn't reverse the update_all when running it" do 24 | zone = zone_stub.create(:visible => nil) 25 | migrate 26 | zone.reload 27 | expect(zone.visible).to be true 28 | end 29 | end 30 | end 31 | -------------------------------------------------------------------------------- /db/migrate/20190307131832_removing_authentication_for_container_deployments.rb: -------------------------------------------------------------------------------- 1 | class RemovingAuthenticationForContainerDeployments < ActiveRecord::Migration[5.0] 2 | class Authentication < ActiveRecord::Base 3 | self.inheritance_column = :_type_disabled # disable STI 4 | end 5 | 6 | def up 7 | say_with_time("Removing Authentications") do 8 | Authentication.where(:type => 'AuthenticationAllowAll').delete_all 9 | Authentication.where(:type => 'AuthenticationGithub').delete_all 10 | Authentication.where(:type => 'AuthenticationGoogle').delete_all 11 | Authentication.where(:type => 'AuthenticationHtpasswd').delete_all 12 | Authentication.where(:type => 'AuthenticationLdap').delete_all 13 | Authentication.where(:type => 'AuthenticationOpenId').delete_all 14 | Authentication.where(:type => 'AuthenticationRequestHeader').delete_all 15 | Authentication.where(:type => 'AuthenticationRhsm').delete_all 16 | end 17 | end 18 | end 19 | -------------------------------------------------------------------------------- /db/migrate/20191126204129_remove_middleware_columns_in_event_streams.rb: -------------------------------------------------------------------------------- 1 | class RemoveMiddlewareColumnsInEventStreams < ActiveRecord::Migration[5.0] 2 | def up 3 | remove_column :event_streams, :middleware_server_id 4 | remove_column :event_streams, :middleware_server_name 5 | remove_column :event_streams, :middleware_deployment_id 6 | remove_column :event_streams, :middleware_deployment_name 7 | remove_column :event_streams, :middleware_domain_id 8 | remove_column :event_streams, :middleware_domain_name 9 | end 10 | 11 | def down 12 | add_column :event_streams, :middleware_server_id, :bigint 13 | add_column :event_streams, :middleware_server_name, :string 14 | add_column :event_streams, :middleware_deployment_id, :bigint 15 | add_column :event_streams, :middleware_deployment_name, :string 16 | add_column :event_streams, :middleware_domain_id, :bigint 17 | add_column :event_streams, :middleware_domain_name, :string 18 | end 19 | end 20 | -------------------------------------------------------------------------------- /spec/replication/util/primary_key_spec.rb: -------------------------------------------------------------------------------- 1 | describe "Replication" do 2 | let(:connection) { ApplicationRecord.connection } 3 | 4 | def invalid_primary_key_message(no_pk) 5 | <<-EOS.gsub!(/^ +/, "") 6 | Primary key "id" not found for the following table(s): 7 | 8 | #{no_pk.join("\n")} 9 | 10 | All tables must have a primary key called "id". 11 | Logical replication requires all tables to have a primary key. 12 | We have chosen to use "id" rather than a composite key to avoid future migration 13 | problems should a table need to move away from a composite key in the future. 14 | EOS 15 | end 16 | 17 | it "all tables have a primary key called id" do 18 | no_pk = [] 19 | connection.tables.each do |t| 20 | next if ManageIQ::Schema::SYSTEM_TABLES.include?(t) 21 | no_pk << t unless connection.primary_keys(t) == ["id"] 22 | end 23 | expect(no_pk.size).to eq(0), invalid_primary_key_message(no_pk) 24 | end 25 | end 26 | -------------------------------------------------------------------------------- /spec/spec_helper.rb: -------------------------------------------------------------------------------- 1 | if ENV['CI'] 2 | require 'simplecov' 3 | SimpleCov.start 4 | end 5 | 6 | ENV["RAILS_ENV"] ||= 'test' 7 | require File.expand_path("../dummy/config/environment", __FILE__) 8 | 9 | require 'rspec/rails' 10 | 11 | require "manageiq/password/rspec_matchers" 12 | ManageIQ::Password.key_root = File.expand_path("dummy/certs", __dir__) 13 | 14 | Dir[File.expand_path("support/**/*.rb", __dir__)].each { |f| require f } 15 | 16 | RSpec.configure do |config| 17 | config.use_transactional_fixtures = true 18 | 19 | config.extend Spec::Support::MigrationHelper::DSL 20 | config.include Spec::Support::MigrationHelper, :migrations => :up 21 | config.include Spec::Support::MigrationIdRegionsHelper, :migrations => :up 22 | config.include Spec::Support::MigrationHelper, :migrations => :down 23 | config.include Spec::Support::MigrationIdRegionsHelper, :migrations => :down 24 | end 25 | 26 | require "rails" 27 | puts 28 | puts "\e[93mUsing Rails #{Rails.version}\e[0m" 29 | -------------------------------------------------------------------------------- /db/migrate/20180525171150_add_deleted_on_to_service_template.rb: -------------------------------------------------------------------------------- 1 | class AddDeletedOnToServiceTemplate < ActiveRecord::Migration[5.0] 2 | class ServiceTemplate < ActiveRecord::Base 3 | self.inheritance_column = :_type_disabled 4 | 5 | include ReservedMigrationMixin 6 | include MigrationStubHelper 7 | end 8 | 9 | def up 10 | add_column :service_templates, :deleted_on, :datetime 11 | 12 | say_with_time("Migrate data from reserved table to service_templates") do 13 | ServiceTemplate.includes(:reserved_rec).each do |st| 14 | st.reserved_hash_migrate(:deleted_on) 15 | end 16 | end 17 | end 18 | 19 | def down 20 | say_with_time("Migrate data from service_templates to reserved table") do 21 | ServiceTemplate.includes(:reserved_rec).each do |st| 22 | st.reserved_hash_set(:deleted_on, st.deleted_on) 23 | st.save! 24 | end 25 | end 26 | 27 | remove_column :service_templates, :deleted_on 28 | end 29 | end 30 | -------------------------------------------------------------------------------- /db/migrate/20220223095704_remove_col3_from_miq_widget_set.rb: -------------------------------------------------------------------------------- 1 | class RemoveCol3FromMiqWidgetSet < ActiveRecord::Migration[6.0] 2 | class MiqWidgetSet < ActiveRecord::Base 3 | include ActiveRecord::IdRegions 4 | self.table_name = "miq_sets" 5 | serialize :set_data 6 | end 7 | 8 | def up 9 | say_with_time("Moving col3 widgets to col2 and removing col3") do 10 | MiqWidgetSet.all.each do |item| 11 | data = item.set_data 12 | if data 13 | data[:col2] = ((data[:col2] || []) + (data[:col3] || [])).uniq.compact 14 | item.update(:set_data => data.except(:col3)) 15 | end 16 | end 17 | end 18 | end 19 | 20 | def down 21 | say_with_time("Adding col3 to widgets and assigining blank to it") do 22 | MiqWidgetSet.all.each do |item| 23 | data = item.set_data 24 | if data 25 | data[:col3] = [] 26 | item.update(:set_data => data) 27 | end 28 | end 29 | end 30 | end 31 | end 32 | -------------------------------------------------------------------------------- /spec/migrations/20181130203334_classification_parent_null_spec.rb: -------------------------------------------------------------------------------- 1 | require_migration 2 | 3 | describe ClassificationParentNull do 4 | let(:parent_id) { id_in_current_region(1) } 5 | let(:classification_stub) { migration_stub(:Classification) } 6 | 7 | migration_context :up do 8 | it 'changes parent to nil when parent is 0' do 9 | c = classification_stub.create(:parent_id => 0) # manageiq:disable HardcodedIds 10 | migrate 11 | c.reload 12 | expect(c.parent_id).to be_nil 13 | end 14 | 15 | it 'leaves other parents alone' do 16 | c = classification_stub.create(:parent_id => parent_id) 17 | migrate 18 | c.reload 19 | expect(c.parent_id).to eq(parent_id) 20 | end 21 | end 22 | 23 | migration_context :down do 24 | it 'changes parent to 0 when parent is null' do 25 | c = classification_stub.create(:parent_id => nil) 26 | migrate 27 | c.reload 28 | expect(c.parent_id).to eq(0) 29 | end 30 | end 31 | end 32 | -------------------------------------------------------------------------------- /db/migrate/20180606083431_convert_quadicon_settings_keys.rb: -------------------------------------------------------------------------------- 1 | class ConvertQuadiconSettingsKeys < ActiveRecord::Migration[5.0] 2 | class User < ActiveRecord::Base 3 | serialize :settings, :type => Hash 4 | end 5 | 6 | def up 7 | say_with_time("Converting :ems quadicon settings keys for users to :ems_infra") do 8 | User.all.each do |user| 9 | settings = user.settings 10 | next unless settings[:quadicons] 11 | settings[:quadicons][:ems_infra] = settings[:quadicons].delete(:ems) 12 | user.update(:settings => settings) 13 | end 14 | end 15 | end 16 | 17 | def down 18 | say_with_time("Converting :ems_infra quadicon settings keys for users to :ems") do 19 | User.all.each do |user| 20 | settings = user.settings 21 | next unless settings[:quadicons] 22 | settings[:quadicons][:ems] = settings[:quadicons].delete(:ems_infra) 23 | user.update(:settings => settings) 24 | end 25 | end 26 | end 27 | end 28 | -------------------------------------------------------------------------------- /db/migrate/20200128122000_add_type_column_to_service_order.rb: -------------------------------------------------------------------------------- 1 | class AddTypeColumnToServiceOrder < ActiveRecord::Migration[5.0] 2 | class ServiceOrder < ActiveRecord::Base 3 | include ActiveRecord::IdRegions 4 | 5 | self.inheritance_column = :_type_disabled # disable STI 6 | end 7 | class MiqRequest < ActiveRecord::Base 8 | include ActiveRecord::IdRegions 9 | 10 | self.inheritance_column = :_type_disabled # disable STI 11 | end 12 | 13 | def up 14 | add_column :service_orders, :type, :string 15 | 16 | say_with_time("Set service_orders type") do 17 | v2v_order_ids = MiqRequest.in_my_region.where(:type => 'ServiceTemplateTransformationPlanRequest').pluck(:service_order_id) 18 | ServiceOrder.where(:id => v2v_order_ids).update_all(:type => 'ServiceOrderV2V') 19 | 20 | ServiceOrder.in_my_region.where(:type => nil).update_all(:type => 'ServiceOrderCart') 21 | end 22 | end 23 | 24 | def down 25 | remove_column :service_orders, :type 26 | end 27 | end 28 | -------------------------------------------------------------------------------- /db/migrate/20210106201124_update_policy_log_startpage_url.rb: -------------------------------------------------------------------------------- 1 | class UpdatePolicyLogStartpageUrl < ActiveRecord::Migration[5.2] 2 | class User < ActiveRecord::Base 3 | serialize :settings, :type => Hash 4 | end 5 | 6 | def up 7 | say_with_time 'Updating start page url for users who had Policy Log set' do 8 | User.select(:id, :settings).each do |user| 9 | if user.settings&.dig(:display, :startpage) == 'miq_policy/log' 10 | user.update!(:settings => user.settings.deep_merge(:display => {:startpage => 'miq_policy_log'})) 11 | end 12 | end 13 | end 14 | end 15 | 16 | def down 17 | say_with_time 'Reverting start page url for users who had Policy Log pages set' do 18 | User.select(:id, :settings).each do |user| 19 | if user.settings&.dig(:display, :startpage) == 'miq_policy_log' 20 | user.update!(:settings => user.settings.deep_merge(:display => {:startpage => 'miq_policy/log'})) 21 | end 22 | end 23 | end 24 | end 25 | end 26 | -------------------------------------------------------------------------------- /spec/dummy/app/views/pwa/service-worker.js: -------------------------------------------------------------------------------- 1 | // Add a service worker for processing Web Push notifications: 2 | // 3 | // self.addEventListener("push", async (event) => { 4 | // const { title, options } = await event.data.json() 5 | // event.waitUntil(self.registration.showNotification(title, options)) 6 | // }) 7 | // 8 | // self.addEventListener("notificationclick", function(event) { 9 | // event.notification.close() 10 | // event.waitUntil( 11 | // clients.matchAll({ type: "window" }).then((clientList) => { 12 | // for (let i = 0; i < clientList.length; i++) { 13 | // let client = clientList[i] 14 | // let clientPath = (new URL(client.url)).pathname 15 | // 16 | // if (clientPath == event.notification.data.path && "focus" in client) { 17 | // return client.focus() 18 | // } 19 | // } 20 | // 21 | // if (clients.openWindow) { 22 | // return clients.openWindow(event.notification.data.path) 23 | // } 24 | // }) 25 | // ) 26 | // }) 27 | -------------------------------------------------------------------------------- /db/migrate/20200428143000_create_network_service.rb: -------------------------------------------------------------------------------- 1 | class CreateNetworkService < ActiveRecord::Migration[5.0] 2 | def change 3 | create_table :network_services do |t| 4 | t.string :type 5 | t.string :name 6 | t.string :description 7 | t.string :ems_ref 8 | t.references :ems, :type => :bigint 9 | t.references :cloud_tenant, :type => :bigint 10 | t.timestamps 11 | end 12 | 13 | create_table :network_service_entries do |t| 14 | t.string :type 15 | t.string :name 16 | t.string :description 17 | t.string :ems_ref 18 | t.references :ems, :type => :bigint 19 | t.references :network_service, :type => :bigint 20 | t.string :protocol 21 | t.string :source_ports 22 | t.string :destination_ports 23 | t.timestamps 24 | end 25 | 26 | add_index :network_services, :type 27 | add_index :network_service_entries, :type 28 | end 29 | end 30 | -------------------------------------------------------------------------------- /spec/migrations/20240214165402_remove_openstack_network_manager_metrics_collector_workers_spec.rb: -------------------------------------------------------------------------------- 1 | require_migration 2 | 3 | # This is mostly necessary for data migrations, so feel free to delete this 4 | # file if you do no need it. 5 | describe RemoveOpenstackNetworkManagerMetricsCollectorWorkers do 6 | let(:miq_worker) { migration_stub(:MiqWorker) } 7 | 8 | migration_context :up do 9 | it "deletes Openstack NetworkManager MetricsCollectorWorker workers" do 10 | miq_worker.create!(:type => "ManageIQ::Providers::Openstack::NetworkManager::MetricsCollectorWorker") 11 | 12 | migrate 13 | 14 | expect(miq_worker.count).to eq(0) 15 | end 16 | 17 | it "doesn't impact other workers" do 18 | miq_worker.create!(:type => "ManageIQ::Providers::Openstack::CloudManager::MetricsCollectorWorker") 19 | miq_worker.create!(:type => "ManageIQ::Providers::Vmware::InfraManager::MetricsCollectorWorker") 20 | 21 | migrate 22 | 23 | expect(miq_worker.count).to eq(2) 24 | end 25 | end 26 | end 27 | -------------------------------------------------------------------------------- /db/migrate/20210106180202_update_policy_rsop_startpage_url.rb: -------------------------------------------------------------------------------- 1 | class UpdatePolicyRsopStartpageUrl < ActiveRecord::Migration[5.2] 2 | class User < ActiveRecord::Base 3 | serialize :settings, :type => Hash 4 | end 5 | 6 | def up 7 | say_with_time 'Updating start page url for users who had Policy Simulation set' do 8 | User.select(:id, :settings).each do |user| 9 | if user.settings&.dig(:display, :startpage) == 'miq_policy/rsop' 10 | user.update!(:settings => user.settings.deep_merge(:display => {:startpage => 'miq_policy_rsop'})) 11 | end 12 | end 13 | end 14 | end 15 | 16 | def down 17 | say_with_time 'Reverting start page url for users who had Policy Simulation pages set' do 18 | User.select(:id, :settings).each do |user| 19 | if user.settings&.dig(:display, :startpage) == 'miq_policy_rsop' 20 | user.update!(:settings => user.settings.deep_merge(:display => {:startpage => 'miq_policy/rsop'})) 21 | end 22 | end 23 | end 24 | end 25 | end 26 | -------------------------------------------------------------------------------- /spec/dummy/.gitignore: -------------------------------------------------------------------------------- 1 | # See https://help.github.com/articles/ignoring-files for more about ignoring files. 2 | # 3 | # Temporary files generated by your text editor or operating system 4 | # belong in git's global ignore instead: 5 | # `$XDG_CONFIG_HOME/git/ignore` or `~/.config/git/ignore` 6 | 7 | # Ignore bundler config. 8 | /.bundle 9 | 10 | # Ignore all environment files (except templates). 11 | /.env* 12 | !/.env*.erb 13 | 14 | # Ignore all logfiles and tempfiles. 15 | /log/* 16 | /tmp/* 17 | !/log/.keep 18 | !/tmp/.keep 19 | 20 | # Ignore pidfiles, but keep the directory. 21 | /tmp/pids/* 22 | !/tmp/pids/ 23 | !/tmp/pids/.keep 24 | 25 | # Ignore storage (uploaded files in development and any SQLite databases). 26 | /storage/* 27 | !/storage/.keep 28 | /tmp/storage/* 29 | !/tmp/storage/ 30 | !/tmp/storage/.keep 31 | 32 | /public/assets 33 | 34 | # Ignore master key for decrypting credentials and more. 35 | /config/master.key 36 | 37 | # Ignores for working with manageiq-schema plugin 38 | /config/database.yml 39 | /db/schema.rb 40 | -------------------------------------------------------------------------------- /db/migrate/20201022201901_update_amazon_tag_mapper_resource_type.rb: -------------------------------------------------------------------------------- 1 | class UpdateAmazonTagMapperResourceType < ActiveRecord::Migration[5.2] 2 | class ProviderTagMapping < ActiveRecord::Base 3 | end 4 | 5 | def up 6 | say_with_time("Update ProviderTagMapping Vm label") do 7 | ProviderTagMapping.where(:labeled_resource_type => "Vm").update_all(:labeled_resource_type => "VmAmazon") 8 | end 9 | say_with_time("Update ProviderTagMapping Image label") do 10 | ProviderTagMapping.where(:labeled_resource_type => "Image").update_all(:labeled_resource_type => "ImageAmazon") 11 | end 12 | end 13 | 14 | def down 15 | say_with_time("Update ProviderTagMapping VmAmazon label") do 16 | ProviderTagMapping.where(:labeled_resource_type => "VmAmazon").update_all(:labeled_resource_type => "Vm") 17 | end 18 | say_with_time("Update ProviderTagMapping ImageAmazon label") do 19 | ProviderTagMapping.where(:labeled_resource_type => "ImageAmazon").update_all(:labeled_resource_type => "Image") 20 | end 21 | end 22 | end 23 | -------------------------------------------------------------------------------- /spec/dummy/config/locales/en.yml: -------------------------------------------------------------------------------- 1 | # Files in the config/locales directory are used for internationalization and 2 | # are automatically loaded by Rails. If you want to use locales other than 3 | # English, add the necessary files in this directory. 4 | # 5 | # To use the locales, use `I18n.t`: 6 | # 7 | # I18n.t "hello" 8 | # 9 | # In views, this is aliased to just `t`: 10 | # 11 | # <%= t("hello") %> 12 | # 13 | # To use a different locale, set it with `I18n.locale`: 14 | # 15 | # I18n.locale = :es 16 | # 17 | # This would use the information in config/locales/es.yml. 18 | # 19 | # To learn more about the API, please read the Rails Internationalization guide 20 | # at https://guides.rubyonrails.org/i18n.html. 21 | # 22 | # Be aware that YAML interprets the following case-insensitive strings as 23 | # booleans: `true`, `false`, `on`, `off`, `yes`, `no`. Therefore, these strings 24 | # must be quoted to be interpreted as strings. For example: 25 | # 26 | # en: 27 | # "yes": yup 28 | # enabled: "ON" 29 | 30 | en: 31 | hello: "Hello world" 32 | -------------------------------------------------------------------------------- /db/migrate/20210106200226_update_policy_export_startpage_url.rb: -------------------------------------------------------------------------------- 1 | class UpdatePolicyExportStartpageUrl < ActiveRecord::Migration[5.2] 2 | class User < ActiveRecord::Base 3 | serialize :settings, :type => Hash 4 | end 5 | 6 | def up 7 | say_with_time 'Update start page url path for users who had Policy Import/Export set' do 8 | User.select(:id, :settings).each do |user| 9 | if user.settings&.dig(:display, :startpage) == 'miq_policy/export' 10 | user.update!(:settings => user.settings.deep_merge(:display => {:startpage => 'miq_policy_export'})) 11 | end 12 | end 13 | end 14 | end 15 | 16 | def down 17 | say_with_time 'Reverting start page url path for users who had Policy Import/Export pages set' do 18 | User.select(:id, :settings).each do |user| 19 | if user.settings&.dig(:display, :startpage) == 'miq_policy_export' 20 | user.update!(:settings => user.settings.deep_merge(:display => {:startpage => 'miq_policy/export'})) 21 | end 22 | end 23 | end 24 | end 25 | end 26 | --------------------------------------------------------------------------------