Skip to content

Conversation

@jmucc
Copy link
Contributor

@jmucc jmucc commented Nov 21, 2025

landscape-config must be run as root. We should check that the user is root before trying any operations that would fail anyway.

@jmucc jmucc requested a review from Copilot November 21, 2025 15:52
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR moves the root user check in landscape-config to execute earlier in the execution flow, ensuring the program fails fast with a clear error message before attempting any operations that would fail anyway due to insufficient privileges.

Key Changes:

  • Root user validation now occurs immediately after configuration parsing, before any initialization or bootstrap operations
  • Test setup updated to mock os.getuid() to return 0 (root) to ensure tests continue passing with the earlier validation

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
landscape/client/configuration.py Moved root user check from after registration logic to immediately after config parsing and before logging initialization
landscape/client/tests/test_configuration.py Added os.getuid mocks in test setup classes to simulate root user for existing tests

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

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.

1 participant