kubekey icon indicating copy to clipboard operation
kubekey copied to clipboard

fix: set hostname failed because of unmatch variable use

Open will4j opened this issue 3 weeks ago • 9 comments

What type of PR is this?

/kind bug

What this PR does / why we need it:

  1. .set_hostname variable is used in roles when expression, but actual variable is .native.set_hostname.
  2. mark task as skip when all loop is skipped to indicates some unexpected conditions.

Which issue(s) this PR fixes:

Fixes #

Special notes for reviewers:

Does this PR introduced a user-facing change?


Additional documentation, usage docs, etc.:


will4j avatar Dec 03 '25 15:12 will4j

This PR has multiple commits, and the default merge method is: squash. You can request commits to be merged using the label: tide/merge-method-merge

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

kubesphere-prow[bot] avatar Dec 03 '25 15:12 kubesphere-prow[bot]

Adding the "do-not-merge/release-note-label-needed" label because no release-note block was detected, please follow our release note process to remove it.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

kubesphere-prow[bot] avatar Dec 03 '25 15:12 kubesphere-prow[bot]

Summary of Changes

Hello @will4j, I'm Gemini Code Assist[^1]! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request addresses a bug where Ansible roles failed to correctly set or validate hostnames due to a mismatch in variable names. It rectifies these when conditions to use the proper .native.set_hostname variable. Additionally, the PR improves the robustness of the task execution engine by ensuring that tasks with loops are only marked as skipped if every iteration of the loop is skipped, providing more accurate task status reporting.

Highlights

  • Ansible Variable Correction: Fixed incorrect variable usage (from .set_hostname to .native.set_hostname) in Ansible when conditions across multiple roles, resolving a bug where hostname settings might not have been applied or validated correctly.
  • Refined Task Skipping Logic: Enhanced the task executor's logic to accurately determine when a task should be marked as skipped, specifically for tasks involving loops. A task is now only skipped if all its loop iterations are skipped, preventing premature skipping.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with :thumbsup: and :thumbsdown: on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

[^1]: Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

gemini-code-assist[bot] avatar Dec 03 '25 15:12 gemini-code-assist[bot]

/assign @redscholar

will4j avatar Dec 03 '25 15:12 will4j

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: will4j Once this PR has been reviewed and has the lgtm label, please ask for approval from redscholar. For more information see the Kubernetes Code Review Process.

The full list of commands accepted by this bot can be found here.

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment Approvers can cancel approval by writing /approve cancel in a comment

kubesphere-prow[bot] avatar Dec 03 '25 15:12 kubesphere-prow[bot]

I have a new idea for the loop. The result should support scenarios both with and without an item. Once I’m done, I’ll update your PR.

redscholar avatar Dec 04 '25 06:12 redscholar

I have a new idea for the loop. The result should support scenarios both with and without an item. Once I’m done, I’ll update your PR.

This should be fully tested, execute tasks will fail now using this new patch.

will4j avatar Dec 09 '25 02:12 will4j

I have a new idea for the loop. The result should support scenarios both with and without an item. Once I’m done, I’ll update your PR.

This should be fully tested, execute tasks will fail now using this new patch.

I’m working on it.

redscholar avatar Dec 09 '25 03:12 redscholar

I have a new idea for the loop. The result should support scenarios both with and without an item. Once I’m done, I’ll update your PR.

This should be fully tested, execute tasks will fail now using this new patch.

I’m working on it.

由于结构性改变正常运行需要删除历史运行runtime状态目录,循环loop的registry行为了发生了变化,多item的任务受到影响,目前看hook目录下那俩*_install.yaml将会受到影响

mumuhhh avatar Dec 20 '25 21:12 mumuhhh