Skip to content
This repository has been archived by the owner on Jun 29, 2022. It is now read-only.

Show logs when terraform fails in lokoctl cluster apply/destroy #323

Merged
merged 2 commits into from
Apr 27, 2020

Conversation

surajssd
Copy link
Member

@surajssd surajssd commented Apr 22, 2020

When user is using lokoctl cluster apply/destroy in normal mode (not verbose) then show users what went wrong by showing last 20 lines of the logs.

And also let user know where the log file resides.

Fixes #225

@@ -211,22 +213,50 @@ func (ex *Executor) execute(verbose bool, args ...string) error {
wg.Add(1)

go tailFile(p, done, &wg)
} else {
fmt.Printf("\nYou can find the logs in %q\n", p)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not really sure if this is needed. Also, it uses else 😄

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But then that is one of the requirement from the issue. What is wrong with using else?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

pkg/terraform/executor.go Show resolved Hide resolved
pkg/terraform/executor.go Show resolved Hide resolved
When user is running `lokoctl cluster apply/destroy` without verbose
flag `-v` then show user what is the location of log files.

Signed-off-by: Suraj Deshmukh <suraj@kinvolk.io>
@surajssd surajssd force-pushed the surajssd/fix-terraform-ux branch 2 times, most recently from 405ad0b to c79cb50 Compare April 22, 2020 13:19
If a user is running `lokoctl cluster apply/destroy` without verbose
flag `-v` and if there is an error in terraform execution then this will
show last twenty lines from the logs. This will help user in knowing
what went wrong.

Signed-off-by: Suraj Deshmukh <suraj@kinvolk.io>
@surajssd surajssd force-pushed the surajssd/fix-terraform-ux branch from c79cb50 to 3fbacfa Compare April 22, 2020 14:12
@surajssd surajssd requested review from invidian and iaguis April 22, 2020 14:42
Copy link
Member

@invidian invidian left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK

@surajssd surajssd merged commit 23ac97c into master Apr 27, 2020
@surajssd surajssd deleted the surajssd/fix-terraform-ux branch April 27, 2020 12:20
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Improve terraform related UX
2 participants