Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Beautify output for dhcpserver commands #592

Merged
merged 1 commit into from
Apr 23, 2024

Conversation

kishen-v
Copy link
Contributor

@kishen-v kishen-v commented Apr 16, 2024

Fixes: #590

Kishens-MacBook-Pro➜  bin : pretty-dhcp ✘:  ./pvsadm dhcpserver list --instance-id 549cae6a-d568-4c56-9977-1acc084bd4fa
I0416 18:53:46.368742   85059 root.go:50] Using an API key from IBMCLOUD_API_KEY environment variable
+--------------------------------------+--------------------------------------+----------------------------------------------------+--------+
|                  ID                  |              NETWORK ID              |                    NETWORK NAME                    | STATUS |
+--------------------------------------+--------------------------------------+----------------------------------------------------+--------+
| b8b0ae74-9b06-44fa-8ab7-d723db9bdb25 | 12ba2f3e-135e-4659-ac40-644126f2ddcc | DHCPSERVERbdaab417b86d4c0f927bf130c2a6e114_Private | ACTIVE |
+--------------------------------------+--------------------------------------+----------------------------------------------------+--------+


The get command does not contain the Network ID field, as the same is available from `list` command

Kishens-MacBook-Pro➜  bin : pretty-dhcp ✘ : ./pvsadm dhcpserver get --instance-id 549cae6a-d568-4c56-9977-1acc084bd4fa --id b8b0ae74-9b06-44fa-8ab7-d723db9bdb25
I0416 18:53:57.506791   85095 root.go:50] Using an API key from IBMCLOUD_API_KEY environment variable
+--------------------------------------+--------------------------------+----------------------------------------------------+--------+
|                  ID                  |            IP - MAC            |                    NETWORK NAME                    | STATUS |
+--------------------------------------+--------------------------------+----------------------------------------------------+--------+
| b8b0ae74-9b06-44fa-8ab7-d723db9bdb25 | 192.168.0.10 -                 | DHCPSERVERbdaab417b86d4c0f927bf130c2a6e114_Private | ACTIVE |
|                                      | fa:16:3e:87:b1:64              |                                                    |        |
+--------------------------------------+--------------------------------+----------------------------------------------------+--------+


Kishens-MacBook-Pro➜  bin : pretty-dhcp ✘   ./pvsadm dhcpserver list --instance-id 9a344d8e-49c6-4307-9303-471c8bd1844a
I0416 19:17:25.934982   85957 root.go:50] Using an API key from IBMCLOUD_API_KEY environment variable
I0416 19:17:30.385736   85957 list.go:60] There are no DHCP servers associated with the instance id provided.

@ppc64le-cloud-bot ppc64le-cloud-bot added the size/S Denotes a PR that changes 10-29 lines, ignoring generated files. label Apr 16, 2024
@kishen-v
Copy link
Contributor Author

/cc @Karthik-K-N

Copy link
Member

@mkumatag mkumatag left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

also post the sample output in the PR

@ppc64le-cloud-bot ppc64le-cloud-bot added size/M Denotes a PR that changes 30-99 lines, ignoring generated files. and removed size/S Denotes a PR that changes 10-29 lines, ignoring generated files. labels Apr 17, 2024
Copy link
Contributor

@Karthik-K-N Karthik-K-N left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One small change, otherwise LGTM

Copy link
Contributor

@Karthik-K-N Karthik-K-N left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/lgtm

}
var IPandMAC string
for _, lease := range server.Leases {
IPandMAC += fmt.Sprintf("%s - %s ", *lease.InstanceIP, *lease.InstanceMacAddress)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

space is the delim here for the entries, wondering if there is an option of using newline and see how it looks?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The closest i could bring by having a new line, introducing a space around - seems to push content the MAC address to the next line. Hope this is ok!

Kishens-MacBook-Pro  bin : pretty-dhcp  : ./pvsadm dhcpserver get --instance-id eeabbe9d-2dcd-4e04-aed3-eb35739cf0d2 --id 73bbe812-f758-4707-8170-2427f79eab0e
I0423 12:16:05.275645   78108 root.go:50] Using an API key from IBMCLOUD_API_KEY environment variable
+----------------------------------------------------+--------------------------------+--------+
|                    NETWORK NAME                    |            IP - MAC            | STATUS |
+----------------------------------------------------+--------------------------------+--------+
| DHCPSERVER6e9d7e95424d42ed8b7ff68305b03543_Private | 192.168.0.10-fa:16:3e:2f:66:e4 | ACTIVE |
|                                                    | 192.168.0.11-fa:16:3e:16:6f:02 |        |
|                                                    |                                |        |
+----------------------------------------------------+--------------------------------+--------+

Copy link
Member

@mkumatag mkumatag left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/lgtm

@ppc64le-cloud-bot ppc64le-cloud-bot added the lgtm Indicates that a PR is ready to be merged. label Apr 23, 2024
@ppc64le-cloud-bot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: kishen-v, mkumatag

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@ppc64le-cloud-bot ppc64le-cloud-bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Apr 23, 2024
@ppc64le-cloud-bot ppc64le-cloud-bot merged commit 6b853a2 into ppc64le-cloud:main Apr 23, 2024
4 of 5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. lgtm Indicates that a PR is ready to be merged. size/M Denotes a PR that changes 30-99 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Beutify the output of dhcpserver command
4 participants