Skip to content

Commit

Permalink
check error on set env
Browse files Browse the repository at this point in the history
  • Loading branch information
HomelessDinosaur committed Nov 7, 2023
1 parent 7b18253 commit f420661
Show file tree
Hide file tree
Showing 7 changed files with 37 additions and 10 deletions.
6 changes: 5 additions & 1 deletion cloud/aws/deploy/down.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,11 @@ func (d *DeployServer) Down(request *deploy.DeployDownRequest, stream deploy.Dep

if request.Interactive {
pulumiEventChan := make(chan events.EngineEvent)
deployModel := interactive.NewOutputModel(make(chan tea.Msg), pulumiEventChan)
deployModel, err := interactive.NewOutputModel(make(chan tea.Msg), pulumiEventChan)
if err != nil {
return err
}

teaProgram := tea.NewProgram(deployModel, tea.WithOutput(outputStream))
pulumiDestroyOpts = []optdestroy.Option{
optdestroy.ProgressStreams(deployModel),
Expand Down
6 changes: 5 additions & 1 deletion cloud/aws/deploy/up.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,11 @@ func (d *DeployServer) Up(request *deploy.DeployUpRequest, stream deploy.DeployS

if request.Interactive {
pulumiEventChan := make(chan events.EngineEvent)
deployModel := interactive.NewOutputModel(make(chan tea.Msg), pulumiEventChan)
deployModel, err := interactive.NewOutputModel(make(chan tea.Msg), pulumiEventChan)
if err != nil {
return err
}

teaProgram := tea.NewProgram(deployModel, tea.WithOutput(&pulumiutils.UpStreamMessageWriter{
Stream: stream,
}))
Expand Down
6 changes: 5 additions & 1 deletion cloud/azure/deploy/down.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,11 @@ func (d *DeployServer) Down(request *deploy.DeployDownRequest, stream deploy.Dep

if request.Interactive {
pulumiEventChan := make(chan events.EngineEvent)
deployModel := interactive.NewOutputModel(make(chan tea.Msg), pulumiEventChan)
deployModel, err := interactive.NewOutputModel(make(chan tea.Msg), pulumiEventChan)
if err != nil {
return err
}

teaProgram := tea.NewProgram(deployModel, tea.WithOutput(outputStream))
pulumiDestroyOpts = []optdestroy.Option{
optdestroy.ProgressStreams(deployModel),
Expand Down
6 changes: 5 additions & 1 deletion cloud/azure/deploy/up.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,11 @@ func (d *DeployServer) Up(request *deploy.DeployUpRequest, stream deploy.DeployS

if request.Interactive {
pulumiEventChan := make(chan events.EngineEvent)
deployModel := interactive.NewOutputModel(make(chan tea.Msg), pulumiEventChan)
deployModel, err := interactive.NewOutputModel(make(chan tea.Msg), pulumiEventChan)
if err != nil {
return err
}

teaProgram := tea.NewProgram(deployModel, tea.WithOutput(&pulumiutils.UpStreamMessageWriter{
Stream: stream,
}))
Expand Down
11 changes: 7 additions & 4 deletions cloud/common/deploy/output/interactive/model.go
Original file line number Diff line number Diff line change
Expand Up @@ -205,11 +205,14 @@ func (m DeployModel) View() string {
return fmt.Sprintf("\n%s\n", t.View())
}

func NewOutputModel(sub chan tea.Msg, pulumiSub chan events.EngineEvent) DeployModel {
func NewOutputModel(sub chan tea.Msg, pulumiSub chan events.EngineEvent) (*DeployModel, error) {
// FIXME: Set this according to the connected output preferences
os.Setenv("CLICOLOR_FORCE", "1")
err := os.Setenv("CLICOLOR_FORCE", "1")
if err != nil {
return nil, err
}

return DeployModel{
return &DeployModel{
pulumiSub: pulumiSub,
sub: sub,
logs: make([]string, 0),
Expand All @@ -225,5 +228,5 @@ func NewOutputModel(sub chan tea.Msg, pulumiSub chan events.EngineEvent) DeployM
Children: []*Node[PulumiData]{},
},
},
}
}, nil
}
6 changes: 5 additions & 1 deletion cloud/gcp/deploy/down.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,11 @@ func (d *DeployServer) Down(request *deploy.DeployDownRequest, stream deploy.Dep

if request.Interactive {
pulumiEventChan := make(chan events.EngineEvent)
deployModel := interactive.NewOutputModel(make(chan tea.Msg), pulumiEventChan)
deployModel, err := interactive.NewOutputModel(make(chan tea.Msg), pulumiEventChan)
if err != nil {
return err
}

teaProgram := tea.NewProgram(deployModel, tea.WithOutput(outputStream))
pulumiDestroyOpts = []optdestroy.Option{
optdestroy.ProgressStreams(deployModel),
Expand Down
6 changes: 5 additions & 1 deletion cloud/gcp/deploy/up.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,11 @@ func (d *DeployServer) Up(request *deploy.DeployUpRequest, stream deploy.DeployS

if request.Interactive {
pulumiEventChan := make(chan events.EngineEvent)
deployModel := interactive.NewOutputModel(make(chan tea.Msg), pulumiEventChan)
deployModel, err := interactive.NewOutputModel(make(chan tea.Msg), pulumiEventChan)
if err != nil {
return err
}

teaProgram := tea.NewProgram(deployModel, tea.WithOutput(&pulumiutils.UpStreamMessageWriter{
Stream: stream,
}))
Expand Down

0 comments on commit f420661

Please sign in to comment.