コード例 #1
0
ファイル: behaviors.py プロジェクト: CharlesKimpolo/cloudcafe
    def get_remote_instance_client(self, server, config=None, ip_address=None,
                                   username=None, password=None, key=None,
                                   auth_strategy=None):
        """
        @summary: Gets an client of the server
        @param server: Instance uuid id of the server
        @type server: String
        @param ip_address: IPv4 address of the server
        @type ip_address: String
        @param username: Valid user of the server
        @type username: String
        @param password: Valid user password of the server
        @type password: String
        @return: Either IPv4 or IPv6 address of instance
        @rtype: String
        """

        if ip_address is None:
            ip_address = self.get_public_ip_address(server)

        strategy = auth_strategy or self.config.instance_auth_strategy.lower()

        if InstanceAuthStrategies.PASSWORD in strategy:

            if password is None:
                password = server.admin_pass

            # (TODO) dwalleck: Remove hard coding of distro
            return InstanceClientFactory.get_instance_client(
                ip_address=ip_address, username=username, password=password,
                os_distro='linux', config=config)
        else:
            return InstanceClientFactory.get_instance_client(
                ip_address=ip_address, username=username, os_distro='linux',
                config=config, key=key)
コード例 #2
0
ファイル: behaviors.py プロジェクト: kaofelix/cloudcafe
    def get_remote_instance_client(self, server, config=None, ip_address=None,
                                   username=None, password=None):
        """
        @summary: Gets an client of the server
        @param server: Instance uuid id of the server
        @type server: String
        @param ip_address: IPv4 address of the server
        @type ip_address: String
        @param username: Valid user of the server
        @type username: String
        @param password: Valid user password of the server
        @type password: String
        @return: Either IPv4 or IPv6 address of instance
        @rtype: String
        """

        if password is None:
            password = server.admin_pass
        if ip_address is None:
            ip_address = self.get_public_ip_address(server)

        # (TODO) dwalleck: Remove hard coding of distro
        return InstanceClientFactory.get_instance_client(
            ip_address=ip_address, username=username, password=password,
            os_distro='linux', config=config)
コード例 #3
0
    def get_remote_instance_client(self,
                                   server,
                                   config=None,
                                   ip_address=None,
                                   username=None,
                                   password=None,
                                   key=None,
                                   auth_strategy=None):
        """
        @summary: Gets an client of the server
        @param server: Instance uuid id of the server
        @type server: String
        @param ip_address: IPv4 address of the server
        @type ip_address: String
        @param username: Valid user of the server
        @type username: String
        @param password: Valid user password of the server
        @type password: String
        @return: Either IPv4 or IPv6 address of instance
        @rtype: String
        """

        if ip_address is None:
            ip_address = self.get_public_ip_address(server)

        strategy = auth_strategy or self.config.instance_auth_strategy.lower()

        if InstanceAuthStrategies.PASSWORD in strategy:

            if password is None:
                password = server.admin_pass

            # (TODO) dwalleck: Remove hard coding of distro
            return InstanceClientFactory.get_instance_client(
                ip_address=ip_address,
                username=username,
                password=password,
                os_distro='linux',
                config=config)
        else:
            return InstanceClientFactory.get_instance_client(
                ip_address=ip_address,
                username=username,
                os_distro='linux',
                config=config,
                key=key)