blob: 7aac8bf1458781dc42e34d170624d04ed8b6fe0d [file] [log] [blame]
Ivan Berezovskiyf28ee092019-02-12 17:16:30 +04001import logging
2
3logger = logging.getLogger(__name__)
4
5def __virtual__():
6 '''
7 Only load if jenkins_common module exist.
8 '''
9 if 'jenkins_common.call_groovy_script' not in __salt__:
10 return (
11 False,
12 'The jenkins_location state module cannot be loaded: '
13 'jenkins_common not found')
14 return True
15
16
17def config(name, url, email=''):
18 """
19 Jenkins location configuration. This value is used to
20 let Jenkins know how to refer to itself.
21
22 :url: Jenkins location url:
23 :email: Jenkins server email
24 :returns: salt-specified state dict
25 """
26
27 template = __salt__['jenkins_common.load_template'](
28 'salt://jenkins/files/groovy/location.template',
29 __env__)
30
31 return __salt__['jenkins_common.api_call'](name, template,
32 ['CHANGED', 'EXISTS'],
33 {'url': url, 'email': email},
34 'location config')