def test_functions_install_provisioner_proper_cluster_pillar( run_script, mhost, mlocalhost, ssh_config, remote, project_path, singlenode, request ): hostspec = mhost.hostname if remote else "''" ssh_config = ssh_config if remote else "''" with_sudo = 'false' # TODO is_singlenode = 'true' if singlenode else 'false' prvsnr_version = 'HEAD' script = """ install_provisioner local {} {} {} {} {} """.format(prvsnr_version, hostspec, ssh_config, with_sudo, is_singlenode) res = run_script(script, mhost=(mlocalhost if remote else mhost)) assert res.rc == 0 source_path = h.PRVSNR_REPO_INSTALL_DIR / ( 'pillar/components/samples/singlenode.cluster.sls' if singlenode else 'pillar/components/samples/dualnode.cluster.sls' ) dest_path = h.PRVSNR_REPO_INSTALL_DIR / 'pillar/components/cluster.sls' h.check_output(mhost, 'diff -us {} {}'.format(source_path, dest_path))
def check_output(self, script, *args, force_dump=False, local_user=False, **kwargs): if local_user and not self.host_user: raise RuntimeError("connection for local user is not available" f" for {self.remote.name}") if local_user: _host = self.host_user script = f"source ~/.bash_profile; {script}" else: _host = self.host return h.check_output(_host, script, *args, force_dump=force_dump, **kwargs)
def check_output(self, script, *args, force_dump=False, **kwargs): return h.check_output(self.host, script, *args, force_dump=force_dump, **kwargs)