commit: c48ab55121d41869307045a59f691b1faae95e28 Author: Devan Franchini <twitch153 <AT> gentoo <DOT> org> AuthorDate: Tue Mar 24 22:54:54 2015 +0000 Commit: Devan Franchini <twitch153 <AT> gentoo <DOT> org> CommitDate: Tue Mar 24 22:54:58 2015 +0000 URL: https://gitweb.gentoo.org/proj/layman.git/commit/?id=c48ab551
updater.py: Adds check to ensure repos_conf is not a directory layman/updater.py | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/layman/updater.py b/layman/updater.py index ccf6c8d..02e85c7 100644 --- a/layman/updater.py +++ b/layman/updater.py @@ -182,15 +182,26 @@ class Main(object): def create_repos_conf(self): self.output.info(" Creating layman's repos.conf file") + + if os.path.isdir(self.config['repos_conf']): + msg = ' create_repos_conf() error: %s is a directory and will\n'\ + ' not be written to.' % self.config['repos_conf'] + self.output.error(msg) + return None + conf_dir = os.path.dirname(self.config['repos_conf']) if not os.path.isdir(conf_dir): try: os.mkdir(conf_dir) except OSError as e: - self.output.error(' create_repos_conf() error creating %s: ' % conf_dir) + self.output.error(' create_repos_conf() error creating %s: '\ + % conf_dir) self.output.error(' "%s"' % e) return None + else: + msg = str(conf_dir) + ' is a directory.' + self.output.error(' create_repos_conf() error: %s\n' % msg) layman_inst = LaymanAPI(config=self.config) overlays = {}