This repository was archived by the owner on Sep 18, 2021. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +11
-3
lines changed
Expand file tree Collapse file tree 2 files changed +11
-3
lines changed Original file line number Diff line number Diff line change @@ -13,8 +13,8 @@ func installCollection(version string) error {
1313 if len (version ) > 0 {
1414 repoPath += "," + version
1515 }
16- return routines .ExecAnsibleGalaxy (
17- "collection" , " install" , repoPath ,
16+ return routines .ExecAnsibleGalaxyCollection (
17+ "install" , repoPath ,
1818 )
1919}
2020
Original file line number Diff line number Diff line change @@ -45,6 +45,11 @@ func Exec(name string, arg ...string) error {
4545
4646// ExecAnsibleGalaxy is shortcut for executing a command via ansible-galaxy binary
4747func ExecAnsibleGalaxy (args ... string ) error {
48+ return Exec ("ansible-galaxy" , args ... )
49+ }
50+
51+ // ExecAnsibleGalaxyCollection is shortcut for executing a collection command via ansible-galaxy binary
52+ func ExecAnsibleGalaxyCollection (args ... string ) error {
4853 collectionDir , err := ansible .GetCollectionDirs ()
4954 if err != nil {
5055 return err
@@ -58,7 +63,10 @@ func ExecAnsibleGalaxy(args ...string) error {
5863 // We have to set a relative path, otherwise ansible-galaxy will do weird things...
5964 relCollectionsPath , _ := filepath .Rel (cwd , "/" )
6065 args = append (args , "-p " + relCollectionsPath + "/../.." + collectionDir [0 ])
61- return Exec ("ansible-galaxy" , args ... )
66+
67+ // Prepend "collection" task to args
68+ args = append ([]string {"collection" }, args ... )
69+ return ExecAnsibleGalaxy (args ... )
6270}
6371
6472// ExecAnsiblePlaybook is shortcut for executing a playbook within the StackHead collection via ansible-playbook binary
You can’t perform that action at this time.
0 commit comments