<s> '''<STR_LIT>''' <EOL> from __future__ import absolute_import <EOL> from salt . exceptions import SaltException <EOL> def __virtual__ ( ) : <EOL> '''<STR_LIT>''' <EOL> return '<STR_LIT>' in __salt__ <EOL> def installed ( name , <EOL> composer = None , <EOL> php = None , <EOL> user = None , <EOL> prefer_source = None , <EOL> prefer_dist = None , <EOL> no_scripts = None , <EOL> no_plugins = None , <EOL> optimize = None , <EOL> no_dev = None , <EOL> quiet = False , <EOL> composer_home = '<STR_LIT>' , <EOL> always_check = True ) : <EOL> '''<STR_LIT>''' <EOL> ret = { '<STR_LIT:name>' : name , '<STR_LIT:result>' : None , '<STR_LIT>' : '<STR_LIT>' , '<STR_LIT>' : { } } <EOL> did_install = __salt__ [ '<STR_LIT>' ] ( name ) <EOL> if always_check is False and did_install : <EOL> ret [ '<STR_LIT:result>' ] = True <EOL> ret [ '<STR_LIT>' ] = '<STR_LIT>' <EOL> return ret <EOL> if __opts__ [ '<STR_LIT:test>' ] is True : <EOL> if did_install is True : <EOL> install_status = "<STR_LIT>" <EOL> else : <EOL> install_status = "<STR_LIT>" <EOL> ret [ '<STR_LIT>' ] = '<STR_LIT>' . format ( name ) <EOL> ret [ '<STR_LIT>' ] = { <EOL> '<STR_LIT>' : '<STR_LIT>' . format ( install_status , name ) , <EOL> '<STR_LIT>' : '<STR_LIT>' . format ( name ) <EOL> } <EOL> ret [ '<STR_LIT:result>' ] = None <EOL> return ret <EOL> try : <EOL> call = __salt__ [ '<STR_LIT>' ] ( <EOL> name , <EOL> composer = composer , <EOL> php = php , <EOL> runas = user , <EOL> prefer_source = prefer_source , <EOL> prefer_dist = prefer_dist , <EOL> no_scripts = no_scripts , <EOL> no_plugins = no_plugins , <EOL> optimize = optimize , <EOL> no_dev = no_dev , <EOL> quiet = quiet , <EOL> composer_home = composer_home <EOL> ) <EOL> except ( SaltException ) as err : <EOL> ret [ '<STR_LIT:result>' ] = False <EOL> ret [ '<STR_LIT>' ] = '<STR_LIT>' . format ( name , err ) <EOL> return ret <EOL> ret [ '<STR_LIT:result>' ] = True <EOL> if quiet is True : <EOL> ret [ '<STR_LIT>' ] = '<STR_LIT>' <EOL> else : <EOL> ret [ '<STR_LIT>' ] = '<STR_LIT>' <EOL> ret [ '<STR_LIT>' ] = { <EOL> '<STR_LIT>' : call [ '<STR_LIT>' ] , <EOL> '<STR_LIT>' : call [ '<STR_LIT>' ] <EOL> } <EOL> return ret <EOL> def update ( name , <EOL> composer = None , <EOL> php = None , <EOL> user = None , <EOL> prefer_source = None , <EOL> prefer_dist = None , <EOL> no_scripts = None , <EOL> no_plugins = None , <EOL> optimize = None , <EOL> no_dev = None , <EOL> quiet = False , <EOL> composer_home = '<STR_LIT>' ) : <EOL> '''<STR_LIT>''' <EOL> ret = { '<STR_LIT:name>' : name , '<STR_LIT:result>' : None , '<STR_LIT>' : '<STR_LIT>' , '<STR_LIT>' : { } } <EOL> is_installed = __salt__ [ '<STR_LIT>' ] ( name ) <EOL> if is_installed : <EOL> old_status = "<STR_LIT>" . format ( name ) <EOL> else : <EOL> old_status = "<STR_LIT>" . format ( name ) <EOL> if __opts__ [ '<STR_LIT:test>' ] is True : <EOL> ret [ '<STR_LIT>' ] = '<STR_LIT>' . format ( name ) <EOL> ret [ '<STR_LIT>' ] = { <EOL> '<STR_LIT>' : old_status , <EOL> '<STR_LIT>' : '<STR_LIT>' . format ( name ) <EOL> } <EOL> ret [ '<STR_LIT:result>' ] = None <EOL> return ret <EOL> try : <EOL> call = __salt__ [ '<STR_LIT>' ] ( <EOL> name , <EOL> composer = composer , <EOL> php = php , <EOL> runas = user , <EOL> prefer_source = prefer_source , <EOL> prefer_dist = prefer_dist , <EOL> no_scripts = no_scripts , <EOL> no_plugins = no_plugins , <EOL> optimize = optimize , <EOL> no_dev = no_dev , <EOL> quiet = quiet , <EOL> composer_home = composer_home <EOL> ) <EOL> except ( SaltException ) as err : <EOL> ret [ '<STR_LIT:result>' ] = False <EOL> ret [ '<STR_LIT>' ] = '<STR_LIT>' . format ( name , err ) <EOL> return ret <EOL> ret [ '<STR_LIT:result>' ] = True <EOL> if quiet is True : <EOL> ret [ '<STR_LIT>' ] = '<STR_LIT>' <EOL> else : <EOL> ret [ '<STR_LIT>' ] = '<STR_LIT>' <EOL> ret [ '<STR_LIT>' ] = { <EOL> '<STR_LIT>' : call [ '<STR_LIT>' ] , <EOL> '<STR_LIT>' : call [ '<STR_LIT>' ] <EOL> } <EOL> return ret </s>
