blob: 389808250025ebcf0e11ebc949d8517e1480cc35 [file] [log] [blame]
Joey Armstrong379660e2022-12-14 19:21:00 -05001#!/usr/bin/env groovy
2// -----------------------------------------------------------------------
Joey Armstrongaf679da2023-01-31 14:22:41 -05003// 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 Armstrong379660e2022-12-14 19:21:00 -050016// -----------------------------------------------------------------------
17
18// -----------------------------------------------------------------------
19// -----------------------------------------------------------------------
20def 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// -----------------------------------------------------------------------
30def process(Map config)
31{
Joey Armstrong7adbfb02023-01-24 17:02:37 -050032 String iam = getIam('process')
Joey Armstrong379660e2022-12-14 19:21:00 -050033
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// -----------------------------------------------------------------------
44def 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 Armstrongaf679da2023-01-31 14:22:41 -050070// [EOF]