Skip to content

Commit

Permalink
replace disable echo with echo in clusterctl describe commands
Browse files Browse the repository at this point in the history
  • Loading branch information
DiptoChakrabarty committed Dec 2, 2021
1 parent 723e0d6 commit 0f48ac3
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 11 deletions.
6 changes: 3 additions & 3 deletions cmd/clusterctl/client/describe.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,9 @@ type DescribeClusterOptions struct {
// ShowMachineSets instructs the discovery process to include machine sets in the ObjectTree.
ShowMachineSets bool

// DisableNoEcho disable hiding MachineInfrastructure or BootstrapConfig objects if the object's ready condition is true
// Echo disable hiding MachineInfrastructure or BootstrapConfig objects if the object's ready condition is true
// or it has the same Status, Severity and Reason of the parent's object ready condition (it is an echo)
DisableNoEcho bool
Echo bool

// DisableGrouping disable grouping machines objects in case the ready condition
// has the same Status, Severity and Reason
Expand Down Expand Up @@ -82,7 +82,7 @@ func (c *clusterctlClient) DescribeCluster(options DescribeClusterOptions) (*tre
return tree.Discovery(context.TODO(), client, options.Namespace, options.ClusterName, tree.DiscoverOptions{
ShowOtherConditions: options.ShowOtherConditions,
ShowMachineSets: options.ShowMachineSets,
DisableNoEcho: options.DisableNoEcho,
Echo: options.Echo,
DisableGrouping: options.DisableGrouping,
})
}
2 changes: 1 addition & 1 deletion cmd/clusterctl/client/tree/discovery.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ type DiscoverOptions struct {

// DisableNoEcho disable hiding MachineInfrastructure or BootstrapConfig objects if the object's ready condition is true
// or it has the same Status, Severity and Reason of the parent's object ready condition (it is an echo)
DisableNoEcho bool
Echo bool

// DisableGrouping disable grouping machines objects in case the ready condition
// has the same Status, Severity and Reason
Expand Down
2 changes: 1 addition & 1 deletion cmd/clusterctl/client/tree/discovery_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ func Test_Discovery(t *testing.T) {
args: args{
discoverOptions: DiscoverOptions{
DisableGrouping: true,
DisableNoEcho: true,
Echo: true,
},
objs: test.NewFakeCluster("ns1", "cluster1").
WithControlPlane(
Expand Down
4 changes: 2 additions & 2 deletions cmd/clusterctl/client/tree/tree.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ type ObjectTreeOptions struct {

// DisableNoEcho disables hiding objects if the object's ready condition has the
// same Status, Severity and Reason of the parent's object ready condition (it is an echo)
DisableNoEcho bool
Echo bool

// DisableGrouping disables grouping sibling objects in case the ready condition
// has the same Status, Severity and Reason
Expand Down Expand Up @@ -92,7 +92,7 @@ func (od ObjectTree) Add(parent, obj client.Object, opts ...AddObjectOption) (ad
// If the object should be hidden if the object's ready condition is true ot it has the
// same Status, Severity and Reason of the parent's object ready condition (it is an echo),
// return early.
if addOpts.NoEcho && !od.options.DisableNoEcho {
if addOpts.NoEcho && !od.options.Echo {
if (objReady != nil && objReady.Status == corev1.ConditionTrue) || hasSameReadyStatusSeverityAndReason(parentReady, objReady) {
return false, false
}
Expand Down
2 changes: 1 addition & 1 deletion cmd/clusterctl/client/tree/tree_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -580,7 +580,7 @@ func Test_Add_NoEcho(t *testing.T) {
{
name: "should add if NoEcho option is present, objects have same ReadyCondition, but NoEcho is disabled",
args: args{
treeOptions: ObjectTreeOptions{DisableNoEcho: true},
treeOptions: ObjectTreeOptions{Echo: true},
addOptions: []AddObjectOption{NoEcho(true)},
obj: fakeMachine("my-machine",
withMachineCondition(conditions.TrueCondition(clusterv1.ReadyCondition)),
Expand Down
6 changes: 3 additions & 3 deletions cmd/clusterctl/cmd/describe_cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ type describeClusterOptions struct {
namespace string
showOtherConditions string
showMachineSets bool
disableNoEcho bool
Echo bool
disableGrouping bool
}

Expand Down Expand Up @@ -108,7 +108,7 @@ func init() {
describeClusterClusterCmd.Flags().BoolVar(&dc.showMachineSets, "show-machinesets", false,
"Show MachineSet objects.")

describeClusterClusterCmd.Flags().BoolVar(&dc.disableNoEcho, "disable-no-echo", false, ""+
describeClusterClusterCmd.Flags().BoolVar(&dc.Echo, "echo", false, ""+
"Disable hiding of a MachineInfrastructure and BootstrapConfig when ready condition is true or it has the Status, Severity and Reason of the machine's object.")
describeClusterClusterCmd.Flags().BoolVar(&dc.disableGrouping, "disable-grouping", false,
"Disable grouping machines when ready condition has the same Status, Severity and Reason.")
Expand Down Expand Up @@ -137,7 +137,7 @@ func runDescribeCluster(name string) error {
ClusterName: name,
ShowOtherConditions: dc.showOtherConditions,
ShowMachineSets: dc.showMachineSets,
DisableNoEcho: dc.disableNoEcho,
Echo: dc.Echo,
DisableGrouping: dc.disableGrouping,
})
if err != nil {
Expand Down

0 comments on commit 0f48ac3

Please sign in to comment.