Exemplo n.º 1
0
    def configure(self, configuration, service_register):
        auto_config = configuration.property_groups.get_property_group(
            BootProperties)
        if auto_config.progress_event_log.service_enabled is True:
            logger.debug('Bootstrapping Progress Event Log Writer Service')
            validate_no_service_with_capability_exists(
                service_register, ProgressEventLogWriterCapability,
                'ProgressEventLogWriter',
                'bootstrap.progress_event_log.service_enabled')
            service_register.add_service(
                ServiceRegistration(
                    ProgressEventLogWriterService,
                    serializer_service=ProgressEventLogSerializerCapability))
        else:
            logger.debug(
                'Disabled: bootstrapped Progress Event Log Writer Service')

        if auto_config.progress_event_log.serializer_service_enabled is True:
            logger.debug('Bootstrapping Progress Event Log Serializer Service')
            validate_no_service_with_capability_exists(
                service_register, ProgressEventLogSerializerCapability,
                'ProgressEventLogSerializer',
                'bootstrap.progress_event_log.serializer_service_enabled')
            service_register.add_service(
                ServiceRegistration(YAMLProgressEventLogSerializer))
        else:
            logger.debug(
                'Disabled: bootstrapped Progress Event Log Serializer Service')
Exemplo n.º 2
0
 def configure(self, configuration, service_register):
     admin_properties = configuration.property_groups.get_property_group(OpenstackAdminProperties)
     if admin_properties.enabled is True:
         logger.debug('Configuring Openstack Admin Services')
         service_register.add_service(ServiceRegistration(OpenstackAdminApiService, service=OpenstackAdminCapability))
         service_register.add_service(ServiceRegistration(OpenstackAdminService, OpenstackDeploymentLocationTranslator()))
     else:
         logger.debug('Disabled: Openstack Admin Services')
Exemplo n.º 3
0
 def configure(self, configuration, service_register):
     auto_config = configuration.property_groups.get_property_group(BootProperties)
     if auto_config.templating.service_enabled is True:
         logger.debug('Bootstrapping Templating Service')
         validate_no_service_with_capability_exists(service_register, TemplatingCapability, 'Templating', 'bootstrap.templating.service_enabled')
         service_register.add_service(ServiceRegistration(Jinja2TemplatingService))
     else:
         logger.debug('Disabled: bootstrapped Templating Service')
     if auto_config.templating.resource_context_service_enabled is True:
         logger.debug('Bootstrapping Resource Template Context Service')
         validate_no_service_with_capability_exists(service_register, ResourceTemplateContextCapability, 'Resource Template Context', 'bootstrap.templating.resource_context_service_enabled')
         service_register.add_service(ServiceRegistration(ResourceTemplateContextService))
     else:
         logger.debug('Disabled: bootstrapped Resource Template Context Service')
Exemplo n.º 4
0
 def test_configure_resource_context_service(self):
     configuration = self.__bootstrap_config()
     configuration.property_groups.get_property_group(BootProperties).templating.resource_context_service_enabled = True
     self.mock_service_register.get_service_offering_capability.return_value = None
     TemplatingConfigurator().configure(configuration, self.mock_service_register)
     registered_service = self.assert_single_service_registered()
     self.assert_service_registration_equal(registered_service, ServiceRegistration(ResourceTemplateContextService))
Exemplo n.º 5
0
 def test_configure(self, mock_topic_creator_init):
     configuration = self.__bootstrap_config()
     configuration.property_groups.get_property_group(BootProperties).job_queue.service_enabled = True
     self.mock_service_register.get_service_offering_capability.return_value = None
     JobQueueConfigurator().configure(configuration, self.mock_service_register)
     registered_service = self.assert_single_service_registered()
     self.assert_service_registration_equal(registered_service, ServiceRegistration(
         MessagingJobQueueService, job_queue_config=JobQueueProperties, postal_service=PostalCapability, inbox_service=InboxCapability, topics_config=TopicsProperties, messaging_config=MessagingProperties))
Exemplo n.º 6
0
 def configure(self, configuration, service_register):
     service_register.add_service(
         ServiceRegistration(
             AnsibleProcessorService,
             configuration,
             AnsibleClient(configuration),
             request_queue_service=LifecycleRequestQueueCapability,
             messaging_service=LifecycleMessagingCapability))
Exemplo n.º 7
0
 def __configure_api_service(self, configuration, service_register):
     auto_config = configuration.property_groups.get_property_group(BootProperties)
     if auto_config.management.api_service_enabled is True:
         logger.debug('Bootstrapping Management API Service')
         # Check if a user has enabled the auto configuration of the Management API service but has also added their own
         validate_no_service_with_capability_exists(service_register, ManagementApi, 'Management API (ManagementApi)', 'bootstrap.management.api_service_enabled')
         service_register.add_service(ServiceRegistration(ManagementApiService, service=Management))
     else:
         logger.debug('Disabled: bootstrapped Management API Service')
Exemplo n.º 8
0
 def __configure_api_service(self, configuration, service_register):
     auto_config = configuration.property_groups.get_property_group(BootProperties)
     if auto_config.resource_driver.api_service_enabled is True:
         logger.debug('Bootstrapping Resource Driver API Service')
         # Check if a user has enabled the auto configuration of the Lifecycle API service but has also added their own
         validate_no_service_with_capability_exists(service_register, ResourceDriverApiCapability, 'Resource Driver API', 'bootstrap.resource_driver.api_service_enabled')
         service_register.add_service(ServiceRegistration(ResourceDriverApiService, service=ResourceDriverServiceCapability))
     else:
         logger.debug('Disabled: bootstrapped Resource Driver API Service')
Exemplo n.º 9
0
 def __configure_scripts_file_manager(self, configuration, service_register):
     auto_config = configuration.property_groups.get_property_group(BootProperties)
     if auto_config.resource_driver.driver_files_manager_service_enabled is True:
         logger.debug('Bootstrapping Driver File Manager Service')
         validate_no_service_with_capability_exists(service_register, DriverFilesManagerCapability, 'Driver File Manager Service',
                                                    'bootstrap.resource_driver.driver_files_manager_service_enabled')
         service_register.add_service(ServiceRegistration(DriverFilesManagerService, resource_driver_config=ResourceDriverProperties))
     else:
         logger.debug('Disabled: bootstrapped Driver File Manager Service')
Exemplo n.º 10
0
 def __configure_health_service(self, configuration, service_register):
     auto_config = configuration.property_groups.get_property_group(BootProperties)
     if auto_config.management.health.service_enabled is True:
         logger.debug('Bootstrapping Health Checker Service')
         # Check if a user has enabled the auto configuration of the HealthChecker service but has also added their own
         validate_no_service_with_capability_exists(service_register, HealthChecker, 'HealthChecker', 'bootstrap.management.health.service_enabled')
         service_register.add_service(ServiceRegistration(HealthCheckerService))
     else:
         logger.debug('Disabled: bootstrapped Health Checker Service')
Exemplo n.º 11
0
 def __configure_monitoring(self, configuration, service_register):
     auto_config = configuration.property_groups.get_property_group(BootProperties)
     if auto_config.resource_driver.lifecycle_monitoring_service_enabled is True:
         logger.debug('Bootstrapping Resource Driver Lifecycle Monitoring Service')
         validate_no_service_with_capability_exists(service_register, LifecycleExecutionMonitoringCapability,
                                                    'Resource Driver Lifecycle Execution Monitoring Service', 'bootstrap.resource_driver.lifecycle_monitoring_service_enabled')
         service_register.add_service(ServiceRegistration(LifecycleExecutionMonitoringService, job_queue_service=JobQueueCapability,
                                                          lifecycle_messaging_service=LifecycleMessagingCapability, handler=ResourceDriverHandlerCapability))
     else:
         logger.debug('Disabled: bootstrapped Resource Driver Lifecycle Monitoring Service')
Exemplo n.º 12
0
 def configure(self, configuration, service_register):
     service_register.add_service(
         ServiceRegistration(AnsibleYAMLProgressEventLogSerializer))
     service_register.add_service(
         ServiceRegistration(ExtendedResourceTemplateContextService))
     service_register.add_service(
         ServiceRegistration(
             AnsibleClient,
             configuration,
             render_context_service=ResourceTemplateContextCapability,
             templating=TemplatingCapability,
             event_logger=ProgressEventLogWriterCapability))
     service_register.add_service(
         ServiceRegistration(
             AnsibleProcessorService,
             configuration,
             ansible_client=AnsibleClientCapability,
             request_queue_service=LifecycleRequestQueueCapability,
             messaging_service=LifecycleMessagingCapability))
Exemplo n.º 13
0
 def test_configure_health_service(self):
     configuration = self.__bootstrap_config()
     configuration.property_groups.get_property_group(
         BootProperties).management.health.service_enabled = True
     self.mock_service_register.get_service_offering_capability.return_value = None
     ManagmentServicesConfigurator().configure(configuration,
                                               self.mock_service_register)
     service_registrations = self.assert_services_registered(1)
     self.assert_service_registration_equal(
         service_registrations[0],
         ServiceRegistration(HealthCheckerService))
Exemplo n.º 14
0
 def test_configure_api_service(self):
     configuration = self.__bootstrap_config()
     configuration.property_groups.get_property_group(
         BootProperties).management.api_service_enabled = True
     self.mock_service_register.get_service_offering_capability.return_value = None
     ManagmentServicesConfigurator().configure(configuration,
                                               self.mock_service_register)
     registered_service = self.assert_single_service_registered()
     self.assert_service_registration_equal(
         registered_service,
         ServiceRegistration(ManagementApiService, service=Management))
Exemplo n.º 15
0
 def test_configure_postal(self):
     configuration = self.__bootstrap_config()
     configuration.property_groups.get_property_group(
         BootProperties).messaging.postal_enabled = True
     self.mock_service_register.get_service_offering_capability.return_value = None
     MessagingConfigurator().configure(configuration,
                                       self.mock_service_register)
     registered_service = self.assert_single_service_registered()
     self.assert_service_registration_equal(
         registered_service,
         ServiceRegistration(PostalService,
                             delivery_service=DeliveryCapability))
Exemplo n.º 16
0
 def test_configure_api_service(self):
     configuration = self.__bootstrap_config()
     configuration.property_groups.get_property_group(
         BootProperties).resource_driver.api_service_enabled = True
     self.mock_service_register.get_service_offering_capability.return_value = None
     ResourceDriverServicesConfigurator().configure(
         configuration, self.mock_service_register)
     registered_service = self.assert_single_service_registered()
     self.assert_service_registration_equal(
         registered_service,
         ServiceRegistration(ResourceDriverApiService,
                             service=ResourceDriverServiceCapability))
Exemplo n.º 17
0
 def __configure_service(self, configuration, service_register):
     auto_config = configuration.property_groups.get_property_group(BootProperties)
     if auto_config.management.service_enabled is True:
         logger.debug('Bootstrapping Management Service')
         # Check if a user has enabled the auto configuration of the Management service but has also added their own
         validate_no_service_with_capability_exists(service_register, Management, 'Management', 'bootstrap.management.service_enabled')
         required_capabilities = {
             'health_checker': HealthChecker
         }
         service_register.add_service(ServiceRegistration(ManagementService, **required_capabilities))
     else:
         logger.debug('Disabled: bootstrapped Management Service')
Exemplo n.º 18
0
 def test_configure_serializer_service(self):
     configuration = self.__bootstrap_config()
     configuration.property_groups.get_property_group(
         BootProperties
     ).progress_event_log.serializer_service_enabled = True
     self.mock_service_register.get_service_offering_capability.return_value = None
     ProgressEventLogConfigurator().configure(configuration,
                                              self.mock_service_register)
     registered_service = self.assert_single_service_registered()
     self.assert_service_registration_equal(
         registered_service,
         ServiceRegistration(YAMLProgressEventLogSerializer))
Exemplo n.º 19
0
 def __configure_postal(self, configuration, service_register):
     auto_config = configuration.property_groups.get_property_group(
         BootProperties)
     if auto_config.messaging.postal_enabled is True:
         logger.debug('Bootstrapping Messaging Postal Service')
         validate_no_service_with_capability_exists(
             service_register, PostalCapability, 'Postal Service',
             'bootstrap.messaging.postal_enabled')
         service_register.add_service(
             ServiceRegistration(PostalService,
                                 delivery_service=DeliveryCapability))
     else:
         logger.debug('Disabled: bootstrapped Messaging Postal Service')
Exemplo n.º 20
0
 def test_configure_delivery(self):
     configuration = self.__bootstrap_config()
     configuration.property_groups.get_property_group(
         BootProperties).messaging.delivery_enabled = True
     configuration.property_groups.get_property_group(
         MessagingProperties).connection_address = 'testaddr'
     self.mock_service_register.get_service_offering_capability.return_value = None
     MessagingConfigurator().configure(configuration,
                                       self.mock_service_register)
     registered_service = self.assert_single_service_registered()
     self.assert_service_registration_equal(
         registered_service,
         ServiceRegistration(KafkaDeliveryService,
                             messaging_properties=MessagingProperties))
Exemplo n.º 21
0
 def __configure_messaging(self, configuration, service_register):
     auto_config = configuration.property_groups.get_property_group(BootProperties)
     if auto_config.resource_driver.lifecycle_messaging_service_enabled is True:
         logger.debug('Bootstrapping Resource Driver Lifecycle Messaging Service')
         validate_no_service_with_capability_exists(service_register, LifecycleMessagingCapability, 'Resource Driver Lifecycle Messaging Service', 'bootstrap.resource_driver.lifecycle_messaging_service_enabled')
         messaging_config = configuration.property_groups.get_property_group(MessagingProperties)
         if messaging_config.connection_address is None:
             raise ValueError('messaging.connection_address must be set when bootstrap.resource_driver.lifecycle_messaging_service_enabled')
         if messaging_config.topics.lifecycle_execution_events is None:
             raise ValueError('messaging.topics.lifecycle_execution_events must be set when bootstrap.resource_driver.lifecycle_messaging_service_enabled')
         TopicCreator().create_topic_if_needed(messaging_config, messaging_config.topics.lifecycle_execution_events)
         service_register.add_service(ServiceRegistration(LifecycleMessagingService, postal_service=PostalCapability, topics_configuration=TopicsProperties))
     else:
         logger.debug('Disabled: bootstrapped Resource Driver Lifecycle Messaging Service')
Exemplo n.º 22
0
 def test_configure_messaging(self):
     configuration = self.__bootstrap_config()
     configuration.property_groups.get_property_group(
         BootProperties
     ).resource_driver.lifecycle_messaging_service_enabled = True
     self.mock_service_register.get_service_offering_capability.return_value = None
     ResourceDriverServicesConfigurator().configure(
         configuration, self.mock_service_register)
     registered_service = self.assert_single_service_registered()
     self.assert_service_registration_equal(
         registered_service,
         ServiceRegistration(LifecycleMessagingService,
                             postal_service=PostalCapability,
                             topics_configuration=TopicsProperties))
Exemplo n.º 23
0
 def test_configure_scripts_file_manager(self):
     configuration = self.__bootstrap_config()
     configuration.property_groups.get_property_group(
         BootProperties
     ).resource_driver.driver_files_manager_service_enabled = True
     self.mock_service_register.get_service_offering_capability.return_value = None
     ResourceDriverServicesConfigurator().configure(
         configuration, self.mock_service_register)
     registered_service = self.assert_single_service_registered()
     self.assert_service_registration_equal(
         registered_service,
         ServiceRegistration(
             DriverFilesManagerService,
             resource_driver_config=ResourceDriverProperties))
Exemplo n.º 24
0
    def configure(self, configuration, service_register):
        auto_config = configuration.property_groups.get_property_group(
            BootProperties)
        if auto_config.request_queue.enabled is True:
            logger.debug('Bootstrapping Request Queue Service')

            messaging_config = configuration.property_groups.get_property_group(
                MessagingProperties)
            resource_driver_config = configuration.property_groups.get_property_group(
                ResourceDriverProperties)
            self.configure_topics(
                configuration, messaging_config,
                resource_driver_config.lifecycle_request_queue)

            if auto_config.resource_driver.api_enabled is True:
                validate_no_service_with_capability_exists(
                    service_register, LifecycleRequestQueueCapability,
                    'Lifecycle Request Queue',
                    'bootstrap.request_queue.enabled')
                service_register.add_service(
                    ServiceRegistration(
                        KafkaLifecycleConsumerFactory,
                        resource_driver_config.lifecycle_request_queue,
                        messaging_properties=MessagingProperties))
                service_register.add_service(
                    ServiceRegistration(
                        KafkaLifecycleRequestQueueService,
                        lifecycle_messaging_service=
                        LifecycleMessagingCapability,
                        messaging_properties=MessagingProperties,
                        resource_driver_config=ResourceDriverProperties,
                        postal_service=PostalCapability,
                        driver_files_manager=DriverFilesManagerCapability,
                        lifecycle_consumer_factory=
                        LifecycleConsumerFactoryCapability))
        else:
            logger.debug('Disabled: bootstrapped Request Queue Service')
Exemplo n.º 25
0
    def test_configure_request_queue_service(self):
        configuration = self.__bootstrap_config()
        configuration.property_groups.get_property_group(
            BootProperties).request_queue.enabled = True
        configuration.property_groups.get_property_group(
            BootProperties).resource_driver.api_enabled = True

        self.mock_service_register.get_service_offering_capability.return_value = None
        RequestQueueConfigurator(self.mock_topic_creator).configure(
            configuration, self.mock_service_register)
        registered_service = self.assert_services_registered(2)

        self.assert_service_registration_equal(
            registered_service[1],
            ServiceRegistration(
                KafkaLifecycleRequestQueueService,
                lifecycle_messaging_service=LifecycleMessagingCapability,
                messaging_properties=MessagingProperties,
                resource_driver_config=ResourceDriverProperties,
                postal_service=PostalCapability,
                driver_files_manager=DriverFilesManagerCapability,
                lifecycle_consumer_factory=LifecycleConsumerFactoryCapability))

        self.mock_topic_creator.create_topic_if_needed.assert_called()
        service_calls = self.mock_topic_creator.create_topic_if_needed.call_args_list
        self.assertEqual(len(service_calls), 2)

        service_call = service_calls[0]
        service_call_args, kwargs = service_call
        self.assertEqual(len(service_call_args), 2)
        messaging_properties = service_call_args[0]
        self.assertEqual(messaging_properties.connection_address, "kafka")
        self.assertEqual(messaging_properties.config, {
            'api_version_auto_timeout_ms': 5000,
        })
        topic_config_properties = service_call_args[1]
        self.assertIsInstance(topic_config_properties, TopicConfigProperties)

        service_call = service_calls[1]
        service_call_args, kwargs = service_call
        self.assertEqual(len(service_call_args), 2)
        messaging_properties = service_call_args[0]
        self.assertEqual(messaging_properties.connection_address, "kafka")
        self.assertEqual(messaging_properties.config, {
            'api_version_auto_timeout_ms': 5000,
        })
        topic_config_properties = service_call_args[1]
        self.assertIsInstance(topic_config_properties, TopicConfigProperties)
Exemplo n.º 26
0
 def test_configure_monitoring(self):
     configuration = self.__bootstrap_config()
     configuration.property_groups.get_property_group(
         BootProperties
     ).resource_driver.lifecycle_monitoring_service_enabled = True
     self.mock_service_register.get_service_offering_capability.return_value = None
     ResourceDriverServicesConfigurator().configure(
         configuration, self.mock_service_register)
     service_registrations = self.assert_services_registered(1)
     self.assert_service_registration_equal(
         service_registrations[0],
         ServiceRegistration(
             LifecycleExecutionMonitoringService,
             job_queue_service=JobQueueCapability,
             lifecycle_messaging_service=LifecycleMessagingCapability,
             handler=ResourceDriverHandlerCapability))
Exemplo n.º 27
0
 def test_configure_service_does_not_include_monitoring_when_async_messaging_disabled(
         self):
     configuration = self.__bootstrap_config()
     configuration.property_groups.get_property_group(
         BootProperties).resource_driver.service_enabled = True
     configuration.property_groups.get_property_group(
         ResourceDriverProperties).async_messaging_enabled = False
     self.mock_service_register.get_service_offering_capability.return_value = None
     ResourceDriverServicesConfigurator().configure(
         configuration, self.mock_service_register)
     service_registrations = self.assert_services_registered(1)
     self.assert_service_registration_equal(
         service_registrations[0],
         ServiceRegistration(
             ResourceDriverService,
             handler=ResourceDriverHandlerCapability,
             resource_driver_config=ResourceDriverProperties,
             driver_files_manager=DriverFilesManagerCapability))
Exemplo n.º 28
0
 def __configure_inbox(self, configuration, service_register):
     auto_config = configuration.property_groups.get_property_group(
         BootProperties)
     if auto_config.messaging.inbox_enabled is True:
         logger.debug('Bootstrapping Messaging Inbox Service')
         messaging_config = configuration.property_groups.get_property_group(
             MessagingProperties)
         if messaging_config.connection_address is None:
             raise ValueError(
                 'messaging.connection_address must be set when bootstrap.messaging.inbox_enabled is True'
             )
         validate_no_service_with_capability_exists(
             service_register, InboxCapability, 'Inbox Service',
             'bootstrap.messaging.inbox_enabled')
         service_register.add_service(
             ServiceRegistration(KafkaInboxService,
                                 messaging_properties=MessagingProperties))
     else:
         logger.debug('Disabled: bootstrapped Messaging Inbox Service')
Exemplo n.º 29
0
 def test_configure_service(self):
     configuration = self.__bootstrap_config()
     configuration.property_groups.get_property_group(
         BootProperties).resource_driver.service_enabled = True
     configuration.property_groups.get_property_group(
         BootProperties).resource_driver.service_driver = self.DummyDriver
     self.mock_service_register.get_service_offering_capability.return_value = None
     ResourceDriverServicesConfigurator().configure(
         configuration, self.mock_service_register)
     service_registrations = self.assert_services_registered(1)
     self.assert_service_registration_equal(
         service_registrations[0],
         ServiceRegistration(
             ResourceDriverService,
             handler=ResourceDriverHandlerCapability,
             resource_driver_config=ResourceDriverProperties,
             driver_files_manager=DriverFilesManagerCapability,
             lifecycle_monitor_service=LifecycleExecutionMonitoringCapability
         ))
Exemplo n.º 30
0
    def __configure_service(self, configuration, service_register):
        auto_config = configuration.property_groups.get_property_group(BootProperties)
        if auto_config.resource_driver.service_enabled is True:
            logger.debug('Bootstrapping Resource Driver Service')
            # Check if a user has enabled the auto configuration of the Resource Driver service but has also added their own
            validate_no_service_with_capability_exists(service_register, ResourceDriverServiceCapability, 'Resource Driver Service', 'bootstrap.resource_driver.service_enabled')
            resource_driver_config = configuration.property_groups.get_property_group(ResourceDriverProperties)

            required_capabilities = {}
            if resource_driver_config.async_messaging_enabled is True:
                required_capabilities['lifecycle_monitor_service'] = LifecycleExecutionMonitoringCapability
            required_capabilities['handler'] = ResourceDriverHandlerCapability
            required_capabilities['resource_driver_config'] = ResourceDriverProperties
            required_capabilities['driver_files_manager'] = DriverFilesManagerCapability

            if resource_driver_config.lifecycle_request_queue.enabled is True:
                required_capabilities['lifecycle_request_queue'] = LifecycleRequestQueueCapability

            service_register.add_service(ServiceRegistration(ResourceDriverService, **required_capabilities))
        else:
            logger.debug('Disabled: bootstrapped Resource Driver Service')