Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add CLI output to the azure status #219

Merged
merged 1 commit into from
Aug 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion internal/engine/environments/azure.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ type AzureDeploymentStatus struct {
Status string `json:"status"`
ResourceURIs []string `json:"resourceURIs"`
Error string `json:"error"`
Output string `json:"output"`
}

func NewAzureDeploymentStatus() AzureDeploymentStatus {
Expand Down Expand Up @@ -67,6 +68,10 @@ func (status *AzureDeploymentStatus) SetError(err error) {
status.Error = err.Error()
}

func (status *AzureDeploymentStatus) SetOutput(output string) {
status.Output = output
}

// Print out the status JSON for azure/cloudshell if in the correct environment.
func ReportAzureStatus(status AzureDeploymentStatus, environment string) {
if !IsAzureEnvironment(environment) {
Expand Down Expand Up @@ -109,7 +114,6 @@ func AttachResourceURIsToAzureStatus(
resourceGroupName string,
environment string,
) {

if !IsAzureEnvironment(environment) {
logging.GlobalLogger.Info(
"Not fetching resource URIs because we're not in the OCD environment.",
Expand Down
3 changes: 3 additions & 0 deletions internal/engine/interactive/interactive.go
Original file line number Diff line number Diff line change
Expand Up @@ -283,6 +283,7 @@ func (model InteractiveModeModel) Update(message tea.Msg) (tea.Model, tea.Cmd) {
model.resourceGroupName,
model.environment,
)
model.azureStatus.SetOutput(strings.Join(model.CommandLines, "\n"))
commands = append(
commands,
tea.Sequence(
Expand Down Expand Up @@ -315,6 +316,8 @@ func (model InteractiveModeModel) Update(message tea.Msg) (tea.Model, tea.Cmd) {
model.resourceGroupName,
model.environment,
)

model.azureStatus.SetOutput(strings.Join(model.CommandLines, "\n"))
commands = append(
commands,
tea.Sequence(
Expand Down
Loading