Commit 05d72e10b08237cbbe63e8bd12499df6c9bafdea
1 parent
bd2a20e1
Exists in
master
and in
39 other branches
Fixed problem when trying to install modules with _ in the name
Showing
1 changed file
with
8 additions
and
4 deletions
Show diff stats
puppet/bootstrap.py
| @@ -17,6 +17,9 @@ except ImportError: | @@ -17,6 +17,9 @@ except ImportError: | ||
| 17 | pkg_res = ['apt-get', 'install', 'python-pkg-resources', '-y'] | 17 | pkg_res = ['apt-get', 'install', 'python-pkg-resources', '-y'] |
| 18 | subprocess.call(pkg_res) | 18 | subprocess.call(pkg_res) |
| 19 | from pkg_resources import parse_requirements | 19 | from pkg_resources import parse_requirements |
| 20 | +finally: | ||
| 21 | + from pkg_resources import to_filename | ||
| 22 | + | ||
| 20 | 23 | ||
| 21 | PUPPET_TARGET_VERSION = "3.6.2" | 24 | PUPPET_TARGET_VERSION = "3.6.2" |
| 22 | PUPPET_DIR = os.path.join(os.path.dirname(__file__)) | 25 | PUPPET_DIR = os.path.join(os.path.dirname(__file__)) |
| @@ -70,11 +73,12 @@ def install_puppet_modules(): | @@ -70,11 +73,12 @@ def install_puppet_modules(): | ||
| 70 | 73 | ||
| 71 | for module in parse_requirements(modules_requirements): | 74 | for module in parse_requirements(modules_requirements): |
| 72 | current_cmd, compare, version, version_comparison = '', '', '', None | 75 | current_cmd, compare, version, version_comparison = '', '', '', None |
| 73 | - if module.project_name in modules_installed: | 76 | + module_name = to_filename(module.project_name).replace('_', '-', 1) |
| 77 | + if module_name in modules_installed: | ||
| 74 | if module.specs: | 78 | if module.specs: |
| 75 | compare, version = module.specs[0] | 79 | compare, version = module.specs[0] |
| 76 | 80 | ||
| 77 | - tmp_version = modules_installed[module.project_name] | 81 | + tmp_version = modules_installed[module_name] |
| 78 | installed_version = StrictVersion(tmp_version) | 82 | installed_version = StrictVersion(tmp_version) |
| 79 | required_version = StrictVersion(version) | 83 | required_version = StrictVersion(version) |
| 80 | 84 | ||
| @@ -95,10 +99,10 @@ def install_puppet_modules(): | @@ -95,10 +99,10 @@ def install_puppet_modules(): | ||
| 95 | current_cmd = 'install' | 99 | current_cmd = 'install' |
| 96 | 100 | ||
| 97 | if version and compare and '>' not in compare: | 101 | if version and compare and '>' not in compare: |
| 98 | - run(current_cmd, module.project_name, version) | 102 | + run(current_cmd, module_name, version) |
| 99 | else: | 103 | else: |
| 100 | if not version_comparison or version_comparison < 0: | 104 | if not version_comparison or version_comparison < 0: |
| 101 | - run(current_cmd, module.project_name) | 105 | + run(current_cmd, module_name) |
| 102 | 106 | ||
| 103 | 107 | ||
| 104 | def iscentos(distro): | 108 | def iscentos(distro): |