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

(CAT-2052) Pass target container URI instead of container SHA ID to add_feature_to_node() method #574

Merged
merged 1 commit into from
Oct 3, 2024

Conversation

shubhamshinde360
Copy link
Contributor

@shubhamshinde360 shubhamshinde360 commented Oct 1, 2024

Summary

There is a bug in the 'install_agent' task.
It is supposed to install the agent on a host (a VM or a docker container) using bolt and then add the 'puppet-agent' feature to the host in the litmus_inventory file.
Bolt returns the SHA ID of the container instead of the localhost URI after it installs the agent. The feature is added through the add_feature_to_node() method.

The last parameter of the method is being sent as result["target"]. This is fine in the case of VMs since its their IPv4 address and the method is expecting just that.

But in case of docker containers it is their SHA container ID and the method expecting the localhost:{port} URI. This results in the feature not being added to the host.

Since bolt is returning the results in the same order it is provided the input 'targets', we can add the feature by indexing the 'targets' array in that order.

Additional Context

See https://perforce.atlassian.net/browse/CAT-2052?focusedCommentId=2970824

The puppetlabs-package nightlies are failing due to this on all the docker provisioned VMs.

Related Issues (if any)

Mention any related issues or pull requests.

Checklist

  • 🟢 Spec tests.
  • 🟢 Acceptance tests.
  • Manually verified.

@shubhamshinde360 shubhamshinde360 requested a review from a team as a code owner October 1, 2024 15:20
Copy link

codecov bot commented Oct 1, 2024

Codecov Report

Attention: Patch coverage is 0% with 3 lines in your changes missing coverage. Please review.

Project coverage is 63.86%. Comparing base (6700713) to head (63424d1).
Report is 2 commits behind head on main.

Files with missing lines Patch % Lines
lib/puppet_litmus/rake_tasks.rb 0.00% 3 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #574      +/-   ##
==========================================
- Coverage   64.03%   63.86%   -0.17%     
==========================================
  Files           6        6              
  Lines         759      761       +2     
==========================================
  Hits          486      486              
- Misses        273      275       +2     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@shubhamshinde360 shubhamshinde360 marked this pull request as draft October 3, 2024 05:39
…dd_feature_to_node() method

There is a bug in the 'install_agent' task.
It is supposed to install the agent on a host (a VM or a docker container) using bolt and then add the 'puppet-agent' feature to the host in the litmus_inventory file.
Bolt returns the SHA ID of the container instead of the localhost URI after it installs the agent.
The feature is added through the add_feature_to_node() method. The last parameter of the method is being sent as result["target"]. This is fine in the case of VMs since its their IPv4 address and the method is expecting just that.
But in case of docker containers it is their SHA container ID and the method expecting the localhost:{port} URI. This results in the feature not being added to the host.
Since bolt is returning the results in the same order it is provided the input 'targets', we can add the feature by indexing the 'targets' array in that order.

See https://perforce.atlassian.net/browse/CAT-2052?focusedCommentId=2970824
@shubhamshinde360 shubhamshinde360 force-pushed the CAT-2052-fix-install-agent-bug branch from 8a020e5 to 63424d1 Compare October 3, 2024 13:58
@shubhamshinde360 shubhamshinde360 changed the title (CAT-2052 Pass target container URI instead of container SHA ID to add_feature_to_node() method (CAT-2052) Pass target container URI instead of container SHA ID to add_feature_to_node() method Oct 3, 2024
@LukasAud LukasAud added bug bugfix and removed bug labels Oct 3, 2024
@shubhamshinde360
Copy link
Contributor Author

shubhamshinde360 commented Oct 3, 2024

When I use this change and then run the nightly tests: https://github.com/puppetlabs/puppetlabs-package/actions/runs/11112007788
The docker based image for Almalinux passes which is otherwise failing in the nightlies of the package module.
I also added the redhat-8 image (which is provisioned through provision service in the tests to check for impact on non-docker images)

@shubhamshinde360 shubhamshinde360 marked this pull request as ready for review October 3, 2024 14:13
Copy link
Contributor

@jordanbreen28 jordanbreen28 left a comment

Choose a reason for hiding this comment

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

verified with docker_exp, docker, winrm and ssh nodes. Nice catch @shubhamshinde360, thanks again!

@jordanbreen28 jordanbreen28 merged commit 553a093 into main Oct 3, 2024
4 of 6 checks passed
@jordanbreen28 jordanbreen28 deleted the CAT-2052-fix-install-agent-bug branch October 3, 2024 14:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants