17558 pkg configuration can't be updated if a publisher source points to down NFS server
--- a/src/modules/client/image.py Tue May 03 12:25:48 2011 +0100
+++ b/src/modules/client/image.py Thu May 05 11:21:34 2011 -0700
@@ -559,7 +559,10 @@
smf.get_state("svc:/system/pkg/sysrepo:default") in \
(smf.SMF_SVC_TMP_ENABLED, smf.SMF_SVC_ENABLED):
smf.refresh(["svc:/system/pkg/sysrepo:default"])
- self.transport.cfg.reset_caches()
+
+ # This ensures all old transport configuration is thrown away.
+ self.transport = transport.Transport(
+ transport.ImageTransportCfg(self))
def mkdirs(self, root=None, version=None):
"""Create any missing parts of the image's directory structure.
@@ -605,6 +608,10 @@
else:
self.img_prefix = img_root_prefix
+ # Use a new Transport object every time location is changed.
+ self.transport = transport.Transport(
+ transport.ImageTransportCfg(self))
+
# Change directory to the root of the image so that we can
# remove any directories beneath us. If we're changing the
# image, don't chdir, as we're likely changing to a new BE
@@ -858,10 +865,6 @@
# Configuration shouldn't be written again unless this
# is an image creation operation (hence the purge).
self.save_config()
- else:
- # If not saving configuration, transport caches need
- # to be reset first.
- self.transport.cfg.reset_caches()
# load image avoid pkg set
self.__avoid_set_load()
--- a/src/modules/client/transport/transport.py Tue May 03 12:25:48 2011 +0100
+++ b/src/modules/client/transport/transport.py Thu May 05 11:21:34 2011 -0700
@@ -67,6 +67,11 @@
def __init__(self):
self.__caches = {}
+
+ # Used to track if reset_caches() has been called at least
+ # once.
+ self.__caches_set = False
+
self.pkg_pub_map = None
self.alt_pubs = None
@@ -85,6 +90,9 @@
data should be stored here as well. Only one writeable cache
can exist for each 'pub' at a time."""
+ if not self.__caches_set:
+ self.reset_caches(shared=True)
+
if not pub:
pub = "__all"
@@ -141,6 +149,9 @@
a cache for storing file data should be returned. By default,
only caches for reading file data are returned."""
+ if not self.__caches_set:
+ self.reset_caches(shared=True)
+
if isinstance(pub, publisher.Publisher):
pub = pub.prefix
elif not pub or not isinstance(pub, basestring):
@@ -198,6 +209,9 @@
ensuring a new set of shared cache information is added again.
"""
+ # Caches fully set at least once.
+ self.__caches_set = True
+
for pub in self.__caches.keys():
if shared or pub != "__all":
# Remove any publisher specific caches so that
@@ -290,9 +304,12 @@
def get_publisher(self, publisher_name):
return self.__img.get_publisher(publisher_name)
- def reset_caches(self):
+ def reset_caches(self, shared=True):
"""Discard any publisher specific cache information and
reconfigure based on current publisher configuration data.
+
+ 'shared' is ignored and exists only for compatibility with
+ the interface defined by TransportCfg.
"""
# Call base class method to perform initial reset of all
--- a/src/tests/api/t_api_search.py Tue May 03 12:25:48 2011 +0100
+++ b/src/tests/api/t_api_search.py Thu May 05 11:21:34 2011 -0700
@@ -2324,7 +2324,7 @@
self.res_remote_path, servers=[{"origin": durl}])
lfh = file(self.dc.get_logpath(), "rb")
found = 0
- num_expected = 6
+ num_expected = 7
for line in lfh:
if "X-IPKG-UUID:" in line:
tmp = line.split()