blob: be695ca25fe80a9f907ed79195f6eb42f38b622e [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
18
19node("python") {
20 try {
21
chnyda625f4b42017-10-11 14:10:31 +020022 stage('Setup virtualenv for Pepper') {
Dmitrii Kabanovf31c8962017-10-12 21:00:30 -070023 python.setupPepperVirtualenv(pepperEnv, SALT_MASTER_URL, SALT_MASTER_CREDENTIALS)
Ales Komarek585bd462017-08-24 09:33:32 +020024 }
25
26 stage('Update Reclass model') {
chnyda625f4b42017-10-11 14:10:31 +020027 result = salt.runSaltCommand(pepperEnv, 'local', target, 'state.apply', null, 'reclass.storage')
28 result = salt.runSaltCommand(pepperEnv, 'local', target, 'state.apply', null, 'reclass.storage.node')
Ales Komarek585bd462017-08-24 09:33:32 +020029 salt.checkResult(result)
30 }
31
32 } catch (Throwable e) {
33 currentBuild.result = 'FAILURE'
34 throw e
35 }
36}