Skip to content

Commit cd2b69b

Browse files
authored
Merge pull request #3 from VeritasOS/main
Use yaml.v3; Set SHELL to bash
2 parents aceaf7f + cb8e412 commit cd2b69b

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

57 files changed

+2595
-6232
lines changed

Makefile

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Copyright (c) 2021 Veritas Technologies LLC. All rights reserved. IP63-2828-7171-04-15-9
1+
# Copyright (c) 2023 Veritas Technologies LLC. All rights reserved. IP63-2828-7171-04-15-9
22

33
# A Self-Documenting Makefile: http://marmelab.com/blog/2016/02/29/auto-documented-makefile.html
44
.DEFAULT_GOAL := help
@@ -7,6 +7,7 @@ help: ## Display this help message.
77
@grep -E '^[a-zA-Z0-9_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-20s\033[0m %s\n", $$1, $$2}'
88

99
TOP=$(CURDIR)
10+
include $(TOP)/Makefile.conf
1011

1112
# Go build related variables
1213
GOSRC=$(TOP)

Makefile.conf

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# Copyright (c) 2023 Veritas Technologies LLC. All rights reserved. IP63-2828-7171-04-15-9
2+
3+
SHELL = /bin/bash

cmd/pm/integ_test.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright (c) 2021 Veritas Technologies LLC. All rights reserved. IP63-2828-7171-04-15-9
1+
// Copyright (c) 2023 Veritas Technologies LLC. All rights reserved. IP63-2828-7171-04-15-9
22

33
package main
44

@@ -16,7 +16,7 @@ import (
1616

1717
"github.com/VeritasOS/plugin-manager/config"
1818

19-
yaml "gopkg.in/yaml.v2"
19+
yaml "gopkg.in/yaml.v3"
2020
)
2121

2222
// Config is Plugin Manager's configuration information.

config/config.go

+21-15
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright (c) 2021 Veritas Technologies LLC. All rights reserved. IP63-2828-7171-04-15-9
1+
// Copyright (c) 2023 Veritas Technologies LLC. All rights reserved. IP63-2828-7171-04-15-9
22

33
package config
44

@@ -8,7 +8,7 @@ import (
88
"os"
99
"path/filepath"
1010

11-
"gopkg.in/yaml.v2"
11+
"gopkg.in/yaml.v3"
1212

1313
logutil "github.com/VeritasOS/plugin-manager/utils/log"
1414
)
@@ -59,15 +59,17 @@ func GetPluginsLibrary() string {
5959
}
6060

6161
// GetPluginsDir gets location of plugins directory.
62-
// NOTE: This is deprecated, Use GetPluginsLibrary() instead.
62+
//
63+
// NOTE: This is deprecated, Use GetPluginsLibrary() instead.
6364
func GetPluginsDir() string {
6465
return filepath.FromSlash(filepath.Clean(myConfig.PluginManager.PluginDir) +
6566
string(os.PathSeparator))
6667
}
6768

6869
// GetPMLogDir provides location for storing Plugin Manager logs.
69-
// NOTE: The plugin logs would be stored "plugins" directory under the
70-
// same path, and use GetPluginsLogDir() to get that path.
70+
//
71+
// NOTE: The plugin logs would be stored "plugins" directory under the
72+
// same path, and use GetPluginsLogDir() to get that path.
7173
func GetPMLogDir() string {
7274
return filepath.FromSlash(filepath.Clean(myConfig.PluginManager.LogDir) +
7375
string(os.PathSeparator))
@@ -136,9 +138,10 @@ func readConfigFile(confFilePath string) (Config, error) {
136138
}
137139

138140
// SetLogDir sets the location for storing Plugin Manager logs.
139-
// Use GetPMLogDir() to obtain this location from config.
140-
// NOTE: The plugin logs would be stored "plugins" directory under the
141-
// same path, and use GetPluginsLogDir() to get that path.
141+
//
142+
// Use GetPMLogDir() to obtain this location from config.
143+
// NOTE: The plugin logs would be stored "plugins" directory under the
144+
// same path, and use GetPluginsLogDir() to get that path.
142145
func SetLogDir(logDir string) {
143146
// TODO: Move log parameters one level up in config as it's common to asum,
144147
// and not specific to PM.
@@ -147,9 +150,10 @@ func SetLogDir(logDir string) {
147150
}
148151

149152
// SetLogFile sets the log file to use.
150-
// Use GetLogDir() to obtain this location from config.
151-
// NOTE: The plugin logs would be stored "plugins" directory under the
152-
// same path, and use Get/SetPluginsLogDir() to get/set that path.
153+
//
154+
// Use GetLogDir() to obtain this location from config.
155+
// NOTE: The plugin logs would be stored "plugins" directory under the
156+
// same path, and use Get/SetPluginsLogDir() to get/set that path.
153157
func SetLogFile(logFile string) {
154158
// TODO: Move log parameters one level up in config as it's common to asum,
155159
// and not specific to PM.
@@ -163,7 +167,8 @@ func SetPluginsLibrary(library string) {
163167
}
164168

165169
// SetPluginsDir sets location of plugins directory.
166-
// NOTE: This is deprecated, Use SetPluginsLibrary() instead.
170+
//
171+
// NOTE: This is deprecated, Use SetPluginsLibrary() instead.
167172
func SetPluginsDir(library string) {
168173
myConfig.PluginManager.PluginDir = filepath.FromSlash(filepath.Clean(library) +
169174
string(os.PathSeparator))
@@ -175,9 +180,10 @@ func SetPMLogFile(logfile string) {
175180
}
176181

177182
// SetPMLogDir sets the location for storing Plugin Manager logs.
178-
// Use GetPMLogDir() to obtain this location from config.
179-
// NOTE: The plugin logs would be stored "plugins" directory under the
180-
// same path, and use GetPluginsLogDir() to get that path.
183+
//
184+
// Use GetPMLogDir() to obtain this location from config.
185+
// NOTE: The plugin logs would be stored "plugins" directory under the
186+
// same path, and use GetPluginsLogDir() to get that path.
181187
func SetPMLogDir(logDir string) {
182188
myConfig.PluginManager.LogDir = filepath.FromSlash(
183189
filepath.Clean(logDir) + string(os.PathSeparator))

go.mod

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
module github.com/VeritasOS/plugin-manager
22

3-
go 1.12
3+
go 1.19
44

5-
require gopkg.in/yaml.v2 v2.4.0
5+
require gopkg.in/yaml.v3 v3.0.1

go.sum

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM=
22
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
3-
gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY=
4-
gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ=
3+
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
4+
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=

graph.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright (c) 2021 Veritas Technologies LLC. All rights reserved. IP63-2828-7171-04-15-9
1+
// Copyright (c) 2023 Veritas Technologies LLC. All rights reserved. IP63-2828-7171-04-15-9
22

33
// Package pm graph is used for generating the graph image.
44
package pm
@@ -108,7 +108,7 @@ func initGraph(pluginType string, pluginsInfo map[string]*PluginAttributes) erro
108108
}
109109

110110
// generateGraph generates an input `.dot` file based on the fileNoExt name,
111-
// and then generates an `.svg` image output file as fileNoExt.svg.
111+
// and then generates an `.svg` image output file as fileNoExt.svg.
112112
func generateGraph() error {
113113
dotFile := getDotFilePath()
114114
svgFile := getImagePath()

plugin.go

+5-5
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright (c) 2021 Veritas Technologies LLC. All rights reserved. IP63-2828-7171-04-15-9
1+
// Copyright (c) 2023 Veritas Technologies LLC. All rights reserved. IP63-2828-7171-04-15-9
22

33
// Package pm defines Plugin Manager (PM) functions like executing
44
// all plugins of a particular plugin type.
@@ -684,10 +684,10 @@ func Run(result *RunStatus, pluginType string) error {
684684
// ScanCommandOptions scans for the command line options and makes appropriate
685685
// function call.
686686
// Input:
687-
// 1. map[string]interface{}
688-
// where, the options could be following:
689-
// "progname": Name of the program along with any cmds (ex: asum pm)
690-
// "cmd-index": Index to the cmd (ex: run)
687+
// 1. map[string]interface{}
688+
// where, the options could be following:
689+
// "progname": Name of the program along with any cmds (ex: asum pm)
690+
// "cmd-index": Index to the cmd (ex: run)
691691
func ScanCommandOptions(options map[string]interface{}) error {
692692
log.Printf("Entering ScanCommandOptions(%+v)...", options)
693693
defer log.Println("Exiting ScanCommandOptions")

utils/log/log.go

+7-7
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright (c) 2021 Veritas Technologies LLC. All rights reserved. IP63-2828-7171-04-15-9
1+
// Copyright (c) 2023 Veritas Technologies LLC. All rights reserved. IP63-2828-7171-04-15-9
22

33
package log
44

@@ -17,7 +17,7 @@ func PrintNLog(format string, a ...interface{}) {
1717
}
1818

1919
// PrintNLogError prints to console and log file along with returning the
20-
// message in error format.
20+
// message in error format.
2121
func PrintNLogError(format string, a ...interface{}) error {
2222
err := fmt.Errorf(format, a...)
2323
log.Printf("ERROR: %v", err.Error())
@@ -26,7 +26,7 @@ func PrintNLogError(format string, a ...interface{}) error {
2626
}
2727

2828
// PrintNLogWarning prints warning message to console and log file along with
29-
// returning the message in error format.
29+
// returning the message in error format.
3030
func PrintNLogWarning(format string, a ...interface{}) error {
3131
err := fmt.Errorf(format, a...)
3232
log.Printf("WARNING: %v", err.Error())
@@ -35,10 +35,10 @@ func PrintNLogWarning(format string, a ...interface{}) error {
3535
}
3636

3737
// SetLogging sets the logfile for this program.
38-
// To handle log rotation, the specified myLogFile would be suffixed with
39-
// the current date before the log file extension.
40-
// Ex: If myLogFile := "/log/asum/pm", then the logfile used for
41-
// logging would be "/log/asum/pm.20181212235500.0000.log".
38+
// To handle log rotation, the specified myLogFile would be suffixed with
39+
// the current date before the log file extension.
40+
// Ex: If myLogFile := "/log/asum/pm", then the logfile used for
41+
// logging would be "/log/asum/pm.20181212235500.0000.log".
4242
func SetLogging(myLogFile string) error {
4343
ts := time.Now().Format(time.RFC3339Nano)
4444
myLogFile = filepath.Clean(myLogFile)

utils/os/os.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
// Copyright (c) 2021 Veritas Technologies LLC. All rights reserved. IP63-2828-7171-04-15-9
1+
// Copyright (c) 2023 Veritas Technologies LLC. All rights reserved. IP63-2828-7171-04-15-9
22

33
// Package os contains pointers to os package functions so as to help
4-
// in unit testing (mocking).
4+
// in unit testing (mocking).
55
package os
66

77
import (

utils/output/output.go

+8-6
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright (c) 2021 Veritas Technologies LLC. All rights reserved. IP63-2828-7171-04-15-9
1+
// Copyright (c) 2023 Veritas Technologies LLC. All rights reserved. IP63-2828-7171-04-15-9
22

33
package output
44

@@ -10,7 +10,7 @@ import (
1010
"log"
1111
"path/filepath"
1212

13-
"gopkg.in/yaml.v2"
13+
"gopkg.in/yaml.v3"
1414
)
1515

1616
// cmdOptions contains commandline parameters/options for generating output in specified format.
@@ -59,8 +59,9 @@ func RegisterCommandOptions(f *flag.FlagSet, defaultParams map[string]string) {
5959
}
6060

6161
// Write writes the given data in the format {json|yaml} that was set in options.
62-
// into a specified file. If file is not specified, then it will print
63-
// on STDOUT.
62+
//
63+
// into a specified file. If file is not specified, then it will print
64+
// on STDOUT.
6465
func Write(data interface{}) error {
6566
log.Println("Entering Write")
6667
defer log.Println("Exiting Write")
@@ -75,8 +76,9 @@ func Write(data interface{}) error {
7576
}
7677

7778
// writeToFile writes the given data in the specified format {json|yaml}
78-
// into a specified file. If file is not specified, then it will print
79-
// on STDOUT.
79+
//
80+
// into a specified file. If file is not specified, then it will print
81+
// on STDOUT.
8082
func writeToFile(data interface{}, format string, filePath string) error {
8183
log.Println("Entering writeToFile")
8284
defer log.Println("Exiting writeToFile")

vendor/gopkg.in/check.v1/.gitignore

-4
This file was deleted.

vendor/gopkg.in/check.v1/.travis.yml

-3
This file was deleted.

vendor/gopkg.in/check.v1/LICENSE

-25
This file was deleted.

vendor/gopkg.in/check.v1/README.md

-20
This file was deleted.

vendor/gopkg.in/check.v1/TODO

-2
This file was deleted.

0 commit comments

Comments
 (0)