Merge pull request #4679 from hulu/cobbler-ext_pillar-only

improve pillar.cobbler.ext_pillar()
This commit is contained in:
Thomas S Hatch 2013-05-01 09:15:31 -07:00
commit 94d54a556c

View File

@ -41,7 +41,7 @@ __opts__ = {'cobbler.url': 'http://localhost/cobbler_api',
log = logging.getLogger(__name__)
def ext_pillar(pillar, key=None, only=[]):
def ext_pillar(pillar, key=None, only=()):
'''
Read pillar data from Cobbler via its API.
'''
@ -63,11 +63,7 @@ def ext_pillar(pillar, key=None, only=[]):
return {}
if only:
_result = {}
for i in only:
if i in result:
_result[i] = result[i]
result = _result
result = dict((k, result[k]) for k in only if k in result)
if key:
result = {key: result}