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

feat(kafka): add --wait flag to perform synchronous Kafka creation #960

Merged
merged 4 commits into from
Aug 24, 2021

Conversation

craicoverflow
Copy link
Contributor

Closes #604

Verification Steps

  1. Run rhoas kafka create my-kafka -w
  2. The terminal will output the current status of the Kafka instance. Once it is complete it will print out the Kafka configuration object.

Type of change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation change
  • Other (please specify)

Checklist

  • Documentation added for the feature
  • CI and all relevant tests are passing
  • Code Review completed
  • Verified independently by reviewer

@@ -88,6 +90,11 @@ func (s *IOStreams) IsSSHSession() bool {
return hasClient || hasTTY
}

// NewSpinner returns a new spinner progress bar to be used in synchronous commands
func (s *IOStreams) NewSpinner() *spinner.Spinner {
Copy link
Collaborator

Choose a reason for hiding this comment

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


for svcstatus.IsCreating(response.GetStatus()) {
time.Sleep(cmdutil.DefaultPollTime)
s.Suffix = " " + opts.localizer.MustLocalize("kafka.create.log.info.creationInProgress", localize.NewEntry("Name", response.GetName()), localize.NewEntry("Status", color.Info(response.GetStatus())))
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
s.Suffix = " " + opts.localizer.MustLocalize("kafka.create.log.info.creationInProgress", localize.NewEntry("Name", response.GetName()), localize.NewEntry("Status", color.Info(response.GetStatus())))
s.Suffix = " " + opts.localizer.MustLocalize("kafka.create.log.info.creationInProgress",
localize.NewEntry("Name", response.GetName()),
localize.NewEntry("Status", color.Info(response.GetStatus())))

Comment on lines 228 to 229
logger.Info()
logger.Info()
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
logger.Info()
logger.Info()
logger.Info("\n\n")

@@ -38,13 +38,23 @@ one = 'Cloud Provider Region ID'
[kafka.create.flag.autoUse.description]
one = 'Set the new Kafka instance to the current instance'

[kafka.create.flag.wait.description]
one = 'Wait for the Kafka instance to finish creating'
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
one = 'Wait for the Kafka instance to finish creating'
one = 'Wait until the Kafka instance is created'

Copy link
Contributor

@rkpattnaik780 rkpattnaik780 left a comment

Choose a reason for hiding this comment

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

Should we put a message if user cancels creation with Ctrl +C. It should imply that creation is still going on (and not cancelled) and user can check status.

Screenshot from 2021-08-24 17-49-28

Based on intuition, I would expect the create operation to be entirely cancelled if I do a Ctrl +C, what do you think?

@craicoverflow
Copy link
Contributor Author

Should we put a message if user cancels creation with Ctrl +C. It should imply that creation is still going on (and not cancelled) and user can check status.

Screenshot from 2021-08-24 17-49-28

Based on intuition, I would expect the create operation to be entirely cancelled if I do a Ctrl +C, what do you think?

Yeah I like that. Will look into it.

@craicoverflow
Copy link
Contributor Author

I have added logic to detect a SIGINT and shows an appropriate message. Mind checking that?

Copy link
Contributor

@rkpattnaik780 rkpattnaik780 left a comment

Choose a reason for hiding this comment

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

Looks great! Just a typo.

@craicoverflow craicoverflow changed the title feat(kafka): add --wait flag to perform sychrnonous Kafka creation feat(kafka): add --wait flag to perform synchronous Kafka creation Aug 24, 2021
@craicoverflow craicoverflow merged commit 3a811f4 into main Aug 24, 2021
@craicoverflow craicoverflow deleted the sync-create branch August 24, 2021 14:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Synchronous/Wait Kafka instance creation
4 participants