csm icon indicating copy to clipboard operation
csm copied to clipboard

[FEATURE]: `repctl get` hide timestamp and logs & add JSON/YAML output option

Open coulof opened this issue 2 years ago • 1 comments

Describe the solution you'd like repctl v1.2.0 displays timestamps and log level in addition to the table outputs. We should reserve logs displayed to the verbose more only ; for example right now we have:

[admin@hdfs01 dell-csi-helm-installer (¤|site-b:default)]$ repctl get pvc
[2022-06-14 02:03:31]  INFO listing persistent volume claims
[2022-06-14 02:03:31]  INFO Cluster: site-a
+-------------------------------------------+
| PersistentVolumeClaim                     |
+-------------------------------------------+
Name    SC      RG      Namespace       rPVC    rPV     rPVCNamespace   RemoteClusterID
[2022-06-14 02:03:31]  INFO
[2022-06-14 02:03:31]  INFO Cluster: site-b
+-------------------------------------------+
| PersistentVolumeClaim                     |
+-------------------------------------------+
Name    SC      RG      Namespace       rPVC    rPV     rPVCNamespace   RemoteClusterID
[2022-06-14 02:03:31]  INFO

A display without verbose mode should be as before:

[admin@hdfs01 dell-csi-helm-installer (¤|site-b:default)]$ repctl get pvc
Cluster: site-a
+-------------------------------------------+
| PersistentVolumeClaim                     |
+-------------------------------------------+
Name    SC      RG      Namespace       rPVC    rPV     rPVCNamespace   RemoteClusterID
Cluster: site-b
+-------------------------------------------+
| PersistentVolumeClaim                     |
+-------------------------------------------+
Name    SC      RG      Namespace       rPVC    rPV     rPVCNamespace   RemoteClusterID

Also, it will be nice to have a --json and/or a --yaml to display raw objects and ease the processing by scripts.

Describe alternatives you've considered None

Additional context The previous display was better for readability. JSON/YAML output helps with automation

coulof avatar Jun 14 '22 09:06 coulof

We should also consider keeping the repctl.log in a single location. Repctl currently creates the log file in the current directory. This results in a scattering of logs whenever repctl is used in different locations. May be cleaner to use the $HOME/.repctl/repctl.log path and perhaps have an override environment variable (REPCTL_HOME).

donatwork avatar May 02 '23 05:05 donatwork