Move code that uses FileRepo as a default if no repo is specified to munkilib/munkirepo/__init__.py

This commit is contained in:
Greg Neagle
2017-03-11 09:06:09 -08:00
parent a5a9c9e73d
commit d1d3f5dcd2
5 changed files with 5 additions and 7 deletions
+1 -1
View File
@@ -284,7 +284,7 @@ def main():
# Make sure the repo exists
try:
repo = munkirepo.connect(options.repo_url, options.plugin or 'FileRepo')
repo = munkirepo.connect(options.repo_url, options.plugin)
except munkirepo.RepoError, err:
print_err_utf8(u'Could not connect to munki repo: %s' % unicode(err))
exit(-1)
+1 -1
View File
@@ -402,7 +402,7 @@ def main():
# Connect to the repo
try:
repo = munkirepo.connect(options.repo_url, options.plugin or 'FileRepo')
repo = munkirepo.connect(options.repo_url, options.plugin)
except munkirepo.RepoError, err:
print >> sys.stderr, (u'Could not connect to munki repo: %s'
% unicode(err))
+1 -1
View File
@@ -1143,7 +1143,7 @@ def connect_to_repo():
'''Connects to the Munki repo'''
repo_url = pref('repo_url')
repo_path = pref('repo_path')
repo_plugin = pref('plugin') or 'FileRepo'
repo_plugin = pref('plugin')
if not repo_url and repo_path:
repo_url = path2url(repo_path)
if not repo_url:
+1 -1
View File
@@ -877,7 +877,7 @@ Extended Options: (makepkginfo options)
exit(-1)
try:
repo = munkirepo.connect(options.repo_url, options.plugin or 'FileRepo')
repo = munkirepo.connect(options.repo_url, options.plugin)
except munkirepo.RepoError, err:
print >> sys.stderr, (u'Could not connect to munki repo: %s'
% unicode(err))
+1 -3
View File
@@ -28,9 +28,7 @@ def plugin_named(name):
def connect(repo_url, plugin_name):
'''Return a repo object for operations on our Munki repo'''
if plugin_name is None:
plugin_name = 'FileRepo'
plugin = plugin_named(plugin_name)
plugin = plugin_named(plugin_name or 'FileRepo')
if plugin:
return plugin(repo_url)
else: