1 |
The default portdir path uses the snapshot_cache_path setting, but we |
2 |
only set a default for that (in |
3 |
generic_stage_target.set_snapcache_path) if SNAPCACHE is enabled. By |
4 |
shifting the portdir calculation into the SNAPCACHE-only block here, |
5 |
we avoid running into key-errors when the user has SNAPCACHE disabled |
6 |
and (unsurprisingly) doesn't specify an explicit snapshot_cache_path. |
7 |
--- |
8 |
On Tue, Mar 04, 2014 at 09:25:08PM -0800, Brian Dolbec wrote: |
9 |
> On Tue, 4 Mar 2014 20:47:47 -0800, W. Trevor King wrote: |
10 |
> > There are not particularly many snapshot_cache_path references in |
11 |
> > catalyst. Grepping through them, the following looks suspicious: |
12 |
> > |
13 |
> > catalyst/targets/generic_stage_target.py-215- self.mountmap["portdir"] = normpath("/".join([ |
14 |
> > catalyst/targets/generic_stage_target.py:216: self.settings["snapshot_cache_path"], |
15 |
> > catalyst/targets/generic_stage_target.py-217- self.settings["repo_name"], |
16 |
> > catalyst/targets/generic_stage_target.py-218- ])) |
17 |
> > catalyst/targets/generic_stage_target.py-219- if "SNAPCACHE" not in self.settings: |
18 |
> > |
19 |
> > Everything else looks fine. So what should portdir be if |
20 |
> > SNAPCACHE isn't set? |
21 |
> |
22 |
> Yeah, that's where it was failing. … |
23 |
> |
24 |
> I'm open to a better alternative. I think the potential is there |
25 |
> for more of these types of errors which depend on options selected. |
26 |
|
27 |
This patch should fix it. Analysis in the commit message itself. |
28 |
|
29 |
Cheers, |
30 |
Trevor |
31 |
|
32 |
catalyst/targets/generic_stage_target.py | 8 ++++---- |
33 |
1 file changed, 4 insertions(+), 4 deletions(-) |
34 |
|
35 |
diff --git a/catalyst/targets/generic_stage_target.py b/catalyst/targets/generic_stage_target.py |
36 |
index 2b3d7ce..1412ed5 100644 |
37 |
--- a/catalyst/targets/generic_stage_target.py |
38 |
+++ b/catalyst/targets/generic_stage_target.py |
39 |
@@ -212,11 +212,11 @@ class generic_stage_target(generic_target): |
40 |
self.mountmap = SOURCE_MOUNTS_DEFAULTS.copy() |
41 |
# update them from settings |
42 |
self.mountmap["distdir"] = self.settings["distdir"] |
43 |
- self.mountmap["portdir"] = normpath("/".join([ |
44 |
- self.settings["snapshot_cache_path"], |
45 |
- self.settings["repo_name"], |
46 |
- ])) |
47 |
if "SNAPCACHE" not in self.settings: |
48 |
+ self.mountmap["portdir"] = normpath("/".join([ |
49 |
+ self.settings["snapshot_cache_path"], |
50 |
+ self.settings["repo_name"], |
51 |
+ ])) |
52 |
self.mounts.remove("portdir") |
53 |
#self.mountmap["portdir"] = None |
54 |
if os.uname()[0] == "Linux": |
55 |
-- |
56 |
1.8.5.2.8.g0f6c0d1 |