def run(self, *args, **kwargs): from burlap.common import set_dryrun, set_verbose if 'dryrun' in kwargs: set_dryrun(kwargs['dryrun']) del kwargs['dryrun'] if 'verbose' in kwargs: set_verbose(kwargs['verbose']) del kwargs['verbose'] return self.wrapped(*args, **kwargs)
def test_post_deploy(self): with patch('burlap.common.get_os_version') as mock_get_os_version: mock_get_os_version.return_value = OS(type=LINUX, distro=UBUNTU, release='16.04') service = get_satchel('service') apache = get_satchel('apache') service.genv.services.append(apache.name) set_verbose(1) set_dryrun(1) print('self.genv.services:', service.genv.services) service.post_deploy()
def test_post_deploy(self): with patch('burlap.common.get_os_version') as mock_get_os_version: mock_get_os_version.return_value = OS( type=LINUX, distro=UBUNTU, release='16.04') service = get_satchel('service') apache = get_satchel('apache') service.genv.services.append(apache.name) set_verbose(1) set_dryrun(1) print('self.genv.services:', service.genv.services) service.post_deploy()
def tearDown(self): set_dryrun(self._dryrun) set_verbose(self._verbose) # Restore CWD. os.chdir(self._cwd) # Restore fabric state. self.clear_env() self.update_env(self._env) # Restore burlap state. clear_state() set_state(self._burlap_state) super(TestCase, self).tearDown()
def test_dryrun(self): set_dryrun(True) run_or_dryrun('touch ~/abc.txt') assert not is_file('~/abc.txt') set_dryrun(1) run_or_dryrun('touch ~/def.txt') assert not is_file('~/def.txt') set_dryrun(False) run_or_dryrun('touch ~/mno.txt') assert not is_file('~/mno.txt') run_or_dryrun('rm -f ~/mno.txt') set_dryrun(0) run_or_dryrun('touch ~/xyz.txt') assert not is_file('~/xyz.txt') run_or_dryrun('rm -f ~/xyz.txt')
def record(name): common.set_dryrun(1) env.plan = Plan(name=name)