コード例 #1
0
 def __init__(self,
              mgmt_details,
              dbsvr_details,
              async_timeout=3600,
              test_data_filepath=None,
              zone=None,
              hypervisor_type=None):
     self.__mgmtDetails = mgmt_details
     self.__dbSvrDetails = dbsvr_details
     self.__csConnection = None
     self.__dbConnection = None
     self.__testClient = None
     self.__asyncTimeOut = async_timeout
     self.__logger = MarvinLog('marvin').getLogger()
     self.__apiClient = None
     self.__userApiClient = None
     self.__asyncJobMgr = None
     self.__id = None
     self.__hypervisor = hypervisor_type
     self.__testDataFilePath = test_data_filepath
     self.__parsedTestDataConfig = None
     self.__zone = zone
     self.__setHypervisorInfo()
コード例 #2
0
ファイル: sshClient.py プロジェクト: liuyong240/cosmic
    def __init__(self,
                 host,
                 port,
                 user,
                 passwd,
                 retries=60,
                 delay=10,
                 log_lvl=logging.INFO,
                 keyPairFiles=None,
                 timeout=10.0):
        self.host = None
        self.port = 22
        self.user = user
        self.passwd = passwd
        self.keyPairFiles = keyPairFiles
        self.ssh = SSHClient()
        self.ssh.set_missing_host_key_policy(AutoAddPolicy())
        self.retryCnt = 0
        self.delay = 0
        self.timeout = 3.0
        self.logger = MarvinLog('ssh').getLogger()

        # Check invalid host value and raise exception
        # Atleast host is required for connection
        if host is not None and host != '':
            self.host = host
        if retries is not None and retries > 0:
            self.retryCnt = retries
        if delay is not None and delay > 0:
            self.delay = delay
        if timeout is not None and timeout > 0:
            self.timeout = timeout
        if port is not None and port >= 0:
            self.port = port
        if self.createConnection() == FAILED:
            raise internalError("Connection Failed")
コード例 #3
0
 def __init__(self, test_client, cfg):
     self.__cfg = cfg
     self.__test_client = test_client
     self.__logger = MarvinLog('marvin').getLogger()
     self.__apiClient = None
コード例 #4
0
        return self.__option_is_set(options.remove) and self.__path_points_to_file(options.remove)

    def __options_for_remove_data_center_are_invalid(self, options):
        return self.__option_is_set(options.remove) and not self.__path_points_to_file(options.remove)

    @staticmethod
    def __deploy_and_remove_data_center(options):
        return options.input and options.remove

    @staticmethod
    def __nothing_to_do(options):
        return options.input is None and options.remove is None

    @staticmethod
    def __option_is_set(flag):
        return flag is not None

    @staticmethod
    def __path_points_to_file(path):
        return os.path.isfile(path)


if __name__ == "__main__":
    logger = MarvinLog('marvin').getLogger()
    try:
        Application().main(sys.argv[1:])
    except Exception as e:
        logger.exception("Aborting run due to: %s" % e)
        exit(1)
    exit(0)