Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Configure home directory for snaps #390

Closed
wants to merge 2 commits into from

Conversation

hartmutobendorf
Copy link

Description

testflinger_cli did throw an error when trying to write to ~/.local/share/testflinger-cli-history.json (see below)

I changed the

Traceback (most recent call last):
  File "/snap/testflinger-cli/x1/bin/testflinger-cli", line 8, in <module>
    sys.exit(cli())
  File "/snap/testflinger-cli/x1/lib/python3.10/site-packages/testflinger_cli/__init__.py", line 53, in cli
    tfcli.run()
  File "/snap/testflinger-cli/x1/lib/python3.10/site-packages/testflinger_cli/__init__.py", line 182, in run
    sys.exit(self.args.func())
  File "/snap/testflinger-cli/x1/lib/python3.10/site-packages/testflinger_cli/__init__.py", line 427, in submit
    self.history.new(job_id, queue)
  File "/snap/testflinger-cli/x1/lib/python3.10/site-packages/testflinger_cli/history.py", line 54, in new
    self.save()
  File "/snap/testflinger-cli/x1/lib/python3.10/site-packages/testflinger_cli/history.py", line 74, in save
    with open(
PermissionError: [Errno 13] Permission denied: '/home/hartmut/.local/share/testflinger-cli-history.json'

Documentation

No Tests are included for the changed functionality in this PR - I would need help in setting them up.

Tests

Manual test:

snap install tf_...snap --dangerous
testflinger-cli
testflinger-cli submit example.yaml

@plars
Copy link
Collaborator

plars commented Nov 5, 2024

@hartmutobendorf Mine seems to automatically pick this up when installing from the snap. Do you know if this is something that might have changed in snapd that we need to do this now? I'm just curious why it wasn't needed previously but now seems to be needed for your system

Copy link
Collaborator

@plars plars left a comment

Choose a reason for hiding this comment

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

Ok, this makes sense now. We found that he had a local profile setting:

export XDG_DATA_HOME=$HOME/.local/share
export XDG_CONFIG_HOME=$HOME/.config

This was passed through to the snap environment, but the confined snap doesn't have access to those dirs. I think this fix is fine, and could help anyone else who has a similar problem

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.

2 participants