fix: check collections both in playbook dir and repo dir

This commit is contained in:
fiftin 2024-05-22 11:41:15 +02:00
parent 434e587070
commit 05e07230b8
No known key found for this signature in database
GPG Key ID: 044381366A5D4731

View File

@ -125,8 +125,8 @@ func (t *AnsibleApp) GetPlaybookDir() string {
return path.Dir(playbookPath)
}
func (t *AnsibleApp) installCollectionsRequirements() error {
requirementsFilePath := path.Join(t.getRepoPath(), "collections", "requirements.yml")
func (t *AnsibleApp) installCollectionsRequirementsFile(requirementsFilePath string) error {
requirementsHashFilePath := fmt.Sprintf("%s.md5", requirementsFilePath)
if _, err := os.Stat(requirementsFilePath); err != nil {
@ -154,6 +154,15 @@ func (t *AnsibleApp) installCollectionsRequirements() error {
return nil
}
func (t *AnsibleApp) installCollectionsRequirements() (err error) {
err = t.installCollectionsRequirementsFile(path.Join(t.GetPlaybookDir(), "collections", "requirements.yml"))
if err != nil {
return
}
err = t.installCollectionsRequirementsFile(path.Join(t.getRepoPath(), "collections", "requirements.yml"))
return
}
func (t *AnsibleApp) runGalaxy(args []string) error {
return t.Playbook.RunGalaxy(args)
}