GH 10008: fix ansible-galaxy for v1 files
This commit is contained in:
parent
bdb1c47532
commit
08d485b1f9
|
@ -648,15 +648,20 @@ func (p *Provisioner) executeGalaxy(ui packer.Ui, comm packer.Communicator) erro
|
||||||
collectionArgs = append(collectionArgs, "-p", filepath.ToSlash(p.config.CollectionsPath))
|
collectionArgs = append(collectionArgs, "-p", filepath.ToSlash(p.config.CollectionsPath))
|
||||||
}
|
}
|
||||||
|
|
||||||
roleInstallError := p.invokeGalaxyCommand(roleArgs, ui, comm)
|
// Run normal ansible-galaxy install for roles
|
||||||
// Return the error if the role installation failed before attempting the collection install
|
if roleInstallError := p.invokeGalaxyCommand(roleArgs, ui, comm); roleInstallError != nil {
|
||||||
if roleInstallError != nil {
|
|
||||||
return roleInstallError
|
return roleInstallError
|
||||||
}
|
}
|
||||||
// If all is well, proceed with collection install
|
|
||||||
// This variable isn't strictly necessary but including for readability to match the role installation
|
// Search galaxy_file for collections keyword. If present, run collections install
|
||||||
|
if f, err := ioutil.ReadFile(galaxyFile); err == nil {
|
||||||
|
if strings.Contains(string(f), "collections:") {
|
||||||
collectionInstallError := p.invokeGalaxyCommand(collectionArgs, ui, comm)
|
collectionInstallError := p.invokeGalaxyCommand(collectionArgs, ui, comm)
|
||||||
return collectionInstallError
|
return collectionInstallError
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// Intended to be invoked from p.executeGalaxy depending on the Ansible Galaxy parameters passed to Packer
|
// Intended to be invoked from p.executeGalaxy depending on the Ansible Galaxy parameters passed to Packer
|
||||||
|
|
Loading…
Reference in New Issue