Stanislav Riazanov | e898ea8 | 2018-12-24 17:44:43 +0400 | [diff] [blame] | 1 | import logging |
| 2 | |
| 3 | logger = logging.getLogger(__name__) |
| 4 | |
| 5 | def __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_flowdurability state module cannot be loaded: ' |
| 13 | 'jenkins_common not found') |
| 14 | return True |
| 15 | |
| 16 | |
| 17 | def flowdurability(name, flowdurabilitylevel): |
| 18 | """ |
| 19 | Jenkins workflow plugin flow durability level config state method |
| 20 | |
| 21 | :flowdurabilitylevel: Flow Durability Level: |
| 22 | MAX_SURVIVABILITY |
| 23 | PERFORMANCE_OPTIMIZED |
| 24 | SURVIVABLE_NONATOMIC |
| 25 | :returns: salt-specified state dict |
| 26 | """ |
| 27 | |
| 28 | template = __salt__['jenkins_common.load_template']( |
| 29 | 'salt://jenkins/files/groovy/flowdurability.template', |
| 30 | __env__) |
| 31 | |
| 32 | return __salt__['jenkins_common.api_call'](name, template, |
| 33 | ['CHANGED', 'EXISTS'], |
| 34 | {'flowdurabilitylevel': flowdurabilitylevel}, |
| 35 | 'FlowDurabilityLevel config') |