blob: f3e7d1c260a0a886b2c20beeaac5cfca9d303c29 [file] [log] [blame]
Ales Komarek585bd462017-08-24 09:33:32 +02001/**
2 * Update formulas on salt master
3 *
4 * Expected parameters:
5 * SALT_MASTER_CREDENTIALS Credentials to the Salt API.
6 * SALT_MASTER_URL Full Salt API address [https://10.10.10.1:8000].
7 * TARGET_SERVERS Server to update
8 *
9**/
10
11def common = new com.mirantis.mk.Common()
12def salt = new com.mirantis.mk.Salt()
13
14def saltMaster
15def target = ['expression': TARGET_SERVERS, 'type': 'compound']
16def result
17
18node("python") {
19 try {
20
21 stage('Connect to Salt master') {
22 saltMaster = salt.connection(SALT_MASTER_URL, SALT_MASTER_CREDENTIALS)
23 }
24
25 stage('Update Salt formulas') {
26 result = salt.runSaltCommand(saltMaster, 'local', target, 'state.apply', null, 'salt.master.env')
27 salt.checkResult(result)
28 }
29
30 } catch (Throwable e) {
31 currentBuild.result = 'FAILURE'
32 throw e
33 }
34}