blob: cb3bd062d31747695e1e7f159d5a5a5aea0531a6 [file] [log] [blame]
Ales Komarek585bd462017-08-24 09:33:32 +02001/**
2 * Update reclass model 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()
chnyda625f4b42017-10-11 14:10:31 +020013def python = new com.mirantis.mk.Python()
Ales Komarek585bd462017-08-24 09:33:32 +020014
chnyda625f4b42017-10-11 14:10:31 +020015def pepperEnv = "pepperEnv"
Ales Komarek585bd462017-08-24 09:33:32 +020016def target = ['expression': TARGET_SERVERS, 'type': 'compound']
17def result
Jakub Josefa63f9862018-01-11 17:58:38 +010018timeout(time: 12, unit: 'HOURS') {
19 node("python") {
20 try {
Ales Komarek585bd462017-08-24 09:33:32 +020021
Jakub Josefa63f9862018-01-11 17:58:38 +010022 stage('Setup virtualenv for Pepper') {
23 python.setupPepperVirtualenv(pepperEnv, SALT_MASTER_URL, SALT_MASTER_CREDENTIALS)
24 }
Ales Komarek585bd462017-08-24 09:33:32 +020025
Jakub Josefa63f9862018-01-11 17:58:38 +010026 stage('Update Reclass model') {
27 result = salt.runSaltCommand(pepperEnv, 'local', target, 'state.apply', null, 'reclass.storage')
28 result = salt.runSaltCommand(pepperEnv, 'local', target, 'state.apply', null, 'reclass.storage.node')
29 salt.checkResult(result)
30 }
31
32 } catch (Throwable e) {
33 currentBuild.result = 'FAILURE'
34 throw e
Ales Komarek585bd462017-08-24 09:33:32 +020035 }
Ales Komarek585bd462017-08-24 09:33:32 +020036 }
37}