Skip to content

Commit

Permalink
Fix ansible-galaxy path
Browse files Browse the repository at this point in the history
  • Loading branch information
micafer committed Nov 26, 2024
1 parent 1b1b724 commit fe77358
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
4 changes: 2 additions & 2 deletions IM/CtxtAgentBase.py
Original file line number Diff line number Diff line change
Expand Up @@ -508,7 +508,7 @@ def install_ansible_roles(self, general_conf_data, playbook):
task["name"] = "Create YAML file to install the collections with ansible-galaxy"
yaml_data[0]['tasks'].append(task)

task = {"command": "ansible-galaxy collection install -c -r %s" % filename}
task = {"command": "/var/tmp/.ansible/bin/ansible-galaxy collection install -c -r %s" % filename}
task["name"] = "Install galaxy collections"
task["become"] = "yes"
task["register"] = "collections_install"
Expand Down Expand Up @@ -562,7 +562,7 @@ def install_ansible_roles(self, general_conf_data, playbook):
task["name"] = "Create YAML file to install the roles with ansible-galaxy"
yaml_data[0]['tasks'].append(task)

task = {"command": "ansible-galaxy install -c -r %s" % filename}
task = {"command": "/var/tmp/.ansible/bin/ansible-galaxy install -c -r %s" % filename}
task["name"] = "Install galaxy roles"
task["become"] = "yes"
task["register"] = "roles_install"
Expand Down
7 changes: 4 additions & 3 deletions test/unit/test_ctxt_agent.py
Original file line number Diff line number Diff line change
Expand Up @@ -277,7 +277,8 @@ def test_95_install_ansible_roles(self):
copy_content = yaml_data[0]['tasks'][1]['copy'][pos + 9:-2]
self.assertEqual(copy_content, "[{src: ansible_role}, {name: hadoop, src: "
"'git+https://github.com/micafer/ansible-role-hadoop'}]")
self.assertEqual(yaml_data[0]['tasks'][2]['command'][:47], "ansible-galaxy install -c -r /tmp/galaxy_roles_")
self.assertEqual(yaml_data[0]['tasks'][2]['command'][:69],
"/var/tmp/.ansible/bin/ansible-galaxy install -c -r /tmp/galaxy_roles_")

os.unlink(res)

Expand All @@ -300,8 +301,8 @@ def test_99_install_ansible_collections(self):
pos = yaml_data[0]['tasks'][0]['copy'].find('content="')
copy_content = yaml_data[0]['tasks'][0]['copy'][pos + 9:-2]
self.assertEqual(copy_content, "{collections: [{name: ns.collection, version: '1.0'}]}")
self.assertEqual(yaml_data[0]['tasks'][1]['command'][:64],
"ansible-galaxy collection install -c -r /tmp/galaxy_collections_")
self.assertEqual(yaml_data[0]['tasks'][1]['command'][:86],
"/var/tmp/.ansible/bin/ansible-galaxy collection install -c -r /tmp/galaxy_collections_")

os.unlink(res)

Expand Down

0 comments on commit fe77358

Please sign in to comment.