| import logging |
| |
| logger = logging.getLogger(__name__) |
| |
| def __virtual__(): |
| ''' |
| Only load if jenkins_common module exist. |
| ''' |
| if 'jenkins_common.call_groovy_script' not in __salt__: |
| return ( |
| False, |
| 'The jenkins_location state module cannot be loaded: ' |
| 'jenkins_common not found') |
| return True |
| |
| |
| def config(name, url, email=''): |
| """ |
| Jenkins location configuration. This value is used to |
| let Jenkins know how to refer to itself. |
| |
| :url: Jenkins location url: |
| :email: Jenkins server email |
| :returns: salt-specified state dict |
| """ |
| |
| template = __salt__['jenkins_common.load_template']( |
| 'salt://jenkins/files/groovy/location.template', |
| __env__) |
| |
| return __salt__['jenkins_common.api_call'](name, template, |
| ['CHANGED', 'EXISTS'], |
| {'url': url, 'email': email}, |
| 'location config') |