Esempio n. 1
0
    def __init__(self, uri, aws_key=None, parameters=None, signature=None):
        self.aws_key = aws_key
        self.parameters = parameters
        self.signature = signature

        self._cluster_managers_data = None
        self._proxy_server = ServerProxy(uri)
Esempio n. 2
0
    def __init__(self, cm_id):
        """
        Create object representing CM.

        @parameter{cm_id,int} id of the CM

        @returns{common.utils.ServerProxy} instance of CM proxy server
        """
        cluster = Cluster.get(cm_id)
        self.server = ServerProxy('http://%s:%s' %
                                  (cluster.address, cluster.port))
Esempio n. 3
0
"""

import logging
import os
from time import time

from django.conf import settings
from django.utils.translation import ugettext_lazy as _

from common.utils import ServerProxy
from wi.utils.exceptions import RestErrorException
from wi.utils.messages_ajax import error, success
from wi.utils.messages_codes import get_error, auth_error_text

REDIRECT_FIELD_NAME = 'next'
CLM = ServerProxy(settings.CLOUD_MANAGER_ADDRESS)


def check_response_errors(response, session):
    """
    Checks status of response response and throws appropriate error.
    """
    if response['status'] != 'ok':
        from wi.utils.auth import logout
        error_code = response['status']
        error_msg = get_error(error_code)

        raise RestErrorException(error_msg)

    return response