mirror of
https://github.com/semaphoreui/semaphore.git
synced 2025-01-20 07:19:20 +01:00
feat(terraform): check if worksapces supported
This commit is contained in:
parent
c91b428de4
commit
b8529b5c24
@ -95,6 +95,16 @@ func (t *TerraformApp) init(environmentVars *[]string) error {
|
||||
return cmd.Wait()
|
||||
}
|
||||
|
||||
func (t *TerraformApp) isWorkspacesSupported(environmentVars *[]string) bool {
|
||||
cmd := t.makeCmd(string(t.Name), []string{"workspace", "list"}, environmentVars)
|
||||
err := cmd.Run()
|
||||
if err != nil {
|
||||
return false
|
||||
}
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
func (t *TerraformApp) selectWorkspace(workspace string, environmentVars *[]string) error {
|
||||
cmd := t.makeCmd(string(t.Name), []string{"workspace", "select", "-or-create=true", workspace}, environmentVars)
|
||||
t.Logger.LogCmd(cmd)
|
||||
@ -112,6 +122,10 @@ func (t *TerraformApp) InstallRequirements(environmentVars *[]string) (err error
|
||||
return
|
||||
}
|
||||
|
||||
if !t.isWorkspacesSupported(environmentVars) {
|
||||
return
|
||||
}
|
||||
|
||||
workspace := "default"
|
||||
|
||||
if t.Inventory.Inventory != "" {
|
||||
|
Loading…
Reference in New Issue
Block a user