def get_cloudbaseinit_traceback(self): code = util.get_resource('windows/get_traceback.ps1') remote_script = "C:\\{}.ps1".format(util.rand_name()) with _create_tempfile(content=code) as tmp: self.remote_client.copy_file(tmp, remote_script) stdout = self.remote_client.run_command_verbose( remote_script, command_type=util.POWERSHELL) return stdout.strip()
def get_user_flags(self, user): code = util.get_resource('windows/get_user_flags.ps1') remote_script = "C:\\{}.ps1".format(util.rand_name()) with _create_tempfile(content=code) as tmp: self.remote_client.copy_file(tmp, remote_script) stdout = self.remote_client.run_command_verbose( "powershell {0} {1}".format(remote_script, user)) return stdout.strip()
def get_cloudbaseinit_traceback(self): code = util.get_resource('windows/get_traceback.ps1') remote_script = "C:\\{}.ps1".format(util.rand_name()) with _create_tempfile(content=code) as tmp: self.remote_client.copy_file(tmp, remote_script) stdout = self.remote_client.run_command_verbose( "powershell " + remote_script) return stdout.strip()
class ScenarioMultipartAdvancedSmoke(BaseWindowsScenario): recipe_type = recipe.CloudbaseinitAddUserdata test_classes = (smoke.TestSetHostname, smoke.TestSetTimezone, smoke.TestPowershellMultipartX86TxtExists, smoke.TestUserdataFileExists, smoke.TestNoError) userdata = util.get_resource('windows/multipart_userdata_part_two')
def get_cloudbaseinit_traceback(self): code = util.get_resource('windows/get_traceback.ps1') remote_script = "C:\\{}.ps1".format(util.rand_name()) with _create_tempfile(content=code) as tmp: self.remote_client.copy_file(tmp, remote_script) stdout = self.remote_client.run_command_verbose( remote_script, command_type=util.POWERSHELL_SCRIPT_REMOTESIGNED) return stdout.strip()
def get_user_flags(self, user): code = util.get_resource('windows/get_user_flags.ps1') remote_script = "C:\\{}.ps1".format(util.rand_name()) with _create_tempfile(content=code) as tmp: self.remote_client.copy_file(tmp, remote_script) stdout = self.remote_client.run_command_verbose( "{0} {1}".format(remote_script, user), command_type=util.POWERSHELL_SCRIPT_BYPASS) return stdout.strip()
def _get_base_conf(config_name): """Return a ConfigParser object with default values.""" base_conf = StringIO.StringIO(util.get_resource(config_name)) conf = six.moves.configparser.ConfigParser() # NOTE(dtoncu): `readfp` is deprecated since Python 3.2, # but it was replaced with `read_file`. # pylint: disable=deprecated-method, maybe-no-member if six.PY2: conf.readfp(base_conf) else: conf.read_file(base_conf) return conf
def _get_base_conf(config_name): """Return a ConfigParser object with default values.""" base_conf = StringIO.StringIO( util.get_resource(config_name)) conf = six.moves.configparser.ConfigParser() # NOTE(dtoncu): `readfp` is deprecated since Python 3.2, # but it was replaced with `read_file`. # pylint: disable=deprecated-method, maybe-no-member if six.PY2: conf.readfp(base_conf) else: conf.read_file(base_conf) return conf
def run_scenarios(): metadata = { 'network_config': str({'content_path': 'random_value_test_random'})} userdata = util.get_resource('windows/multipart_metadata') test_result = unittest.TextTestResult( _WritelnDecorator(sys.stderr), None, 0) scenarios = [ scenario.BaseWindowsScenario( test_class=test_smoke.TestWindowsSmoke, recipee=windows.WindowsCloudbaseinitRecipee, userdata=userdata, metadata=metadata, image=CONF.images[0], result=test_result), ] Runner(scenarios).run()
class ScenarioGenericSmoke(BaseWindowsScenario): test_classes = (test_smoke.TestEC2Userdata, test_smoke.TestSmoke) userdata = util.get_resource('windows/ec2script') metadata = {"admin_pass": "******"}
class ScenarioLongHostname(BaseWindowsScenario): test_classes = (smoke.TestLongHostname, ) recipe_type = recipe.CloudbaseinitLongHostname userdata = util.get_resource('windows/netbios_hostname')
class ScenarioMultipartSmokeWindowsPartTwo(BaseWindowsScenario): test_classes = (smoke.TestSetHostname, smoke.TestSetTimezone, smoke.TestPowershellMultipartX86TxtExists, smoke.TestNoError) userdata = util.get_resource('windows/multipart_userdata_part_two')
class ScenarioMultipartSmoke(BaseWindowsScenario): test_classes = (test_smoke.TestScriptsUserdataSmoke, smoke.TestSetTimezone) recipe_type = recipe.CloudbaseinitScriptRecipe userdata = util.get_resource('windows/multipart_userdata')
class ScenarioSmokeHeat(BaseWindowsScenario): test_classes = (test_smoke.TestSmoke, test_smoke.TestHeatUserdata) backend_type = heat_backend.WindowsHeatBackend userdata = util.get_resource('windows/test_heat.ps1')
class ScenarioImageSmoke(ScenarioSmoke): test_classes = (test_smoke.TestSmoke, smoke.TestSwapEnabled) recipe_type = recipe.CloudbaseinitImageRecipe userdata = util.get_resource("windows/winrm.ps1")
class ScenarioMultipartB64GzipSmoke(ScenarioMultipartSmoke): userdata = util.gzip_data( util.get_resource('windows/multipart_userdata_b64'))
class ScenarioMultipartGzipAdvancedSmoke(ScenarioMultipartAdvancedSmoke): userdata = util.gzip_data( util.get_resource('windows/multipart_userdata_part_two'))
class ScenarioImageSmoke(ScenarioSmoke): recipe_type = recipe.CloudbaseinitImageRecipe userdata = util.get_resource("windows/winrm.ps1")