mirror of
https://github.com/munki/munki.git
synced 2026-05-03 19:10:21 -05:00
Move code that uses FileRepo as a default if no repo is specified to munkilib/munkirepo/__init__.py
This commit is contained in:
@@ -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)
|
||||
|
||||
@@ -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))
|
||||
|
||||
@@ -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:
|
||||
|
||||
@@ -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))
|
||||
|
||||
@@ -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:
|
||||
|
||||
Reference in New Issue
Block a user