Exemple #1
0
    def setUpClass(self):
        # Input toml is in .toml and python dict string is in .dict
        input_recipes = [("full-recipe.toml", "full-recipe.dict"),
                         ("minimal.toml", "minimal.dict"),
                         ("modules-only.toml", "modules-only.dict"),
                         ("packages-only.toml", "packages-only.dict"),
                         ("groups-only.toml", "groups-only.dict"),
                         ("custom-base.toml", "custom-base.dict"),
                         ("repos-git.toml", "repos-git.dict")]
        results_path = "./tests/pylorax/results/"
        self.input_toml = {}
        for (recipe_toml, recipe_dict) in input_recipes:
            with open(joinpaths(results_path, recipe_toml)) as f_toml:
                with open(joinpaths(results_path, recipe_dict)) as f_dict:
                    # XXX Warning, can run arbitrary code
                    result_dict = eval(f_dict.read())
                self.input_toml[recipe_toml] = (f_toml.read(), result_dict)

        self.old_modules = [recipes.RecipeModule("toml", "2.1"),
                            recipes.RecipeModule("bash", "5.*"),
                            recipes.RecipeModule("httpd", "3.7.*")]
        self.old_packages = [recipes.RecipePackage("python", "2.7.*"),
                             recipes.RecipePackage("parted", "3.2")]
        self.old_groups = [recipes.RecipeGroup("backup-client"),
                           recipes.RecipeGroup("standard")]
        self.new_modules = [recipes.RecipeModule("toml", "2.1"),
                            recipes.RecipeModule("httpd", "3.8.*"),
                            recipes.RecipeModule("openssh", "2.8.1")]
        self.new_packages = [recipes.RecipePackage("python", "2.7.*"),
                             recipes.RecipePackage("parted", "3.2"),
                             recipes.RecipePackage("git", "2.13.*")]
        self.new_groups = [recipes.RecipeGroup("console-internet"),
                           recipes.RecipeGroup("standard")]
        self.modules_result = [{"new": {"Modules": {"version": "2.8.1", "name": "openssh"}},
                                "old": None},
                               {"new": None,
                                "old": {"Modules": {"name": "bash", "version": "5.*"}}},
                               {"new": {"Modules": {"version": "3.8.*", "name": "httpd"}},
                                "old": {"Modules": {"version": "3.7.*", "name": "httpd"}}}]
        self.packages_result = [{"new": {"Packages": {"name": "git", "version": "2.13.*"}}, "old": None}]
        self.groups_result = [{'new': {'Groups': {'name': 'console-internet'}}, 'old': None},
                              {'new': None, 'old': {'Groups': {'name': 'backup-client'}}}]
Exemple #2
0
    def setUpClass(self):
        # Input toml is in .toml and python dict string is in .dict
        input_recipes = [("full-recipe.toml", "full-recipe.dict"),
                         ("minimal.toml", "minimal.dict"),
                         ("modules-only.toml", "modules-only.dict"),
                         ("packages-only.toml", "packages-only.dict"),
                         ("custom-base.toml", "custom-base.dict")]
        results_path = "./tests/pylorax/results/"
        self.input_toml = []
        for (recipe_toml, recipe_dict) in input_recipes:
            with open(joinpaths(results_path, recipe_toml)) as f_toml:
                with open(joinpaths(results_path, recipe_dict)) as f_dict:
                    # XXX Warning, can run arbitrary code
                    result_dict = eval(f_dict.read())
                self.input_toml.append((f_toml.read(), result_dict))

        self.old_modules = [
            recipes.RecipeModule("toml", "2.1"),
            recipes.RecipeModule("bash", "4.*"),
            recipes.RecipeModule("httpd", "3.7.*")
        ]
        self.old_packages = [
            recipes.RecipePackage("python", "2.7.*"),
            recipes.RecipePackage("parted", "3.2")
        ]
        self.new_modules = [
            recipes.RecipeModule("toml", "2.1"),
            recipes.RecipeModule("httpd", "3.8.*"),
            recipes.RecipeModule("openssh", "2.8.1")
        ]
        self.new_packages = [
            recipes.RecipePackage("python", "2.7.*"),
            recipes.RecipePackage("parted", "3.2"),
            recipes.RecipePackage("git", "2.13.*")
        ]
        self.modules_result = [{
            "new": {
                "Modules": {
                    "version": "2.8.1",
                    "name": "openssh"
                }
            },
            "old": None
        }, {
            "new": None,
            "old": {
                "Modules": {
                    "name": "bash",
                    "version": "4.*"
                }
            }
        }, {
            "new": {
                "Modules": {
                    "version": "3.8.*",
                    "name": "httpd"
                }
            },
            "old": {
                "Modules": {
                    "version": "3.7.*",
                    "name": "httpd"
                }
            }
        }]
        self.packages_result = [{
            "new": {
                "Packages": {
                    "name": "git",
                    "version": "2.13.*"
                }
            },
            "old": None
        }]