예제 #1
0
    def __init__(self,
                 dcos_url: str,
                 masters: Optional[List[str]],
                 slaves: Optional[List[str]],
                 public_slaves: Optional[List[str]],
                 default_os_user: str,
                 auth_user: Optional[DcosUser],
                 exhibitor_admin_password: Optional[str] = None):
        """Proxy class for DC/OS clusters. If any of the host lists (masters,
        slaves, public_slaves) are provided, the wait_for_dcos function of this
        class will wait until provisioning is complete. If these lists are not
        provided, then there is no ground truth and the cluster will be assumed
        the be in a completed state.

        Args:
            dcos_url: address for the DC/OS web UI.
            masters: list of Mesos master advertised IP addresses.
            slaves: list of Mesos slave/agent advertised IP addresses.
            public_slaves: list of public Mesos slave/agent advertised IP addresses.
            default_os_user: default user that marathon/metronome will launch tasks under
            auth_user: use this user's auth for all requests
                Note: user must be authenticated explicitly or call self.wait_for_dcos()
        """
        super().__init__(Url.from_string(dcos_url))
        self.master_list = masters
        self.slave_list = slaves
        self.public_slave_list = public_slaves
        self.default_os_user = default_os_user
        self.auth_user = auth_user
        self.exhibitor_admin_password = exhibitor_admin_password
예제 #2
0
    def exhibitor(self):
        if self.exhibitor_admin_password is None:
            # No basic HTTP auth. Access Exhibitor via the adminrouter.
            default_url = self.default_url.copy(path='exhibitor')
        else:
            # Exhibitor is protected with HTTP basic auth, which conflicts with adminrouter's auth. We must bypass
            # the adminrouter and access Exhibitor directly.
            default_url = Url.from_string('http://{}:8181'.format(
                self.masters[0]))

        return Exhibitor(
            default_url=default_url,
            session=self.copy().session,
            exhibitor_admin_password=self.exhibitor_admin_password)