def verify_virtualbox_version(state, host, version): command = '/usr/bin/virtualbox --help' status, stdout, stderr = host.run_shell_command(state, command=command, sudo=SUDO) assert status is True # ensure the command executed OK if version not in str(stdout): raise Exception('`{}` did not work as expected.stdout:{} stderr:{}'.format( command, stdout, stderr))
def run_pyinfra_version(state, host): status, stdout, stderr = host.run_shell_command( '/usr/local/bin/venv/bin/pyinfra --version', env={'LC_ALL': 'C.UTF-8', 'LANG': 'C.UTF-8,'}, ) assert status, 'pyinfra command failed: {0}'.format((stdout, stderr)) assert 'pyinfra: ' in stdout[0]
def check_docker_works(state, host): command = 'docker run hello-world' status, stdout, stderr = host.run_shell_command(state, command=command, sudo=SUDO) if not status or 'Hello from Docker!' not in stdout: raise Exception('`{}` did not work as expected'.format(command))
def check_docker_works(state, host): command = "docker run hello-world" status, stdout, stderr = host.run_shell_command( command=command, sudo=config.SUDO, ) if not status or "Hello from Docker!" not in stdout: raise Exception("`{}` did not work as expected".format(command))
def verify_vagrant(state, host): command = 'vagrant --version' status, stdout, stderr = host.run_shell_command(state, command=command, sudo=SUDO) assert status is True # ensure the command executed OK if 'Vagrant ' not in str(stdout): raise Exception( '`{}` did not work as expected.stdout:{} stderr:{}'.format( command, stdout, stderr))
def run_pyinfra_version(state, host): status, stdout, stderr = host.run_shell_command( "/usr/local/bin/venv/bin/pyinfra --version", env={ "LC_ALL": "C.UTF-8", "LANG": "C.UTF-8," }, ) assert status, "pyinfra command failed: {0}".format((stdout, stderr)) assert "pyinfra: " in stdout[0]