Пример #1
0
import json
import time

from oslo_config import cfg
from taskflow import task

from poppy.distributed_task.taskflow.task import common
from poppy.distributed_task.utils import exc_loader
from poppy.distributed_task.utils import memoized_controllers
from poppy.model.helpers import provider_details as pd
from poppy.openstack.common import log
from poppy.transport.pecan.models.request import (
    provider_details as req_provider_details
)

LOG = log.getLogger(__name__)

conf = cfg.CONF
conf(project='poppy', prog='poppy', args=[])

DNS_OPTIONS = [
    cfg.IntOpt('retries', default=5,
               help='Total number of Retries after Exponentially Backing Off')
]

DNS_GROUP = 'driver:dns'

conf.register_opts(DNS_OPTIONS, group=DNS_GROUP)


class DeleteProviderServicesTask(task.Task):
Пример #2
0
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
# implied.
# See the License for the specific language governing permissions and
# limitations under the License.

import json
import logging

from pecan import hooks
import webob

from poppy.openstack.common import log as oslo_log

LOG = oslo_log.getLogger(__name__)


class ErrorHook(hooks.PecanHook):

    '''Intercepts all errors during request fulfillment and logs them.'''

    def on_error(self, state, exception):
        '''Fires off when an error happens during a request.

        :param state: The Pecan state for the current request.
        :type state: pecan.core.state
        :param exception: The exception that was raised.
        :type exception: Exception
        :returns: webob.Response -- JSON response with the error
            message.
Пример #3
0
# limitations under the License.

import argparse
import json
import logging
import os

from oslo.config import cfg

from poppy import bootstrap
from poppy.openstack.common import log
from poppy.transport.pecan.models.request import (
    provider_details as req_provider_details
)

LOG = log.getLogger(__file__)
conf = cfg.CONF
conf(project='poppy', prog='poppy', args=[])


def service_delete_worker(provider_details,
                          project_id, service_id):
    LOG.logger.setLevel(logging.INFO)
    bootstrap_obj = bootstrap.Bootstrap(conf)
    service_controller = bootstrap_obj.manager.services_controller
    provider_details = json.loads(provider_details)

    responders = []
    # try to delete all service from each provider presented
    # in provider_details
    for provider in provider_details:
Пример #4
0
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
# implied.
# See the License for the specific language governing permissions and
# limitations under the License.

import json

from oslo_config import cfg
from taskflow import task

from poppy.distributed_task.utils import memoized_controllers
from poppy.openstack.common import log
from poppy.transport.pecan.models.request import ssl_certificate

LOG = log.getLogger(__name__)

conf = cfg.CONF
conf(project='poppy', prog='poppy', args=[])


class CreateProviderSSLCertificateTask(task.Task):
    default_provides = "responders"

    def execute(self, providers_list_json, cert_obj_json):
        service_controller = memoized_controllers.task_controllers('poppy')

        # call provider create_ssl_certificate function
        providers_list = json.loads(providers_list_json)
        cert_obj = ssl_certificate.load_from_json(json.loads(cert_obj_json))
Пример #5
0
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
# implied.
# See the License for the specific language governing permissions and
# limitations under the License.

import json
import logging

from pecan import hooks
import webob

from poppy.openstack.common import log as oslo_log

LOG = oslo_log.getLogger(__name__)


class ErrorHook(hooks.PecanHook):

    '''Intercepts all errors during request fulfillment and logs them.'''

    def on_error(self, state, exception):
        '''Fires off when an error happens during a request.

        :param state: The Pecan state for the current request.
        :type state: pecan.core.state
        :param exception: The exception that was raised.
        :type exception: Exception
        :returns: webob.Response -- JSON response with the error
            message.