diff --git a/installsystems/repository.py b/installsystems/repository.py index 8c02c2d9866def1f412e2e023a40b28c8f7869e6..7b3b704f466c8821669593e779e5008d42198074 100644 --- a/installsystems/repository.py +++ b/installsystems/repository.py @@ -502,10 +502,15 @@ class RepositoryManager(object): if self.filter is not None: if not fnmatch.fnmatch(config.name, self.filter): return + # repository is offline + if config.offline: + debug("Registering offline repository %s (%s)" % (config.path, config.name)) + self.repos.append(Repository(config)) # if path is local, no needs to create a cache - if istools.isfile(config.path): + elif istools.isfile(config.path): debug("Registering direct repository %s (%s)" % (config.path, config.name)) self.repos.append(Repository(config)) + # path is remote, we need to create a cache else: debug("Registering cached repository %s (%s)" % (config.path, config.name)) self.repos.append(self._cachify(config)) @@ -643,7 +648,7 @@ class RepositoryConfig(object): # set default value for arguments self.name = name self.path = "" - self.offline = False + self._offline = False self._dbpath = None self.dbname = "db" self._lastpath = None @@ -658,7 +663,7 @@ class RepositoryConfig(object): def __str__(self): l = [] - for a in ("name", "path", "dbpath", "lastpath", "uid", "gid", "fmod", "dmod"): + for a in ("name", "path", "dbpath", "lastpath", "uid", "gid", "fmod", "dmod", "offline"): l.append("%s: %s" % (a, getattr(self, a))) return os.linesep.join(l) @@ -774,6 +779,21 @@ class RepositoryConfig(object): else: raise ValueError("Directory mode must be an integer") + @property + def offline(self): + ''' + Get the offline state of a repository + ''' + return self._offline + + @offline.setter + def offline(self, value): + if type(value) in (str, unicode): + value = value.lower() not in ("false", "no", "0") + elif type(value) is not bool: + value = bool(value) + self._offline = value + def update(self, *args, **kwargs): ''' Update attribute with checking value diff --git a/samples/repository.conf b/samples/repository.conf index d7c446069e1fc9a1852ac12e1ca4028c46a877f1..0df88de909ce84e1391665a89a643f5c3aa5e20b 100644 --- a/samples/repository.conf +++ b/samples/repository.conf @@ -15,3 +15,4 @@ # smartjog official installsystems repository #[smartjog] #path = http://installsystems.boot.wan/is +#offline = False