Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
## Description Following are the change in this commit 1. `tink hardware mac <mac address>` will provide only relevent information instead of complete hardware json 2. `tink hardware ip <ip address>` will provide only relevent information instead of complete hardware json 3. There will be a flag in both of the above clis (--details) or (-d) which can be provided to get the complete hardware data 4. `tink hardware all` cli has been renamed to `tink hardware list` 5. The above cli will only list the relevent information (which is 'hardware-id', 'mac address', 'ip address' and 'hostname for now) instead of providing the complete json of all the hardware present in the database. ## Why is this needed Fixes: #150 ## How Has This Been Tested? I have tested this locally by pushing the hardware data for two different hardware using `tink hardware push` command and then try to run the clis mentioned in the above description. Following are the output of the commands. 1. tink hardware list ``` +--------------------------------------+-------------------+-------------+-----------+ | ID | MAC ADDRESS | IP ADDRESS | HOSTNAME | +--------------------------------------+-------------------+-------------+-----------+ | f9f56dff-098a-4c5f-a51c-19ad35de85d2 | 98:03:9b:89:d7:da | 192.168.1.4 | localhost | | f9f56dff-098a-4c5f-a51c-19ad35de85d1 | 98:03:9b:89:d7:ba | 192.168.1.5 | worker_1 | +--------------------------------------+-------------------+-------------+-----------+ ``` With the help of above command you will get the list of hardware present in the database. Now you can run following commands: 2. a. tink hardware mac 98:03:9b:89:d7:da ``` +-------------+--------------------------------------+ | FIELD NAME | VALUE | +-------------+--------------------------------------+ | ID | f9f56dff-098a-4c5f-a51c-19ad35de85d2 | | MAC Address | 98:03:9b:89:d7:da | | IP Address | 192.168.1.4 | | Hostname | localhost | +-------------+--------------------------------------+ ``` b. tink hardware mac 98:03:9b:89:d7:da -d ( provide -d flag ) `{"metadata":{"instance":{},"facility":{"facility_code":"onprem"}},"network":{"interfaces":[{"dhcp":{"mac":"98:03:9b:89:d7:da","hostname":"localhost","arch":"x86_64","ip":{"address":"192.168.1.4","netmask":"255.255.255.248","gateway":"192.168.1.1"}},"netboot":{"allow_pxe":true,"allow_workflow":true}}]},"id":"f9f56dff-098a-4c5f-a51c-19ad35de85d2"}` 3. Same thing will be applicable for `tink hardware ip` command: a. tink hardware ip 192.168.1.4 ``` +-------------+--------------------------------------+ | FIELD NAME | VALUE | +-------------+--------------------------------------+ | ID | f9f56dff-098a-4c5f-a51c-19ad35de85d2 | | MAC Address | 98:03:9b:89:d7:da | | IP Address | 192.168.1.4 | | Hostname | localhost | +-------------+--------------------------------------+ ``` b. tink hardware ip 192.168.1.4 -d ( provide -d flag ) `{"metadata":{"instance":{},"facility":{"facility_code":"onprem"}},"network":{"interfaces":[{"dhcp":{"mac":"98:03:9b:89:d7:da","hostname":"localhost","arch":"x86_64","ip":{"address":"192.168.1.4","netmask":"255.255.255.248","gateway":"192.168.1.1"}},"netboot":{"allow_pxe":true,"allow_workflow":true}}]},"id":"f9f56dff-098a-4c5f-a51c-19ad35de85d2"} ` 4. And at last the output of tink hardware --help is look like as follows: ``` tink hardware client Usage: tink hardware [command] Examples: tink hardware [command] Available Commands: delete delete hardware by id id get hardware by id ip get hardware by any associated ip list list all known hardware mac get hardware by any associated mac push push new hardware to tink watch register to watch an id for any changes Flags: -h, --help help for hardware Global Flags: -f, --facility string used to build grpc and http urls Use "tink hardware [command] --help" for more information about a command. ``` ## How are existing users impacted? What migration steps/scripts do we need? There will be a change for existing user for `tink hardware` as mentioned in the description. There is no need of migration steps or scripts.
- Loading branch information