Skip to content

User/Group Name Resolution and Enhanced Color Logging#906

Merged
stgraber merged 1 commit intolxc:mainfrom
mobydeck:main
Mar 4, 2025
Merged

User/Group Name Resolution and Enhanced Color Logging#906
stgraber merged 1 commit intolxc:mainfrom
mobydeck:main

Conversation

@arthurpro
Copy link
Contributor

User/Group Name Resolution and Enhanced Color Logging

This PR introduces two quality-of-life improvements:

1. Forced Color Output Support

  • Enables EnvironmentOverrideColors flag in the log formatter
  • Allows forcing colored log output in non-TTY sessions using CLICOLOR_FORCE=1
  • Improves log readability in CI/CD pipelines and redirected outputs

2. Symbolic User/Group Names in Files Definition

  • Adds support for using symbolic names (like nginx) instead of numeric UIDs/GIDs in file definitions
  • Automatically resolves symbolic names to appropriate numeric IDs during build
  • Solves the issue of varying UIDs/GIDs across different builds and environments

Example usage:

files:
    - generator: dump
      path: /tmp/test
      content: |-
        hello
        world
      mode: "644"
      uid: nginx
      gid: nginx

Benefits

  • More maintainable configuration files
  • Reduced errors from hardcoded numeric IDs
  • Better portability across different environments
  • More intuitive file ownership configuration

Testing

Both features have been thoroughly tested across multiple environments and build configurations.

@stgraber
Copy link
Member

stgraber commented Mar 3, 2025

@arthurpro can you make sure your commits include the required Signed-off-by line? (see CONTRIBUTING)

@arthurpro
Copy link
Contributor Author

@stgraber sure! I'll take a look on Monday

@arthurpro arthurpro force-pushed the main branch 5 times, most recently from 7d40937 to 66b99ed Compare March 3, 2025 21:55
Introduce functionality to parse `/etc/passwd` and `/etc/group` files to map symbolic user/group names to numeric IDs. This ensures consistency in file definitions by replacing symbolic references with their corresponding numeric IDs in the global configuration. An environment override for logger colors was also added.

Signed-off-by: Arthur <git@arthur.pro>
@stgraber stgraber merged commit a551024 into lxc:main Mar 4, 2025
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants