Skip to content

Conversation

@jirihnidek
Copy link
Contributor

@jirihnidek jirihnidek commented Jun 23, 2025

  • Card ID: CCT-1420
  • When rhsmcertd binary was started with --auto-registration-interval CLI option, then the value of interval was ignored. The old logic of waiting was not used. The file /run/rhsm/next_auto_register_update was useless.
  • This commit does not change behavior (much). When the CLI option --auto-registration-interval is used, then it is still ignored, but we print warning messages that this CLI option is no-op and deprecated
  • Note: We also introduced another interval in: feat: Better control over auto-reg waiting game #3575 and changed manner of existing auto-registration interval.
  • Manual page of rhsmcertd is updated

Summary by Sourcery

Remove unused auto-registration interval logic from rhsmcertd, deprecate the --auto-registration-interval option with a warning, and update related documentation and completion scripts.

Enhancements:

  • Warn when the --auto-registration-interval option is used to inform that it is no-op and deprecated

Documentation:

  • Update the rhsmcertd manual page to mark the auto-registration interval option as deprecated and no-op

Chores:

  • Eliminate dead code and configuration fields for the auto-registration interval and the related next update file
  • Remove the --auto-registration-interval option from the bash completion script

@sourcery-ai
Copy link

sourcery-ai bot commented Jun 23, 2025

Reviewer's Guide

Removed obsolete auto-registration interval handling in rhsmcertd, deprecated the --auto-registration-interval flag with warning messages, updated documentation and bash completion, and refactored the auto_register function signature and scheduling.

Class diagram for Config struct and auto_register function after dead code removal

classDiagram
    class Config {
        int cert_interval_seconds
        bool splay
        bool auto_registration
    }
    class CertCheckData {
        int interval_seconds
        const char* next_update_file
    }
    class auto_register {
        +void auto_register()
    }
Loading

File-Level Changes

Change Details Files
Removed dead code and configuration for auto-registration intervals
  • Deleted NEXT_AUTO_REGISTER_UPDATE_FILE and DEFAULT_AUTO_REG_INTERVAL_SECONDS constants
  • Removed auto_reg_interval_seconds field and its default initialization
  • Eliminated config file parsing for auto_registration_interval
  • Dropped log_update calls for the removed next-update file
src/daemons/rhsmcertd.c
Deprecated the --auto-registration-interval CLI option
  • Updated GOptionEntry description to mark the option as no-op and deprecated
  • Added warning and printf in opt_parse_init_config when the flag is used
  • Revised rhsmcertd.8 man page to indicate deprecation
  • Removed the flag from the bash completion script
src/daemons/rhsmcertd.c
man/rhsmcertd.8
etc-conf/rhsmcertd.completion.sh
Refactored auto_register function and its invocation
  • Changed auto_register signature from gboolean(gpointer) to void(void)
  • Dropped unused data parameter and return statements
  • Switched fork pid variable to const int
  • Replaced g_timeout_add scheduling with direct call to auto_register()
src/daemons/rhsmcertd.c

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

Copy link

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

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

Hey @jirihnidek - I've reviewed your changes - here's some feedback:

  • Now that auto-registration interval is a no-op, remove the unused arg_reg_interval_minutes variable and its related branching in opt_parse_init_config for clarity.
  • The N_() macro only marks strings for extraction and doesn’t perform runtime translation—use _() or gettext() in printf() if you want the message localized.
  • You’re issuing the deprecation warning twice (warn() plus printf()); consider consolidating into a single logging call to avoid duplicate output.
Prompt for AI Agents
Please address the comments from this code review:
## Overall Comments
- Now that auto-registration interval is a no-op, remove the unused arg_reg_interval_minutes variable and its related branching in opt_parse_init_config for clarity.
- The N_() macro only marks strings for extraction and doesn’t perform runtime translation—use _() or gettext() in printf() if you want the message localized.
- You’re issuing the deprecation warning twice (warn() plus printf()); consider consolidating into a single logging call to avoid duplicate output.

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

@github-actions
Copy link

github-actions bot commented Jun 23, 2025

Coverage

Coverage (computed on Fedora latest) •
FileStmtsMissCoverMissing
TOTAL17296448274% 
report-only-changed-files is enabled. No files were changed during this commit :)

Tests Skipped Failures Errors Time
2386 14 💤 0 ❌ 0 🔥 30.205s ⏱️

@jirihnidek
Copy link
Contributor Author

Hey @jirihnidek - I've reviewed your changes - here's some feedback:

  • Now that auto-registration interval is a no-op, remove the unused arg_reg_interval_minutes variable and its related branching in opt_parse_init_config for clarity.

No, it cannot be removed. It is still used in opt_parse_init_config() function. The --auto-registration-interval CLI option was not completely removed. We still have to store the value of argument to some variable. And when the value of variable is not -1, then we print warning message.

  • The N_() macro only marks strings for extraction and doesn’t perform runtime translation—use _() or gettext() in printf() if you want the message localized.

No, when N_() is used, then it perform runtime translation.

  • You’re issuing the deprecation warning twice (warn() plus printf()); consider consolidating into a single logging call to avoid duplicate output.

The warn() is used for logging and and printf() is used for printing messages to console. Both functions have different arguments(e.g. log messages are never translated).

Prompt for AI Agents
Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

@jsefler
Copy link
Contributor

jsefler commented Jun 24, 2025

FWIW... I can pr-verify that "Removed -r and --auto-registration-interval CLI option from bash completion script" is indeed true because existing testBashCompletion is failing on these two missing options when executed against branch jhnidek/rhsmcertd_deprecate_no_op_cli_option. See TestResultsReport for CLI: BashCompletion Tests

Was not presented with the expected bash-completion '-r' for command 'rhsmcertd '.
Was not presented with the expected bash-completion '--auto-registration-interval' for command 'rhsmcertd '.

I will update this test after this PR is merged to main.

@jirihnidek jirihnidek force-pushed the jhnidek/rhsmcertd_deprecate_no_op_cli_option branch 2 times, most recently from d7cc0d7 to a0cd103 Compare July 3, 2025 07:54
Copy link
Contributor

@pkoprda pkoprda left a comment

Choose a reason for hiding this comment

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

LGTM from developer POV, let's wait for QE verification.

Also please rebase, the stylish CI check fail was fixed by #3582

* Card ID: CCT-1420
* When rhsmcertd binary was started with --auto-registration-interval
  CLI option, then the value of interval was ignored. The old logic
  of waiting was not used. The file /run/rhsm/next_auto_register_update
  was useless.
* This commit does not change behavior (much). When the CLI option
  --auto-registration-interval is used, then it is still ignored,
  but we print warning messages that this CLI option is no-op
  and deprecated
* Note: We also introduced another interval in: #3575 and
  changed manner of existing auto-registration interval.
* Manual page of rhsmcertd is updated

Signed-off-by: Jiri Hnidek <jhnidek@redhat.com>
@jirihnidek jirihnidek force-pushed the jhnidek/rhsmcertd_deprecate_no_op_cli_option branch from a0cd103 to d93266b Compare July 4, 2025 21:07
@jirihnidek
Copy link
Contributor Author

/packit build

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.

4 participants