@@ -455,8 +455,10 @@ var _clusterInfoCmd = &cobra.Command{
455
455
456
456
if _flagClusterInfoDebug {
457
457
cmdDebug (awsClient , accessConfig )
458
+ } else if _flagClusterInfoPrintConfig {
459
+ cmdPrintConfig (awsClient , accessConfig , _flagOutput )
458
460
} else {
459
- cmdInfo (awsClient , accessConfig , stacks , _flagClusterInfoPrintConfig , _flagOutput , _flagClusterDisallowPrompt )
461
+ cmdInfo (awsClient , accessConfig , stacks , _flagOutput , _flagClusterDisallowPrompt )
460
462
}
461
463
},
462
464
}
@@ -853,7 +855,27 @@ var _clusterHealthCmd = &cobra.Command{
853
855
},
854
856
}
855
857
856
- func cmdInfo (awsClient * awslib.Client , accessConfig * clusterconfig.AccessConfig , stacks clusterstate.ClusterStacks , printConfig bool , outputType flags.OutputType , disallowPrompt bool ) {
858
+ func cmdPrintConfig (awsClient * awslib.Client , accessConfig * clusterconfig.AccessConfig , outputType flags.OutputType ) {
859
+ clusterConfig := refreshCachedClusterConfig (awsClient , accessConfig , outputType == flags .PrettyOutputType )
860
+
861
+ infoInterface := clusterConfig .CoreConfig
862
+
863
+ if outputType == flags .JSONOutputType {
864
+ outputBytes , err := libjson .Marshal (infoInterface )
865
+ if err != nil {
866
+ exit .Error (err )
867
+ }
868
+ fmt .Println (string (outputBytes ))
869
+ } else {
870
+ outputBytes , err := yaml .Marshal (infoInterface )
871
+ if err != nil {
872
+ exit .Error (err )
873
+ }
874
+ fmt .Println (string (outputBytes ))
875
+ }
876
+ }
877
+
878
+ func cmdInfo (awsClient * awslib.Client , accessConfig * clusterconfig.AccessConfig , stacks clusterstate.ClusterStacks , outputType flags.OutputType , disallowPrompt bool ) {
857
879
clusterConfig := refreshCachedClusterConfig (awsClient , accessConfig , outputType == flags .PrettyOutputType )
858
880
859
881
operatorLoadBalancer , err := getLoadBalancer (accessConfig .ClusterName , OperatorLoadBalancer , awsClient )
@@ -875,18 +897,13 @@ func cmdInfo(awsClient *awslib.Client, accessConfig *clusterconfig.AccessConfig,
875
897
}
876
898
infoResponse .ClusterConfig .Config = clusterConfig
877
899
878
- var infoInterface interface {}
879
- if printConfig {
880
- infoInterface = infoResponse .ClusterConfig .Config
881
- } else {
882
- infoInterface = map [string ]interface {}{
883
- "cluster_config" : infoResponse .ClusterConfig .Config ,
884
- "cluster_metadata" : infoResponse .ClusterConfig .OperatorMetadata ,
885
- "worker_node_infos" : infoResponse .WorkerNodeInfos ,
886
- "operator_node_infos" : infoResponse .OperatorNodeInfos ,
887
- "endpoint_operator" : operatorEndpoint ,
888
- "endpoint_api" : apiEndpoint ,
889
- }
900
+ infoInterface := map [string ]interface {}{
901
+ "cluster_config" : infoResponse .ClusterConfig .Config ,
902
+ "cluster_metadata" : infoResponse .ClusterConfig .OperatorMetadata ,
903
+ "worker_node_infos" : infoResponse .WorkerNodeInfos ,
904
+ "operator_node_infos" : infoResponse .OperatorNodeInfos ,
905
+ "endpoint_operator" : operatorEndpoint ,
906
+ "endpoint_api" : apiEndpoint ,
890
907
}
891
908
892
909
var outputBytes []byte
0 commit comments