Exemplo n.º 1
0
def purge_service():
    flow = graph_flow.Flow('Purging poppy-service').add(
        purge_service_tasks.PurgeProviderServicesTask(),
        linear_flow.Flow('Purge provider details').add(
            common.UpdateProviderDetailErrorTask(rebind=['responders'])),
        common.UpdateProviderDetailIfNotEmptyTask(
            rebind=['changed_provider_details_dict']))
    return flow
Exemplo n.º 2
0
 def mock_purge_service(self, mock_bootstrap, hard=False):
     mock_bootstrap.return_value = self.bootstrap_obj
     purge_provider = purge_service_tasks.PurgeProviderServicesTask()
     provider_details = json.dumps(
         dict([(k, v.to_dict()) for k, v in self.provider_details.items()]))
     responders = \
         purge_provider.execute(json.dumps(self.service_obj.to_dict()),
                                json.dumps(hard),
                                provider_details,
                                str(None))
     error_update = common.UpdateProviderDetailErrorTask()
     changed_provider_details_dict = error_update.execute(
         responders, self.service_id, provider_details, hard)
     not_empty_update = common.UpdateProviderDetailIfNotEmptyTask()
     not_empty_update.execute(changed_provider_details_dict,
                              self.project_id, self.service_id)
Exemplo n.º 3
0
def delete_service():
    flow = graph_flow.Flow('Deleting poppy-service').add(
        delete_service_tasks.DeleteProviderServicesTask(),
        linear_flow.Flow('Delete Service DNS Mapping flow',
                         retry=retry.ParameterizedForEach(
                             rebind=['time_seconds'],
                             provides='retry_sleep_time')).add(
            delete_service_tasks.DeleteServiceDNSMappingTask()),
        delete_service_tasks.GatherProviderDetailsTask(
            rebind=['responders', 'dns_responder']),
        linear_flow.Flow('Delete service storage operation').add(
            common.UpdateProviderDetailIfNotEmptyTask(
                rebind=['provider_details_dict']),
            delete_service_tasks.DeleteStorageServiceTask())
    )
    return flow
Exemplo n.º 4
0
    def mock_delete_service(self, mock_bootstrap):
        mock_bootstrap.return_value = self.bootstrap_obj
        delete_provider = delete_service_tasks.DeleteProviderServicesTask()
        provider_details = json.dumps(
            dict([(k, v.to_dict()) for k, v in self.provider_details.items()]))
        responders = delete_provider.execute(provider_details)
        delete_dns = delete_service_tasks.DeleteServiceDNSMappingTask()
        dns_responders = delete_dns.execute(provider_details, 0, responders,
                                            self.project_id, self.service_id)

        gather_provider = delete_service_tasks.GatherProviderDetailsTask()
        changed_provider_dict = gather_provider.execute(
            responders, dns_responders, provider_details)
        update_provider = common.UpdateProviderDetailIfNotEmptyTask()
        update_provider.execute(changed_provider_dict, self.project_id,
                                self.service_id)

        delete_service = delete_service_tasks.DeleteStorageServiceTask()
        delete_service.execute(self.project_id, self.service_id)