Joey Armstrong | 379660e | 2022-12-14 19:21:00 -0500 | [diff] [blame] | 1 | #!/usr/bin/env groovy |
| 2 | // ----------------------------------------------------------------------- |
Joey Armstrong | af679da | 2023-01-31 14:22:41 -0500 | [diff] [blame] | 3 | // Copyright 2021-2023 Open Networking Foundation (ONF) and the ONF Contributors |
| 4 | // |
| 5 | // Licensed under the Apache License, Version 2.0 (the "License"); |
| 6 | // you may not use this file except in compliance with the License. |
| 7 | // You may obtain a copy of the License at |
| 8 | // |
| 9 | // http://www.apache.org/licenses/LICENSE-2.0 |
| 10 | // |
| 11 | // Unless required by applicable law or agreed to in writing, software |
| 12 | // distributed under the License is distributed on an "AS IS" BASIS, |
| 13 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 14 | // See the License for the specific language governing permissions and |
| 15 | // limitations under the License. |
Joey Armstrong | 379660e | 2022-12-14 19:21:00 -0500 | [diff] [blame] | 16 | // ----------------------------------------------------------------------- |
| 17 | |
| 18 | // ----------------------------------------------------------------------- |
| 19 | // ----------------------------------------------------------------------- |
| 20 | def getIam(String func) |
| 21 | { |
| 22 | // Cannot rely on a stack trace due to jenkins manipulation |
| 23 | String src = 'vars/showCommands' |
| 24 | String iam = [src, func].join('::') |
| 25 | return iam |
| 26 | } |
| 27 | |
| 28 | // ----------------------------------------------------------------------- |
| 29 | // ----------------------------------------------------------------------- |
| 30 | def process(Map config) |
| 31 | { |
Joey Armstrong | 7adbfb0 | 2023-01-24 17:02:37 -0500 | [diff] [blame] | 32 | String iam = getIam('process') |
Joey Armstrong | 379660e | 2022-12-14 19:21:00 -0500 | [diff] [blame] | 33 | |
| 34 | // list.each{ } could be used here but simple for now. |
| 35 | println("** ${iam}: voltctl command attributes") |
| 36 | sh('''which -a voltctl''') |
| 37 | sh('''voltctl version''') |
| 38 | |
| 39 | return |
| 40 | } |
| 41 | |
| 42 | // ----------------------------------------------------------------------- |
| 43 | // ----------------------------------------------------------------------- |
| 44 | def call(Map config) |
| 45 | { |
| 46 | String iam = getIam('main') |
| 47 | println("** ${iam}: ENTER") |
| 48 | |
| 49 | if (!config) |
| 50 | { |
| 51 | config = [:] |
| 52 | } |
| 53 | |
| 54 | try |
| 55 | { |
| 56 | process(config) |
| 57 | } |
| 58 | catch (Exception err) |
| 59 | { |
| 60 | println("** ${iam}: EXCEPTION ${err}") |
| 61 | throw err |
| 62 | } |
| 63 | finally |
| 64 | { |
| 65 | println("** ${iam}: LEAVE") |
| 66 | } |
| 67 | return |
| 68 | } |
| 69 | |
Joey Armstrong | af679da | 2023-01-31 14:22:41 -0500 | [diff] [blame] | 70 | // [EOF] |