Merge ~pwlars/testflinger-cli:make-config-dirs into testflinger-cli:master

Proposed by Paul Larson
Status: Merged
Approved by: Paul Larson
Approved revision: c87290caa3c8c3688738b90c3c2465b971db07e0
Merged at revision: 3aaad2c2732a457386b118586bb656d391d46ec7
Proposed branch: ~pwlars/testflinger-cli:make-config-dirs
Merge into: testflinger-cli:master
Diff against target: 24 lines (+2/-0)
2 files modified
testflinger_cli/config.py (+1/-0)
testflinger_cli/history.py (+1/-0)
Reviewer Review Type Date Requested Status
Sheila Miguez (community) Approve
Maciej Kisielewski (community) Approve
Review via email: mp+390833@code.launchpad.net

Description of the change

This should fix the problem that Chris noticed, and also a similar possible problem with config dir

To post a comment you must log in.
Revision history for this message
Maciej Kisielewski (kissiel) wrote :

Makes sense :)

review: Approve
Revision history for this message
Sheila Miguez (codersquid) wrote :

lgtm

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1diff --git a/testflinger_cli/config.py b/testflinger_cli/config.py
2index 983699d..c45f5b0 100644
3--- a/testflinger_cli/config.py
4+++ b/testflinger_cli/config.py
5@@ -24,6 +24,7 @@ class TestflingerCliConfig:
6 def __init__(self, configfile=None):
7 config = configparser.ConfigParser()
8 if not configfile:
9+ os.makedirs(xdg.XDG_CONFIG_HOME, exist_ok=True)
10 configfile = os.path.join(
11 xdg.XDG_CONFIG_HOME, "testflinger-cli.conf")
12 config.read(configfile)
13diff --git a/testflinger_cli/history.py b/testflinger_cli/history.py
14index 86b64ca..1d57d88 100644
15--- a/testflinger_cli/history.py
16+++ b/testflinger_cli/history.py
17@@ -23,6 +23,7 @@ from datetime import datetime
18
19 class TestflingerCliHistory:
20 def __init__(self):
21+ os.makedirs(xdg.XDG_DATA_HOME, exist_ok=True)
22 self.historyfile = os.path.join(
23 xdg.XDG_DATA_HOME, "testflinger-cli-history.json")
24 self.load()

Subscribers

People subscribed via source and target branches