mirror of
https://github.com/valitydev/salt.git
synced 2024-11-08 01:18:58 +00:00
Merge pull request #4569 from majorleaguesoccer/Pecl-update
Properly handle pecl extension versions
This commit is contained in:
commit
29efa17820
@ -11,18 +11,36 @@ A state module to manage php pecl extensions.
|
||||
'''
|
||||
|
||||
|
||||
def installed(name):
|
||||
def installed(
|
||||
name,
|
||||
version=None):
|
||||
'''
|
||||
Make sure that a pecl extension is installed.
|
||||
|
||||
name
|
||||
The pecl extension name to install
|
||||
|
||||
version
|
||||
The pecl extension version to install. This option may be
|
||||
ignored to install the latest stable version.
|
||||
'''
|
||||
# Check to see if we have a designated version
|
||||
if not isinstance(version, basestring) and version is not None:
|
||||
version = str(version)
|
||||
|
||||
ret = {'name': name, 'result': None, 'comment': '', 'changes': {}}
|
||||
if name in __salt__['pecl.list']():
|
||||
ret['result'] = True
|
||||
ret['comment'] = 'Pecl is already installed.'
|
||||
return ret
|
||||
|
||||
installed_pecls = __salt__['pecl.list']()
|
||||
|
||||
if name in installed_pecls:
|
||||
# The package is only installed if version is absent or matches
|
||||
if version is None or installed_pecls[name][0] == version:
|
||||
ret['result'] = True
|
||||
ret['comment'] = 'Pecl is already installed.'
|
||||
return ret
|
||||
else:
|
||||
# Modify the name to include the version and proceed.
|
||||
name = '{0}-{1}'.format(name, version)
|
||||
|
||||
if __opts__['test']:
|
||||
ret['comment'] = 'The pecl {0} would have been installed'.format(name)
|
||||
|
Loading…
Reference in New Issue
Block a user