Skip to content

Commit

Permalink
Merge pull request openshift#741 from tbrisker/simplelogger
Browse files Browse the repository at this point in the history
Simplify logger package
  • Loading branch information
openshift-ci[bot] authored Jun 16, 2022
2 parents be42f6a + dfb62f1 commit 35af8a3
Show file tree
Hide file tree
Showing 73 changed files with 78 additions and 120 deletions.
2 changes: 1 addition & 1 deletion cmd/create/accountroles/cmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ func init() {

func run(cmd *cobra.Command, argv []string) {
reporter := rprtr.CreateReporterOrExit()
logger := logging.CreateLoggerOrExit(reporter)
logger := logging.NewLogger()

mode, err := aws.GetMode()
if err != nil {
Expand Down
2 changes: 1 addition & 1 deletion cmd/create/admin/cmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ func init() {

func run(cmd *cobra.Command, _ []string) {
reporter := rprtr.CreateReporterOrExit()
logger := logging.CreateLoggerOrExit(reporter)
logger := logging.NewLogger()

clusterKey, err := ocm.GetClusterKey()
if err != nil {
Expand Down
2 changes: 1 addition & 1 deletion cmd/create/cluster/cmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -489,7 +489,7 @@ func networkTypeCompletion(cmd *cobra.Command, args []string, toComplete string)

func run(cmd *cobra.Command, _ []string) {
reporter := rprtr.CreateReporterOrExit()
logger := logging.CreateLoggerOrExit(reporter)
logger := logging.NewLogger()
var err error

// Create the client for the OCM API:
Expand Down
2 changes: 1 addition & 1 deletion cmd/create/idp/cmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -293,7 +293,7 @@ func init() {

interactive.AddFlag(flags)
reporter = rprtr.CreateReporterOrExit()
logger = logging.CreateLoggerOrExit(reporter)
logger = logging.NewLogger()
}

func run(cmd *cobra.Command, _ []string) {
Expand Down
2 changes: 1 addition & 1 deletion cmd/create/ingress/cmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ func init() {

func run(cmd *cobra.Command, _ []string) {
reporter := rprtr.CreateReporterOrExit()
logger := logging.CreateLoggerOrExit(reporter)
logger := logging.NewLogger()

clusterKey, err := ocm.GetClusterKey()
if err != nil {
Expand Down
2 changes: 1 addition & 1 deletion cmd/create/machinepool/cmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ func init() {

func run(cmd *cobra.Command, _ []string) {
reporter := rprtr.CreateReporterOrExit()
logger := logging.CreateLoggerOrExit(reporter)
logger := logging.NewLogger()

clusterKey, err := ocm.GetClusterKey()
if err != nil {
Expand Down
2 changes: 1 addition & 1 deletion cmd/create/ocmrole/cmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ func init() {

func run(cmd *cobra.Command, argv []string) {
reporter := rprtr.CreateReporterOrExit()
logger := logging.CreateLoggerOrExit(reporter)
logger := logging.NewLogger()

mode, err := aws.GetMode()
if err != nil {
Expand Down
2 changes: 1 addition & 1 deletion cmd/create/oidcprovider/cmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ func init() {

func run(cmd *cobra.Command, argv []string) {
reporter := rprtr.CreateReporterOrExit()
logger := logging.CreateLoggerOrExit(reporter)
logger := logging.NewLogger()

// Allow the command to be called programmatically
skipInteractive := false
Expand Down
2 changes: 1 addition & 1 deletion cmd/create/operatorroles/cmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ func init() {

func run(cmd *cobra.Command, argv []string) {
reporter := rprtr.CreateReporterOrExit()
logger := logging.CreateLoggerOrExit(reporter)
logger := logging.NewLogger()

// Allow the command to be called programmatically
skipInteractive := false
Expand Down
2 changes: 1 addition & 1 deletion cmd/create/service/cmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ func init() {

func run(cmd *cobra.Command, argv []string) {
reporter := rprtr.CreateReporterOrExit()
logger := logging.CreateLoggerOrExit(reporter)
logger := logging.NewLogger()

if args.ServiceType == "" {
reporter.Errorf("Service type not specified.")
Expand Down
2 changes: 1 addition & 1 deletion cmd/create/userrole/cmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ func init() {

func run(cmd *cobra.Command, argv []string) {
reporter := rprtr.CreateReporterOrExit()
logger := logging.CreateLoggerOrExit(reporter)
logger := logging.NewLogger()

mode, err := aws.GetMode()
if err != nil {
Expand Down
2 changes: 1 addition & 1 deletion cmd/describe/addon/cmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ var Cmd = &cobra.Command{

func run(_ *cobra.Command, argv []string) {
reporter := rprtr.CreateReporterOrExit()
logger := logging.CreateLoggerOrExit(reporter)
logger := logging.NewLogger()

// Create the client for the OCM API:
ocmClient, err := ocm.NewClient().
Expand Down
2 changes: 1 addition & 1 deletion cmd/describe/admin/cmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ func init() {

func run(cmd *cobra.Command, _ []string) {
reporter := rprtr.CreateReporterOrExit()
logger := logging.CreateLoggerOrExit(reporter)
logger := logging.NewLogger()

clusterKey, err := ocm.GetClusterKey()
if err != nil {
Expand Down
2 changes: 1 addition & 1 deletion cmd/describe/cluster/cmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ func init() {

func run(cmd *cobra.Command, argv []string) {
reporter := rprtr.CreateReporterOrExit()
logger := logging.CreateLoggerOrExit(reporter)
logger := logging.NewLogger()

var clusterKey string
var err error
Expand Down
2 changes: 1 addition & 1 deletion cmd/describe/installation/cmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ func init() {

func run(_ *cobra.Command, argv []string) {
reporter := rprtr.CreateReporterOrExit()
logger := logging.CreateLoggerOrExit(reporter)
logger := logging.NewLogger()

if args.clusterKey == "" {
reporter.Errorf(
Expand Down
2 changes: 1 addition & 1 deletion cmd/describe/service/cmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ func init() {

func run(cmd *cobra.Command, argv []string) {
reporter := rprtr.CreateReporterOrExit()
logger := logging.CreateLoggerOrExit(reporter)
logger := logging.NewLogger()

if args.ID == "" {
reporter.Errorf("id not specified.")
Expand Down
2 changes: 1 addition & 1 deletion cmd/dlt/accountroles/cmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ func init() {

func run(cmd *cobra.Command, _ []string) {
reporter := rprtr.CreateReporterOrExit()
logger := logging.CreateLoggerOrExit(reporter)
logger := logging.NewLogger()

// Determine if interactive mode is needed (if a prefix is not provided, fallback to interactive mode)
if !interactive.Enabled() && !cmd.Flags().Changed("mode") || args.prefix == "" {
Expand Down
2 changes: 1 addition & 1 deletion cmd/dlt/admin/cmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ func init() {

func run(cmd *cobra.Command, _ []string) {
reporter := rprtr.CreateReporterOrExit()
logger := logging.CreateLoggerOrExit(reporter)
logger := logging.NewLogger()

clusterKey, err := ocm.GetClusterKey()
if err != nil {
Expand Down
2 changes: 1 addition & 1 deletion cmd/dlt/cluster/cmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ func init() {

func run(cmd *cobra.Command, _ []string) {
reporter := rprtr.CreateReporterOrExit()
logger := logging.CreateLoggerOrExit(reporter)
logger := logging.NewLogger()

clusterKey, err := ocm.GetClusterKey()
if err != nil {
Expand Down
2 changes: 1 addition & 1 deletion cmd/dlt/idp/cmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ func init() {

func run(_ *cobra.Command, argv []string) {
reporter := rprtr.CreateReporterOrExit()
logger := logging.CreateLoggerOrExit(reporter)
logger := logging.NewLogger()

idpName := argv[0]

Expand Down
2 changes: 1 addition & 1 deletion cmd/dlt/ingress/cmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ func init() {

func run(_ *cobra.Command, argv []string) {
reporter := rprtr.CreateReporterOrExit()
logger := logging.CreateLoggerOrExit(reporter)
logger := logging.NewLogger()

ingressID := argv[0]
if !ingressKeyRE.MatchString(ingressID) {
Expand Down
2 changes: 1 addition & 1 deletion cmd/dlt/machinepool/cmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ func init() {

func run(_ *cobra.Command, argv []string) {
reporter := rprtr.CreateReporterOrExit()
logger := logging.CreateLoggerOrExit(reporter)
logger := logging.NewLogger()

machinePoolID := argv[0]
if machinePoolID != "Default" && !machinePoolKeyRE.MatchString(machinePoolID) {
Expand Down
2 changes: 1 addition & 1 deletion cmd/dlt/ocmrole/cmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ func init() {

func run(cmd *cobra.Command, argv []string) error {
reporter := rprtr.CreateReporterOrExit()
logger := logging.CreateLoggerOrExit(reporter)
logger := logging.NewLogger()
awsClient := aws.CreateNewClientOrExit(logger, reporter)
ocmClient := ocm.CreateNewClientOrExit(logger, reporter)
defer func() {
Expand Down
5 changes: 3 additions & 2 deletions cmd/dlt/oidcprovider/cmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ package oidcprovider
import (
"fmt"

"os"

"github.com/openshift/rosa/pkg/aws"
"github.com/openshift/rosa/pkg/interactive"
"github.com/openshift/rosa/pkg/interactive/confirm"
Expand All @@ -27,7 +29,6 @@ import (
rprtr "github.com/openshift/rosa/pkg/reporter"
"github.com/spf13/cobra"
errors "github.com/zgalor/weberr"
"os"
)

var Cmd = &cobra.Command{
Expand All @@ -50,7 +51,7 @@ func init() {

func run(cmd *cobra.Command, argv []string) {
reporter := rprtr.CreateReporterOrExit()
logger := logging.CreateLoggerOrExit(reporter)
logger := logging.NewLogger()
if len(argv) == 1 && !cmd.Flag("cluster").Changed {
ocm.SetClusterKey(argv[0])
}
Expand Down
2 changes: 1 addition & 1 deletion cmd/dlt/operatorrole/cmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ func init() {

func run(cmd *cobra.Command, argv []string) {
reporter := rprtr.CreateReporterOrExit()
logger := logging.CreateLoggerOrExit(reporter)
logger := logging.NewLogger()

if len(argv) == 1 && !cmd.Flag("cluster").Changed {
args.clusterKey = argv[0]
Expand Down
2 changes: 1 addition & 1 deletion cmd/dlt/service/cmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ func init() {

func run(cmd *cobra.Command, _ []string) {
reporter := rprtr.CreateReporterOrExit()
logger := logging.CreateLoggerOrExit(reporter)
logger := logging.NewLogger()

if args.ID == "" {
reporter.Errorf("id not specified.")
Expand Down
2 changes: 1 addition & 1 deletion cmd/dlt/upgrade/cmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ func init() {

func run(cmd *cobra.Command, _ []string) {
reporter := rprtr.CreateReporterOrExit()
logger := logging.CreateLoggerOrExit(reporter)
logger := logging.NewLogger()

clusterKey, err := ocm.GetClusterKey()
if err != nil {
Expand Down
2 changes: 1 addition & 1 deletion cmd/dlt/userrole/cmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ func init() {

func run(cmd *cobra.Command, argv []string) {
reporter := rprtr.CreateReporterOrExit()
logger := logging.CreateLoggerOrExit(reporter)
logger := logging.NewLogger()
awsClient := aws.CreateNewClientOrExit(logger, reporter)
ocmClient := ocm.CreateNewClientOrExit(logger, reporter)
defer func() {
Expand Down
2 changes: 1 addition & 1 deletion cmd/edit/addon/cmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ func init() {

func run(cmd *cobra.Command, argv []string) {
reporter := rprtr.CreateReporterOrExit()
logger := logging.CreateLoggerOrExit(reporter)
logger := logging.NewLogger()

// Parse out CLI flags, then override positional arguments
_ = cmd.Flags().Parse(argv)
Expand Down
2 changes: 1 addition & 1 deletion cmd/edit/cluster/cmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ func run(cmd *cobra.Command, _ []string) {
}
}

logger := logging.CreateLoggerOrExit(reporter)
logger := logging.NewLogger()

// Create the client for the OCM API:
ocmClient, err := ocm.NewClient().
Expand Down
2 changes: 1 addition & 1 deletion cmd/edit/ingress/cmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ func init() {

func run(cmd *cobra.Command, argv []string) {
reporter := rprtr.CreateReporterOrExit()
logger := logging.CreateLoggerOrExit(reporter)
logger := logging.NewLogger()

ingressID := argv[0]
if !ingressKeyRE.MatchString(ingressID) {
Expand Down
2 changes: 1 addition & 1 deletion cmd/edit/machinepool/cmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ func init() {

func run(cmd *cobra.Command, argv []string) {
reporter := rprtr.CreateReporterOrExit()
logger := logging.CreateLoggerOrExit(reporter)
logger := logging.NewLogger()

machinePoolID := argv[0]
if machinePoolID != "Default" && !machinePoolKeyRE.MatchString(machinePoolID) {
Expand Down
2 changes: 1 addition & 1 deletion cmd/edit/service/cmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ func init() {

func run(cmd *cobra.Command, argv []string) {
reporter := rprtr.CreateReporterOrExit()
logger := logging.CreateLoggerOrExit(reporter)
logger := logging.NewLogger()

if args.ID == "" {
reporter.Errorf("Service id not specified.")
Expand Down
2 changes: 1 addition & 1 deletion cmd/grant/user/cmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ func init() {

func run(_ *cobra.Command, argv []string) {
reporter := rprtr.CreateReporterOrExit()
logger := logging.CreateLoggerOrExit(reporter)
logger := logging.NewLogger()

clusterKey, err := ocm.GetClusterKey()
if err != nil {
Expand Down
2 changes: 1 addition & 1 deletion cmd/hibernate/cluster/cmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ func init() {

func run(cmd *cobra.Command, _ []string) {
reporter := rprtr.CreateReporterOrExit()
logger := logging.CreateLoggerOrExit(reporter)
logger := logging.NewLogger()

clusterKey, err := ocm.GetClusterKey()
if err != nil {
Expand Down
2 changes: 1 addition & 1 deletion cmd/initialize/cmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ func init() {

func run(cmd *cobra.Command, argv []string) {
reporter := rprtr.CreateReporterOrExit()
logger := logging.CreateLoggerOrExit(reporter)
logger := logging.NewLogger()

// If necessary, call `login` as part of `init`. We do this before
// other validations to get the prompt out of the way before performing
Expand Down
2 changes: 1 addition & 1 deletion cmd/install/addon/cmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ func init() {

func run(cmd *cobra.Command, argv []string) {
reporter := rprtr.CreateReporterOrExit()
logger := logging.CreateLoggerOrExit(reporter)
logger := logging.NewLogger()

// Parse out CLI flags, then override positional arguments
_ = cmd.Flags().Parse(argv)
Expand Down
2 changes: 1 addition & 1 deletion cmd/link/ocmrole/cmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ func init() {

func run(cmd *cobra.Command, argv []string) (err error) {
reporter := rprtr.CreateReporterOrExit()
logger := logging.CreateLoggerOrExit(reporter)
logger := logging.NewLogger()

if len(argv) > 0 {
args.roleArn = argv[0]
Expand Down
4 changes: 2 additions & 2 deletions cmd/link/userrole/cmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ var Cmd = &cobra.Command{
Aliases: []string{"userrole"},
Short: "link user role to specific OCM account.",
Long: "link user role to specific OCM account before create your cluster.",
Example: ` # Link user roles
Example: ` # Link user roles
rosa link user-role --role-arn arn:aws:iam::{accountid}:role/{prefix}-User-{username}-Role`,
RunE: run,
}
Expand All @@ -70,7 +70,7 @@ func init() {

func run(cmd *cobra.Command, argv []string) (err error) {
reporter := rprtr.CreateReporterOrExit()
logger := logging.CreateLoggerOrExit(reporter)
logger := logging.NewLogger()

if len(argv) > 0 {
args.roleArn = argv[0]
Expand Down
2 changes: 1 addition & 1 deletion cmd/list/accountroles/cmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ func init() {

func run(_ *cobra.Command, _ []string) {
reporter := rprtr.CreateReporterOrExit()
logger := logging.CreateLoggerOrExit(reporter)
logger := logging.NewLogger()

// Create the AWS client:
awsClient, err := aws.NewClient().
Expand Down
2 changes: 1 addition & 1 deletion cmd/list/addon/cmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ func init() {

func run(_ *cobra.Command, _ []string) {
reporter := rprtr.CreateReporterOrExit()
logger := logging.CreateLoggerOrExit(reporter)
logger := logging.NewLogger()

// Check that the cluster key (name, identifier or external identifier) given by the user
// is reasonably safe so that there is no risk of SQL injection:
Expand Down
Loading

0 comments on commit 35af8a3

Please sign in to comment.