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

Allowing Restart-Services from bastion #7958

Merged
merged 20 commits into from Jun 20, 2023
Merged

Allowing Restart-Services from bastion #7958

merged 20 commits into from Jun 20, 2023

Conversation

bvtejaswi
Copy link
Collaborator

@bvtejaswi bvtejaswi commented Jun 8, 2023

🔩 Description: What code changed, and why?

As a user of Automate HA, when I run following commands on bastion system of Automate HA cluster, I should see output relevant to Automate HA infrastructure:

chef-automate restart-services

⛓️ Related Resources

https://chefio.atlassian.net/browse/CHEF-720

👍 Definition of Done

👟 How to Build and Test the Change

  1. git checkout this branch
  2. rebuild components/automate-cli and upload it to you origin
  3. Install automate-cli on bastion\
  4. Run chef-automate restart-services

✅ Checklist

All PRs must tick these:

With occasional exceptions, all PRs from Progress employees must tick these:

  • Is the code clear? (complicated code or lots of comments--subdivide and use well-named methods, meaningful variable names, etc.)
  • Consistency checked? (user notifications, user prompts, visual patterns, code patterns, variable names)
  • Repeated code blocks eliminated? (adapt and reuse existing components, blocks, functions, etc.)
  • Spelling, grammar, typos checked? (at a minimum use make spell in any component directory)
  • Code well-formatted? (indents, line breaks, etc. improve rather than hinder readability)

All PRs from Progress employees should tick these if appropriate:

  • Tests added/updated? (all new code needs new tests)
  • Docs added/updated? (all customer-facing changes)

Please add a note next to any checkbox above if you are NOT ticking it.

📷 Screenshots, if applicable

Demo-video

@netlify
Copy link

netlify bot commented Jun 8, 2023

👷 Deploy Preview for chef-automate processing.

Name Link
🔨 Latest commit a85959a
🔍 Latest deploy log https://app.netlify.com/sites/chef-automate/deploys/64918234a6093800088be6eb

@bvtejaswi bvtejaswi requested a review from a team as a code owner June 14, 2023 17:16
@github-actions github-actions bot added the documentation Anything related to the Automate docs. label Jun 14, 2023
@github-actions github-actions bot removed the documentation Anything related to the Automate docs. label Jun 14, 2023
@bvtejaswi bvtejaswi changed the title [WIP] Restart from bastion Allowing Restart-Services from bastion Jun 14, 2023
@bvtejaswi bvtejaswi self-assigned this Jun 14, 2023
Copy link
Collaborator

@Sunanda-Boorla Sunanda-Boorla left a comment

Choose a reason for hiding this comment

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

In verify_private pipeline, gateway-integration and data-feed-service is failing. please check that

Comment on lines 122 to 124
remoteExecutor := NewRemoteCmdExecutor(nodemap, sshUtil, writer)
cmdResult, err := remoteExecutor.Execute()
return cmdResult, err
Copy link
Collaborator

Choose a reason for hiding this comment

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

Instead of creating a new instance you can store an instance of remoteExecutor in the restartFromBastionImpl struct while you are initialising it.
This will reduce the initialisation overhead of remoteExecutor when you are calling executeRemoteExecutor multiple times in your code

Copy link
Collaborator

Choose a reason for hiding this comment

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

You can use ExecuteWithNodeMap for you use case

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

done

Comment on lines 128 to 135
mutex.Lock()
writer.Printf("=====================================================\n")
for _, value := range cmdResult {
for _, cmdResult := range value {
printOutput(remoteService, *cmdResult, []string{}, writer)
}
}
mutex.Unlock()
Copy link
Collaborator

Choose a reason for hiding this comment

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

mutex may work, but its unnecessary for your use case same could be achieved by channels too

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

removed

@bvtejaswi bvtejaswi requested a review from vipin230 June 16, 2023 14:02
Signed-off-by: Tejaswi Bondila <bondila.venkatatejaswi@progress.com>
Signed-off-by: Tejaswi Bondila <bondila.venkatatejaswi@progress.com>
Signed-off-by: Tejaswi Bondila <bondila.venkatatejaswi@progress.com>
@punitmundra punitmundra self-requested a review June 19, 2023 10:32
Signed-off-by: Tejaswi Bondila <bondila.venkatatejaswi@progress.com>
Signed-off-by: Tejaswi Bondila <bondila.venkatatejaswi@progress.com>
Signed-off-by: Tejaswi Bondila <bondila.venkatatejaswi@progress.com>
@sonarqube-for-infrastructure-prod

@punitmundra punitmundra merged commit b0f61bd into main Jun 20, 2023
6 of 8 checks passed
@punitmundra punitmundra deleted the restart-from-bastion branch June 20, 2023 11:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet