← Back to issue list

lxd instance: account for command environment (CRAFT-309)

View original Github issue

Metadata

Project
craft-providers
Number
#61
Type
pull request
State
merged
Author
cjp256
Labels
—
Created
Updated
Closed

Current evaluation

Merged PR #61 (commit e24fa35, feature commit 4952cfe) extends LXDInstance to apply the base's default command environment, since LXD exec no longer reads /etc/environment as sudo did. Follow-up ec4e272 added get_command_environment().

Resolution: closed resolved

Reason: PR #61 by maintainer cjp256 was approved by 2 reviewers and merged into main as commit e24fa35, containing feature commit 4952cfe 'lxd instance: account for command environment (CRAFT-309)'. A follow-up commit ec4e272 refined the Base interface to use get_command_environment().

Evaluated by: mr-cal-bot

No scores available.

Issue body

When exec'ing a command through LXD, /etc/environment is not read in by default as it was when previously using sudo. For now, extend LXDInstance with the default command environment, which can be overriden by the execute functions' env= parameter. - Extend Base definition with 'environment' parameter already present in BuilddBase. - Move _rootify_lxc_command() into LXDInstance and account for the default command environment. - Update LXD launcher to set LXDInstance's environment from the existing base configuration. This way the environment will be set for all executed commands. Future work may change the mechanism used to set the environment (such as using lxc configuration, or wrapper script). Signed-off-by: Chris Patterson <chris.patterson@canonical.com> - [ ] Have you signed the [CLA](http://www.ubuntu.com/legal/contributors/)? -----

Evaluation history

Date Model Scores Action Summary
stealth/space-bunny-alpha — closed resolved Merged PR #61 (commit e24fa35, feature commit 4952cfe) extends LXDInstance to apply the base's default command environment, since LXD exec no longer reads /etc/environment as sudo did. Follow-up ec4e272 added get_command_environment().
qwen/qwen3.6-35b-a3b — closed resolved Merged PR extending LXDInstance to pass default command environment when exec'ing commands, since /etc/environment is not read by default in LXD. Addresses CRAFT-309.

Update history

Date Change
created

Related work

  • Related To: craft-providers@18fd392 (confidence 70%)

    Follow-up rename of rootify_lxc_command -> finalize_lxc_command introduced by this work.

  • Related To: craft-providers@b4761be (confidence 60%)

    Later commit 'fix: forward env to lxd instance with Pro methods (#981)' fixing env propagation in the same class.

Related issues

No related issues found above the similarity threshold.