コード例 #1
0
 def get_db(self, ip='1.1.1.1'):
     h = Host(ip)
     h.add_user(User('root', '34546'))
     return Database(
         h,
         self.db_name,
         User(self.db_user, self.db_pass),
     )
コード例 #2
0
def provision_host(request):
    """
    Provisions a mock host.
    """
    ip = getattr(request.cls, "host_ip")
    root_password = getattr(request.cls, "root_password")
    data = getattr(request.cls, "data")

    mock = Host(ip=ip)
    mock.add_user(RootUser(password=root_password))
    mock.executor_factory = FakeExecutorFactory(cmd_to_data=data,
                                                files_content=None)
    return mock
コード例 #3
0
def provisioned_hosts(docker_ip, docker_services):
    hosts = {}
    for h in ('ubuntu',):
        host = Host(docker_ip)
        host.add_user(User("root", "docker.io"))
        host.executor_factory = RemoteExecutorFactory(
            port=docker_services.port_for(h, 22))
        executor = host.executor()
        docker_services.wait_until_responsive(
            timeout=30.0, pause=1,
            check=lambda: executor.is_connective,
        )
        hosts[h] = host
    return hosts
コード例 #4
0
 def fake_host(cls):
     fh = Host('1.1.1.1')
     fh.add_user(User('root', '11111'))
     fh.executor_factory = FakeExecutorFactory(cls.data, cls.files)
     return fh
コード例 #5
0
 def get_host(self, ip='1.1.1.1'):
     h = Host(ip)
     h.add_user(User('root', '11111'))
     return h
コード例 #6
0
def get_host(ip='1.1.1.1'):
    h = Host(ip)
    h.add_user(User('root', 'fakepasswd'))
    return h
コード例 #7
0
 def get_host(ip='1.1.1.1'):
     h = Host(ip)
     h.add_user(User('root', '123456'))
     return h
コード例 #8
0
 def get_host(self, ip='1.1.1.1', sudo=False):
     h = Host(ip)
     h.add_user(User('root', '11111'))
     h.executor(sudo=sudo)
     return h