From 05d72e10b08237cbbe63e8bd12499df6c9bafdea Mon Sep 17 00:00:00 2001 From: Sergio Oliveira Date: Fri, 1 Aug 2014 11:23:31 -0300 Subject: [PATCH] Fixed problem when trying to install modules with _ in the name --- puppet/bootstrap.py | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/puppet/bootstrap.py b/puppet/bootstrap.py index 64e94b2..56f5286 100644 --- a/puppet/bootstrap.py +++ b/puppet/bootstrap.py @@ -17,6 +17,9 @@ except ImportError: pkg_res = ['apt-get', 'install', 'python-pkg-resources', '-y'] subprocess.call(pkg_res) from pkg_resources import parse_requirements +finally: + from pkg_resources import to_filename + PUPPET_TARGET_VERSION = "3.6.2" PUPPET_DIR = os.path.join(os.path.dirname(__file__)) @@ -70,11 +73,12 @@ def install_puppet_modules(): for module in parse_requirements(modules_requirements): current_cmd, compare, version, version_comparison = '', '', '', None - if module.project_name in modules_installed: + module_name = to_filename(module.project_name).replace('_', '-', 1) + if module_name in modules_installed: if module.specs: compare, version = module.specs[0] - tmp_version = modules_installed[module.project_name] + tmp_version = modules_installed[module_name] installed_version = StrictVersion(tmp_version) required_version = StrictVersion(version) @@ -95,10 +99,10 @@ def install_puppet_modules(): current_cmd = 'install' if version and compare and '>' not in compare: - run(current_cmd, module.project_name, version) + run(current_cmd, module_name, version) else: if not version_comparison or version_comparison < 0: - run(current_cmd, module.project_name) + run(current_cmd, module_name) def iscentos(distro): -- libgit2 0.21.2