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

Updated metal-go client for sub-command devices #282

Merged
merged 2 commits into from
Aug 29, 2023

Conversation

codinja1188
Copy link
Contributor

@codinja1188 codinja1188 commented Jun 14, 2023

Breakout from #270

What this PR does / why we need it:

This PR replaces packngo with metal-go for all interactions with the Equinix Metal API specifically for Device sub commands

Test Results:

Retrieve

Cmd: metal devices get

  • Packngo:
vasu@vasu-cloud:~/Equinix$ metal devices get
+--------------------------------------+-------------------------------------+------------------+--------+----------------------+
|                  ID                  |              HOSTNAME               |        OS        | STATE  |       CREATED        |
+--------------------------------------+-------------------------------------+------------------+--------+----------------------+
| d231a5d0-3da9-4e4b-bbd6-a367c4c2d34b | test-staging-2                      | Ubuntu 20.04 LTS | active | 2023-06-01T08:42:42Z |
| bcab4df0-945e-4cb5-a8c7-f9dfbaabb3d7 | eksa-node-003                       | Custom iPXE      | active | 2023-04-25T12:33:17Z |
| 09be98b7-0db6-4fdb-90be-901ab847158d | test-packngo                        | Ubuntu 20.04 LTS | active | 2023-06-26T13:09:24Z |
| b396c4fd-c412-4a25-b6b4-df6f2f548629 | test-staging-12                     | Ubuntu 22.04 LTS | active | 2023-06-01T08:43:12Z |
| bad6f156-4777-49a5-87e7-d038e7365c9e | capi-quickstart-control-plane-mkz7l | Ubuntu 22.04 LTS | active | 2023-05-03T09:42:52Z |
| d7126b67-a96f-48b7-9cf1-e1914d84235b | capi-quickstart-worker-a-spr64      | Ubuntu 22.04 LTS | active | 2023-05-03T09:48:01Z |
| 4c397b2d-eccf-4948-9fcf-2b325303048c | capi-quickstart-control-plane-98xjq | Ubuntu 22.04 LTS | active | 2023-05-03T09:48:05Z |
| bdbe09fa-d140-4cc9-b988-f51610e8c2f3 | capi-quickstart-worker-a-q89f8      | Ubuntu 22.04 LTS | active | 2023-05-03T09:47:59Z |
| 67992861-066b-4d76-a6a4-a21b3e855722 | capi-quickstart-worker-a-qqnhb      | Ubuntu 22.04 LTS | active | 2023-05-03T09:48:00Z |
| b15870cd-a83d-48bd-9552-5281162ae563 | capi-quickstart-control-plane-lxnsr | Ubuntu 22.04 LTS | active | 2023-05-03T09:54:11Z |
| 2f6d7ff2-6aa5-49bc-838a-97a3473ea16a | eksa-node-002                       | Custom iPXE      | active | 2023-04-24T18:24:15Z |
| 46005014-5256-41b3-938a-1b295f931aa2 | eksa-node-001                       | Custom iPXE      | active | 2023-04-24T18:24:12Z |
| c3b1006c-0422-4f01-9c96-24dbcd72f7f1 | eksa-admin                          | Ubuntu 20.04 LTS | active | 2023-04-24T18:22:35Z |
+--------------------------------------+-------------------------------------+------------------+--------+----------------------+
  • Metal-Go
vasu@vasu-cloud:~/Equinix$ metal devices get
+--------------------------------------+-------------------------------------+------------------+--------+----------------------+
|                  ID                  |              HOSTNAME               |        OS        | STATE  |       CREATED        |
+--------------------------------------+-------------------------------------+------------------+--------+----------------------+
| d231a5d0-3da9-4e4b-bbd6-a367c4c2d34b | test-staging-2                      | Ubuntu 20.04 LTS | active | 2023-06-01T08:42:42Z |
| bcab4df0-945e-4cb5-a8c7-f9dfbaabb3d7 | eksa-node-003                       | Custom iPXE      | active | 2023-04-25T12:33:17Z |
| 09be98b7-0db6-4fdb-90be-901ab847158d | test-packngo                        | Ubuntu 20.04 LTS | active | 2023-06-26T13:09:24Z |
| b396c4fd-c412-4a25-b6b4-df6f2f548629 | test-staging-12                     | Ubuntu 22.04 LTS | active | 2023-06-01T08:43:12Z |
| bad6f156-4777-49a5-87e7-d038e7365c9e | capi-quickstart-control-plane-mkz7l | Ubuntu 22.04 LTS | active | 2023-05-03T09:42:52Z |
| d7126b67-a96f-48b7-9cf1-e1914d84235b | capi-quickstart-worker-a-spr64      | Ubuntu 22.04 LTS | active | 2023-05-03T09:48:01Z |
| 4c397b2d-eccf-4948-9fcf-2b325303048c | capi-quickstart-control-plane-98xjq | Ubuntu 22.04 LTS | active | 2023-05-03T09:48:05Z |
| bdbe09fa-d140-4cc9-b988-f51610e8c2f3 | capi-quickstart-worker-a-q89f8      | Ubuntu 22.04 LTS | active | 2023-05-03T09:47:59Z |
| 67992861-066b-4d76-a6a4-a21b3e855722 | capi-quickstart-worker-a-qqnhb      | Ubuntu 22.04 LTS | active | 2023-05-03T09:48:00Z |
| b15870cd-a83d-48bd-9552-5281162ae563 | capi-quickstart-control-plane-lxnsr | Ubuntu 22.04 LTS | active | 2023-05-03T09:54:11Z |
| 2f6d7ff2-6aa5-49bc-838a-97a3473ea16a | eksa-node-002                       | Custom iPXE      | active | 2023-04-24T18:24:15Z |
| 46005014-5256-41b3-938a-1b295f931aa2 | eksa-node-001                       | Custom iPXE      | active | 2023-04-24T18:24:12Z |
| c3b1006c-0422-4f01-9c96-24dbcd72f7f1 | eksa-admin                          | Ubuntu 20.04 LTS | active | 2023-04-24T18:22:35Z |
+--------------------------------------+-------------------------------------+------------------+--------+----------------------+

Cmd: metal devices get -p <Project_ID>

  • Packngo:
vasu@vasu-cloud:~/Equinix$ metal devices get -p 65dcd8f4-abd4-4e7a-8b29-da4b030edd96
+--------------------------------------+-------------------------------------+------------------+--------+----------------------+
|                  ID                  |              HOSTNAME               |        OS        | STATE  |       CREATED        |
+--------------------------------------+-------------------------------------+------------------+--------+----------------------+
| d231a5d0-3da9-4e4b-bbd6-a367c4c2d34b | test-staging-2                      | Ubuntu 20.04 LTS | active | 2023-06-01T08:42:42Z |
| bcab4df0-945e-4cb5-a8c7-f9dfbaabb3d7 | eksa-node-003                       | Custom iPXE      | active | 2023-04-25T12:33:17Z |
| 09be98b7-0db6-4fdb-90be-901ab847158d | test-packngo                        | Ubuntu 20.04 LTS | active | 2023-06-26T13:09:24Z |
| b396c4fd-c412-4a25-b6b4-df6f2f548629 | test-staging-12                     | Ubuntu 22.04 LTS | active | 2023-06-01T08:43:12Z |
| bad6f156-4777-49a5-87e7-d038e7365c9e | capi-quickstart-control-plane-mkz7l | Ubuntu 22.04 LTS | active | 2023-05-03T09:42:52Z |
| d7126b67-a96f-48b7-9cf1-e1914d84235b | capi-quickstart-worker-a-spr64      | Ubuntu 22.04 LTS | active | 2023-05-03T09:48:01Z |
| 4c397b2d-eccf-4948-9fcf-2b325303048c | capi-quickstart-control-plane-98xjq | Ubuntu 22.04 LTS | active | 2023-05-03T09:48:05Z |
| bdbe09fa-d140-4cc9-b988-f51610e8c2f3 | capi-quickstart-worker-a-q89f8      | Ubuntu 22.04 LTS | active | 2023-05-03T09:47:59Z |
| 67992861-066b-4d76-a6a4-a21b3e855722 | capi-quickstart-worker-a-qqnhb      | Ubuntu 22.04 LTS | active | 2023-05-03T09:48:00Z |
| b15870cd-a83d-48bd-9552-5281162ae563 | capi-quickstart-control-plane-lxnsr | Ubuntu 22.04 LTS | active | 2023-05-03T09:54:11Z |
| 2f6d7ff2-6aa5-49bc-838a-97a3473ea16a | eksa-node-002                       | Custom iPXE      | active | 2023-04-24T18:24:15Z |
| 46005014-5256-41b3-938a-1b295f931aa2 | eksa-node-001                       | Custom iPXE      | active | 2023-04-24T18:24:12Z |
| c3b1006c-0422-4f01-9c96-24dbcd72f7f1 | eksa-admin                          | Ubuntu 20.04 LTS | active | 2023-04-24T18:22:35Z |
+--------------------------------------+-------------------------------------+------------------+--------+----------------------+
  • Metal-Go
vasu@vasu-cloud:~/Equinix/metal-cli/bin$ ./metal devices get -p 65dcd8f4-abd4-4e7a-8b29-da4b030edd96
+--------------------------------------+-------------------------------------+------------------+--------+-------------------------------+
|                  ID                  |              HOSTNAME               |        OS        | STATE  |            CREATED            |
+--------------------------------------+-------------------------------------+------------------+--------+-------------------------------+
| d231a5d0-3da9-4e4b-bbd6-a367c4c2d34b | test-staging-2                      | Ubuntu 20.04 LTS | active | 2023-06-01 08:42:42 +0000 UTC |
| bcab4df0-945e-4cb5-a8c7-f9dfbaabb3d7 | eksa-node-003                       | Custom iPXE      | active | 2023-04-25 12:33:17 +0000 UTC |
| 09be98b7-0db6-4fdb-90be-901ab847158d | test-packngo                        | Ubuntu 20.04 LTS | active | 2023-06-26 13:09:24 +0000 UTC |
| b396c4fd-c412-4a25-b6b4-df6f2f548629 | test-staging-12                     | Ubuntu 22.04 LTS | active | 2023-06-01 08:43:12 +0000 UTC |
| bad6f156-4777-49a5-87e7-d038e7365c9e | capi-quickstart-control-plane-mkz7l | Ubuntu 22.04 LTS | active | 2023-05-03 09:42:52 +0000 UTC |
| d7126b67-a96f-48b7-9cf1-e1914d84235b | capi-quickstart-worker-a-spr64      | Ubuntu 22.04 LTS | active | 2023-05-03 09:48:01 +0000 UTC |
| 4c397b2d-eccf-4948-9fcf-2b325303048c | capi-quickstart-control-plane-98xjq | Ubuntu 22.04 LTS | active | 2023-05-03 09:48:05 +0000 UTC |
| bdbe09fa-d140-4cc9-b988-f51610e8c2f3 | capi-quickstart-worker-a-q89f8      | Ubuntu 22.04 LTS | active | 2023-05-03 09:47:59 +0000 UTC |
| 67992861-066b-4d76-a6a4-a21b3e855722 | capi-quickstart-worker-a-qqnhb      | Ubuntu 22.04 LTS | active | 2023-05-03 09:48:00 +0000 UTC |
| b15870cd-a83d-48bd-9552-5281162ae563 | capi-quickstart-control-plane-lxnsr | Ubuntu 22.04 LTS | active | 2023-05-03 09:54:11 +0000 UTC |
| 2f6d7ff2-6aa5-49bc-838a-97a3473ea16a | eksa-node-002                       | Custom iPXE      | active | 2023-04-24 18:24:15 +0000 UTC |
| 46005014-5256-41b3-938a-1b295f931aa2 | eksa-node-001                       | Custom iPXE      | active | 2023-04-24 18:24:12 +0000 UTC |
| c3b1006c-0422-4f01-9c96-24dbcd72f7f1 | eksa-admin                          | Ubuntu 20.04 LTS | active | 2023-04-24 18:22:35 +0000 UTC |
+--------------------------------------+-------------------------------------+------------------+--------+-------------------------------+

Cmd: metal devices get -i

  • Packngo:
vasu@vasu-cloud:~/Equinix$ metal devices get -i 09be98b7-0db6-4fdb-90be-901ab847158d
+--------------------------------------+--------------+------------------+--------+----------------------+
|                  ID                  |   HOSTNAME   |        OS        | STATE  |       CREATED        |
+--------------------------------------+--------------+------------------+--------+----------------------+
| 09be98b7-0db6-4fdb-90be-901ab847158d | test-packngo | Ubuntu 20.04 LTS | active | 2023-06-26T13:09:24Z |
+--------------------------------------+--------------+------------------+--------+----------------------+

*Metal-go:

vasu@vasu-cloud:~/Equinix/metal-cli/bin$ ./metal devices get -i 09be98b7-0db6-4fdb-90be-901ab847158d
+--------------------------------------+--------------+------------------+--------+-------------------------------+
|                  ID                  |   HOSTNAME   |        OS        | STATE  |            CREATED            |
+--------------------------------------+--------------+------------------+--------+-------------------------------+
| 09be98b7-0db6-4fdb-90be-901ab847158d | test-packngo | Ubuntu 20.04 LTS | active | 2023-06-26 13:09:24 +0000 UTC |
+--------------------------------------+--------------+------------------+--------+-------------------------------+

Create

Vasubabus-MacBook-Pro:bin vasubabu$ ./metal device create -p c309ce2c-160d-47e2-bb26-9debeb0be87d -P m3.small.x86 -m da -O ubuntu_20_04 -H create-device-dev-cdata --customdata '{"testDate":"fromCli"}'
+--------------------------------------+-------------------------+------------------+--------+-------------------------------+
|                  ID                  |        HOSTNAME         |        OS        | STATE  |            CREATED            |
+--------------------------------------+-------------------------+------------------+--------+-------------------------------+
| 8dc6920e-cf5a-4852-994d-a53094fe9673 | create-device-dev-cdata | Ubuntu 20.04 LTS | queued | 2023-08-24 10:28:29 +0000 UTC |
+--------------------------------------+-------------------------+------------------+--------+-------------------------------+
Vasubabus-MacBook-Pro:bin vasubabu$ ./metal device create -p c309ce2c-160d-47e2-bb26-9debeb0be87d -P m3.small.x86 -m da -O ubuntu_20_04 -H create-dev-cdata --customdata '{"testDate":""}'
+--------------------------------------+------------------+------------------+--------+-------------------------------+
|                  ID                  |     HOSTNAME     |        OS        | STATE  |            CREATED            |
+--------------------------------------+------------------+------------------+--------+-------------------------------+
| a45f8746-f3b5-4fc5-8fe6-b4fa6493d365 | create-dev-cdata | Ubuntu 20.04 LTS | queued | 2023-08-24 10:40:50 +0000 UTC |
+--------------------------------------+------------------+------------------+--------+-------------------------------+
Vasubabus-MacBook-Pro:bin vasubabu$ ./metal device create -p c309ce2c-160d-47e2-bb26-9debeb0be87d --hostname netboot-custom-ipxe-1 --plan c3.small.x86 --metro sv --operating-system custom_ipxe --userdata='#!ipxe
chain -ar https://boot.netboot.xyz' --always-pxe=true
+--------------------------------------+-----------------------+-------------+--------+-------------------------------+
|                  ID                  |       HOSTNAME        |     OS      | STATE  |            CREATED            |
+--------------------------------------+-----------------------+-------------+--------+-------------------------------+
| b149fc32-bcfd-44c8-9c0e-9e5d49d382e0 | netboot-custom-ipxe-1 | Custom iPXE | queued | 2023-08-24 10:48:33 +0000 UTC |
+--------------------------------------+-----------------------+-------------+--------+-------------------------------+

<img width="1430" alt="image" src="https://github.com/equinix/metal-cli/assets/3358152/ea4d5a5a-b495-40e7-a7ec-e3a6905ac5c7">

Vasubabus-MacBook-Pro:bin vasubabu$ ./metal device create -p c309ce2c-160d-47e2-bb26-9debeb0be87d --hostname netboot-custom-ipxe --plan c3.small.x86 --metro sv --operating-system custom_ipxe --userdata='#!ipxe
> chain -ar https://boot.netboot.xyz'
+--------------------------------------+---------------------+-------------+--------+-------------------------------+
|                  ID                  |      HOSTNAME       |     OS      | STATE  |            CREATED            |
+--------------------------------------+---------------------+-------------+--------+-------------------------------+
| 4aa8977b-259b-4684-a3b4-9ff49e96db47 | netboot-custom-ipxe | Custom iPXE | queued | 2023-08-24 10:44:02 +0000 UTC |
+--------------------------------------+---------------------+-------------+--------+-------------------------------+

<img width="1416" alt="image" src="https://github.com/equinix/metal-cli/assets/3358152/a9ff3f36-4716-4cbd-a9be-cc2dc8e672b7">

@codinja1188 codinja1188 force-pushed the devices branch 2 times, most recently from 3d237d1 to 6ad1f80 Compare June 14, 2023 12:28
Copy link
Contributor

@ctreatma ctreatma left a comment

Choose a reason for hiding this comment

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

It's going to take some time to test these changes, but in the meantime I had a couple minor comments

docs/metal_device_create.md Outdated Show resolved Hide resolved
internal/devices/update.go Outdated Show resolved Hide resolved
internal/devices/update.go Outdated Show resolved Hide resolved
@codinja1188 codinja1188 force-pushed the devices branch 4 times, most recently from 05c6baf to dad5716 Compare June 21, 2023 14:08
test/e2e/device_test.go Outdated Show resolved Hide resolved
test/e2e/device_test.go Outdated Show resolved Hide resolved
}

if alwaysPXE {
req.AlwaysPXE = &alwaysPXE
deviceUpdate.AlwaysPxe = &alwaysPXE
Copy link
Member

Choose a reason for hiding this comment

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

Let's address #257 while we are here.

Copy link
Contributor

Choose a reason for hiding this comment

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

@Vasubabu attempted to address this, but it's not as simple as removing the if alwaysPXE check, because sending a value for alwaysPxe causes a 422 error for some OSes. I think we would have to change how the command-line parameter is defined so that we have 3 states:

  • unset
  • false
  • true

I see that cobra has a Changed method on flags, but I'm not sure if we can get to it in the current implementation of this command. Assuming all of the above is accurate, I think we should address #257 in a separate PR.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

plan to address in a seperate PR. closing the thread.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It's addressed in latest commit

docs/metal_device_update.md Outdated Show resolved Hide resolved
}
device, _, Err := c.Service.FindDeviceById(context.Background(), id).Execute()
if Err != nil {
fmt.Printf("Error when calling `DevicesApiService.FindDeviceByID``: %v\n", Err)
Copy link
Contributor

Choose a reason for hiding this comment

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

We shouldn't need to load the device here; the API will default to the existing operating system if one is not specified in the action.

Copy link
Contributor

Choose a reason for hiding this comment

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

^^ just boosting this comment from earlier in case it was missed.

test/e2e/devices/devicecreatetest/device_create_test.go Outdated Show resolved Hide resolved
t.Error(err)
}
} else {
t.Error(err)
Copy link
Contributor

Choose a reason for hiding this comment

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

Latest test run failed here with:
device_get_test.go:77: <nil>

It looks like we need a couple things:

  • CreateTestDevice should return a non-nil error if the device is still not active after the retry loop is done
  • We probably need a longer wait time for the device to become active.

// Sleep for the specified interval
time.Sleep(retryInterval)
}
return false, err
Copy link
Contributor

Choose a reason for hiding this comment

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

This is returning a nil error. It should return something that indicates that the time ran out.

Copy link
Contributor

@ctreatma ctreatma left a comment

Choose a reason for hiding this comment

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

There are a few unaddressed comments but nothing that impacts functionality, and I think it'll be easier to address those in smaller PRs as needed. Confirmed locally that the reinstall test passes with the longer timeout; we won't be able to confirm in CI until after the workflow file change is merged.

@ctreatma ctreatma merged commit 3d6c824 into equinix:main Aug 29, 2023
6 of 7 checks passed
ocobles pushed a commit that referenced this pull request Nov 10, 2023
The end-to-end tests for #282 are failing because the tests were moved
to nested directories.  This updates the e2e test workflow to not care
about how the tests are laid out within the test/e2e directory so that
we can move things around freely.
ocobles pushed a commit that referenced this pull request Nov 10, 2023
Breakout from #270

What this PR does / why we need it:

This PR replaces packngo with metal-go for all interactions with the
Equinix Metal API specifically for Device sub commands

Test Results:
================
# Retrieve
## Cmd: metal devices get

* Packngo:
```
vasu@vasu-cloud:~/Equinix$ metal devices get
+--------------------------------------+-------------------------------------+------------------+--------+----------------------+
|                  ID                  |              HOSTNAME               |        OS        | STATE  |       CREATED        |
+--------------------------------------+-------------------------------------+------------------+--------+----------------------+
| d231a5d0-3da9-4e4b-bbd6-a367c4c2d34b | test-staging-2                      | Ubuntu 20.04 LTS | active | 2023-06-01T08:42:42Z |
| bcab4df0-945e-4cb5-a8c7-f9dfbaabb3d7 | eksa-node-003                       | Custom iPXE      | active | 2023-04-25T12:33:17Z |
| 09be98b7-0db6-4fdb-90be-901ab847158d | test-packngo                        | Ubuntu 20.04 LTS | active | 2023-06-26T13:09:24Z |
| b396c4fd-c412-4a25-b6b4-df6f2f548629 | test-staging-12                     | Ubuntu 22.04 LTS | active | 2023-06-01T08:43:12Z |
| bad6f156-4777-49a5-87e7-d038e7365c9e | capi-quickstart-control-plane-mkz7l | Ubuntu 22.04 LTS | active | 2023-05-03T09:42:52Z |
| d7126b67-a96f-48b7-9cf1-e1914d84235b | capi-quickstart-worker-a-spr64      | Ubuntu 22.04 LTS | active | 2023-05-03T09:48:01Z |
| 4c397b2d-eccf-4948-9fcf-2b325303048c | capi-quickstart-control-plane-98xjq | Ubuntu 22.04 LTS | active | 2023-05-03T09:48:05Z |
| bdbe09fa-d140-4cc9-b988-f51610e8c2f3 | capi-quickstart-worker-a-q89f8      | Ubuntu 22.04 LTS | active | 2023-05-03T09:47:59Z |
| 67992861-066b-4d76-a6a4-a21b3e855722 | capi-quickstart-worker-a-qqnhb      | Ubuntu 22.04 LTS | active | 2023-05-03T09:48:00Z |
| b15870cd-a83d-48bd-9552-5281162ae563 | capi-quickstart-control-plane-lxnsr | Ubuntu 22.04 LTS | active | 2023-05-03T09:54:11Z |
| 2f6d7ff2-6aa5-49bc-838a-97a3473ea16a | eksa-node-002                       | Custom iPXE      | active | 2023-04-24T18:24:15Z |
| 46005014-5256-41b3-938a-1b295f931aa2 | eksa-node-001                       | Custom iPXE      | active | 2023-04-24T18:24:12Z |
| c3b1006c-0422-4f01-9c96-24dbcd72f7f1 | eksa-admin                          | Ubuntu 20.04 LTS | active | 2023-04-24T18:22:35Z |
+--------------------------------------+-------------------------------------+------------------+--------+----------------------+
```
* Metal-Go
```
vasu@vasu-cloud:~/Equinix$ metal devices get
+--------------------------------------+-------------------------------------+------------------+--------+----------------------+
|                  ID                  |              HOSTNAME               |        OS        | STATE  |       CREATED        |
+--------------------------------------+-------------------------------------+------------------+--------+----------------------+
| d231a5d0-3da9-4e4b-bbd6-a367c4c2d34b | test-staging-2                      | Ubuntu 20.04 LTS | active | 2023-06-01T08:42:42Z |
| bcab4df0-945e-4cb5-a8c7-f9dfbaabb3d7 | eksa-node-003                       | Custom iPXE      | active | 2023-04-25T12:33:17Z |
| 09be98b7-0db6-4fdb-90be-901ab847158d | test-packngo                        | Ubuntu 20.04 LTS | active | 2023-06-26T13:09:24Z |
| b396c4fd-c412-4a25-b6b4-df6f2f548629 | test-staging-12                     | Ubuntu 22.04 LTS | active | 2023-06-01T08:43:12Z |
| bad6f156-4777-49a5-87e7-d038e7365c9e | capi-quickstart-control-plane-mkz7l | Ubuntu 22.04 LTS | active | 2023-05-03T09:42:52Z |
| d7126b67-a96f-48b7-9cf1-e1914d84235b | capi-quickstart-worker-a-spr64      | Ubuntu 22.04 LTS | active | 2023-05-03T09:48:01Z |
| 4c397b2d-eccf-4948-9fcf-2b325303048c | capi-quickstart-control-plane-98xjq | Ubuntu 22.04 LTS | active | 2023-05-03T09:48:05Z |
| bdbe09fa-d140-4cc9-b988-f51610e8c2f3 | capi-quickstart-worker-a-q89f8      | Ubuntu 22.04 LTS | active | 2023-05-03T09:47:59Z |
| 67992861-066b-4d76-a6a4-a21b3e855722 | capi-quickstart-worker-a-qqnhb      | Ubuntu 22.04 LTS | active | 2023-05-03T09:48:00Z |
| b15870cd-a83d-48bd-9552-5281162ae563 | capi-quickstart-control-plane-lxnsr | Ubuntu 22.04 LTS | active | 2023-05-03T09:54:11Z |
| 2f6d7ff2-6aa5-49bc-838a-97a3473ea16a | eksa-node-002                       | Custom iPXE      | active | 2023-04-24T18:24:15Z |
| 46005014-5256-41b3-938a-1b295f931aa2 | eksa-node-001                       | Custom iPXE      | active | 2023-04-24T18:24:12Z |
| c3b1006c-0422-4f01-9c96-24dbcd72f7f1 | eksa-admin                          | Ubuntu 20.04 LTS | active | 2023-04-24T18:22:35Z |
+--------------------------------------+-------------------------------------+------------------+--------+----------------------+

```

## Cmd: metal devices get -p <Project_ID>
* Packngo:
```
vasu@vasu-cloud:~/Equinix$ metal devices get -p 65dcd8f4-abd4-4e7a-8b29-da4b030edd96
+--------------------------------------+-------------------------------------+------------------+--------+----------------------+
|                  ID                  |              HOSTNAME               |        OS        | STATE  |       CREATED        |
+--------------------------------------+-------------------------------------+------------------+--------+----------------------+
| d231a5d0-3da9-4e4b-bbd6-a367c4c2d34b | test-staging-2                      | Ubuntu 20.04 LTS | active | 2023-06-01T08:42:42Z |
| bcab4df0-945e-4cb5-a8c7-f9dfbaabb3d7 | eksa-node-003                       | Custom iPXE      | active | 2023-04-25T12:33:17Z |
| 09be98b7-0db6-4fdb-90be-901ab847158d | test-packngo                        | Ubuntu 20.04 LTS | active | 2023-06-26T13:09:24Z |
| b396c4fd-c412-4a25-b6b4-df6f2f548629 | test-staging-12                     | Ubuntu 22.04 LTS | active | 2023-06-01T08:43:12Z |
| bad6f156-4777-49a5-87e7-d038e7365c9e | capi-quickstart-control-plane-mkz7l | Ubuntu 22.04 LTS | active | 2023-05-03T09:42:52Z |
| d7126b67-a96f-48b7-9cf1-e1914d84235b | capi-quickstart-worker-a-spr64      | Ubuntu 22.04 LTS | active | 2023-05-03T09:48:01Z |
| 4c397b2d-eccf-4948-9fcf-2b325303048c | capi-quickstart-control-plane-98xjq | Ubuntu 22.04 LTS | active | 2023-05-03T09:48:05Z |
| bdbe09fa-d140-4cc9-b988-f51610e8c2f3 | capi-quickstart-worker-a-q89f8      | Ubuntu 22.04 LTS | active | 2023-05-03T09:47:59Z |
| 67992861-066b-4d76-a6a4-a21b3e855722 | capi-quickstart-worker-a-qqnhb      | Ubuntu 22.04 LTS | active | 2023-05-03T09:48:00Z |
| b15870cd-a83d-48bd-9552-5281162ae563 | capi-quickstart-control-plane-lxnsr | Ubuntu 22.04 LTS | active | 2023-05-03T09:54:11Z |
| 2f6d7ff2-6aa5-49bc-838a-97a3473ea16a | eksa-node-002                       | Custom iPXE      | active | 2023-04-24T18:24:15Z |
| 46005014-5256-41b3-938a-1b295f931aa2 | eksa-node-001                       | Custom iPXE      | active | 2023-04-24T18:24:12Z |
| c3b1006c-0422-4f01-9c96-24dbcd72f7f1 | eksa-admin                          | Ubuntu 20.04 LTS | active | 2023-04-24T18:22:35Z |
+--------------------------------------+-------------------------------------+------------------+--------+----------------------+
```
* Metal-Go
```
vasu@vasu-cloud:~/Equinix/metal-cli/bin$ ./metal devices get -p 65dcd8f4-abd4-4e7a-8b29-da4b030edd96
+--------------------------------------+-------------------------------------+------------------+--------+-------------------------------+
|                  ID                  |              HOSTNAME               |        OS        | STATE  |            CREATED            |
+--------------------------------------+-------------------------------------+------------------+--------+-------------------------------+
| d231a5d0-3da9-4e4b-bbd6-a367c4c2d34b | test-staging-2                      | Ubuntu 20.04 LTS | active | 2023-06-01 08:42:42 +0000 UTC |
| bcab4df0-945e-4cb5-a8c7-f9dfbaabb3d7 | eksa-node-003                       | Custom iPXE      | active | 2023-04-25 12:33:17 +0000 UTC |
| 09be98b7-0db6-4fdb-90be-901ab847158d | test-packngo                        | Ubuntu 20.04 LTS | active | 2023-06-26 13:09:24 +0000 UTC |
| b396c4fd-c412-4a25-b6b4-df6f2f548629 | test-staging-12                     | Ubuntu 22.04 LTS | active | 2023-06-01 08:43:12 +0000 UTC |
| bad6f156-4777-49a5-87e7-d038e7365c9e | capi-quickstart-control-plane-mkz7l | Ubuntu 22.04 LTS | active | 2023-05-03 09:42:52 +0000 UTC |
| d7126b67-a96f-48b7-9cf1-e1914d84235b | capi-quickstart-worker-a-spr64      | Ubuntu 22.04 LTS | active | 2023-05-03 09:48:01 +0000 UTC |
| 4c397b2d-eccf-4948-9fcf-2b325303048c | capi-quickstart-control-plane-98xjq | Ubuntu 22.04 LTS | active | 2023-05-03 09:48:05 +0000 UTC |
| bdbe09fa-d140-4cc9-b988-f51610e8c2f3 | capi-quickstart-worker-a-q89f8      | Ubuntu 22.04 LTS | active | 2023-05-03 09:47:59 +0000 UTC |
| 67992861-066b-4d76-a6a4-a21b3e855722 | capi-quickstart-worker-a-qqnhb      | Ubuntu 22.04 LTS | active | 2023-05-03 09:48:00 +0000 UTC |
| b15870cd-a83d-48bd-9552-5281162ae563 | capi-quickstart-control-plane-lxnsr | Ubuntu 22.04 LTS | active | 2023-05-03 09:54:11 +0000 UTC |
| 2f6d7ff2-6aa5-49bc-838a-97a3473ea16a | eksa-node-002                       | Custom iPXE      | active | 2023-04-24 18:24:15 +0000 UTC |
| 46005014-5256-41b3-938a-1b295f931aa2 | eksa-node-001                       | Custom iPXE      | active | 2023-04-24 18:24:12 +0000 UTC |
| c3b1006c-0422-4f01-9c96-24dbcd72f7f1 | eksa-admin                          | Ubuntu 20.04 LTS | active | 2023-04-24 18:22:35 +0000 UTC |
+--------------------------------------+-------------------------------------+------------------+--------+-------------------------------+
```

## Cmd: metal devices get -i <Device ID>
* Packngo:
```
vasu@vasu-cloud:~/Equinix$ metal devices get -i 09be98b7-0db6-4fdb-90be-901ab847158d
+--------------------------------------+--------------+------------------+--------+----------------------+
|                  ID                  |   HOSTNAME   |        OS        | STATE  |       CREATED        |
+--------------------------------------+--------------+------------------+--------+----------------------+
| 09be98b7-0db6-4fdb-90be-901ab847158d | test-packngo | Ubuntu 20.04 LTS | active | 2023-06-26T13:09:24Z |
+--------------------------------------+--------------+------------------+--------+----------------------+
```
*Metal-go:
```
vasu@vasu-cloud:~/Equinix/metal-cli/bin$ ./metal devices get -i 09be98b7-0db6-4fdb-90be-901ab847158d
+--------------------------------------+--------------+------------------+--------+-------------------------------+
|                  ID                  |   HOSTNAME   |        OS        | STATE  |            CREATED            |
+--------------------------------------+--------------+------------------+--------+-------------------------------+
| 09be98b7-0db6-4fdb-90be-901ab847158d | test-packngo | Ubuntu 20.04 LTS | active | 2023-06-26 13:09:24 +0000 UTC |
+--------------------------------------+--------------+------------------+--------+-------------------------------+
```
# Create

```
Vasubabus-MacBook-Pro:bin vasubabu$ ./metal device create -p c309ce2c-160d-47e2-bb26-9debeb0be87d -P m3.small.x86 -m da -O ubuntu_20_04 -H create-device-dev-cdata --customdata '{"testDate":"fromCli"}'
+--------------------------------------+-------------------------+------------------+--------+-------------------------------+
|                  ID                  |        HOSTNAME         |        OS        | STATE  |            CREATED            |
+--------------------------------------+-------------------------+------------------+--------+-------------------------------+
| 8dc6920e-cf5a-4852-994d-a53094fe9673 | create-device-dev-cdata | Ubuntu 20.04 LTS | queued | 2023-08-24 10:28:29 +0000 UTC |
+--------------------------------------+-------------------------+------------------+--------+-------------------------------+
Vasubabus-MacBook-Pro:bin vasubabu$ ./metal device create -p c309ce2c-160d-47e2-bb26-9debeb0be87d -P m3.small.x86 -m da -O ubuntu_20_04 -H create-dev-cdata --customdata '{"testDate":""}'
+--------------------------------------+------------------+------------------+--------+-------------------------------+
|                  ID                  |     HOSTNAME     |        OS        | STATE  |            CREATED            |
+--------------------------------------+------------------+------------------+--------+-------------------------------+
| a45f8746-f3b5-4fc5-8fe6-b4fa6493d365 | create-dev-cdata | Ubuntu 20.04 LTS | queued | 2023-08-24 10:40:50 +0000 UTC |
+--------------------------------------+------------------+------------------+--------+-------------------------------+
```

```
Vasubabus-MacBook-Pro:bin vasubabu$ ./metal device create -p c309ce2c-160d-47e2-bb26-9debeb0be87d --hostname netboot-custom-ipxe-1 --plan c3.small.x86 --metro sv --operating-system custom_ipxe --userdata='#!ipxe
chain -ar https://boot.netboot.xyz' --always-pxe=true
+--------------------------------------+-----------------------+-------------+--------+-------------------------------+
|                  ID                  |       HOSTNAME        |     OS      | STATE  |            CREATED            |
+--------------------------------------+-----------------------+-------------+--------+-------------------------------+
| b149fc32-bcfd-44c8-9c0e-9e5d49d382e0 | netboot-custom-ipxe-1 | Custom iPXE | queued | 2023-08-24 10:48:33 +0000 UTC |
+--------------------------------------+-----------------------+-------------+--------+-------------------------------+

<img width="1430" alt="image" src="https://github.com/equinix/metal-cli/assets/3358152/ea4d5a5a-b495-40e7-a7ec-e3a6905ac5c7">

```

```
Vasubabus-MacBook-Pro:bin vasubabu$ ./metal device create -p c309ce2c-160d-47e2-bb26-9debeb0be87d --hostname netboot-custom-ipxe --plan c3.small.x86 --metro sv --operating-system custom_ipxe --userdata='#!ipxe
> chain -ar https://boot.netboot.xyz'
+--------------------------------------+---------------------+-------------+--------+-------------------------------+
|                  ID                  |      HOSTNAME       |     OS      | STATE  |            CREATED            |
+--------------------------------------+---------------------+-------------+--------+-------------------------------+
| 4aa8977b-259b-4684-a3b4-9ff49e96db47 | netboot-custom-ipxe | Custom iPXE | queued | 2023-08-24 10:44:02 +0000 UTC |
+--------------------------------------+---------------------+-------------+--------+-------------------------------+

<img width="1416" alt="image" src="https://github.com/equinix/metal-cli/assets/3358152/a9ff3f36-4716-4cbd-a9be-cc2dc8e672b7">

```
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants