Skip to content

Commit

Permalink
Merge pull request #191 from kdeng3849/update-hello-world-example
Browse files Browse the repository at this point in the history
updated json example in docs to new structure
  • Loading branch information
kqdeng authored Jul 6, 2020
2 parents f1617bd + 69a9b41 commit 8ade723
Showing 1 changed file with 38 additions and 31 deletions.
69 changes: 38 additions & 31 deletions docs/hello-world.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,46 +13,52 @@ While the data model changes are in progress, the following data should be enoug

```json
{
"allow_pxe": true,
"allow_workflow": true,
"arch": "x86_64",
"facility_code": "onprem",
"id": "ce2e62ed-826f-4485-a39f-a82bb74338e2",
"ip_addresses": [
{
"address": "192.168.1.5",
"address_family": 4,
"enabled": true,
"gateway": "192.168.1.1",
"management": true,
"netmask": "255.255.255.248",
"public": false
}
],
"network_ports": [
{
"data": {
"mac": "ec:0d:9a:bf:ff:dc"
},
"name": "eth0",
"type": "data"
}
]
"id": "0eba0bf8-3772-4b4a-ab9f-6ebe93b90a94",
"metadata": {
"facility": {
"facility_code": "ewr1",
"plan_slug": "c2.medium.x86",
"plan_version_slug": ""
},
"instance": {},
"state": ""
},
"network": {
"interfaces": [
{
"dhcp": {
"arch": "x86_64",
"ip": {
"address": "192.168.1.5",
"gateway": "192.168.1.1",
"netmask": "255.255.255.248"
},
"mac": "00:00:00:00:00:00",
"uefi": false
},
"netboot": {
"allow_pxe": true,
"allow_workflow": true
}
}
]
}
}
```

A few details to note:

- `id` is the hardware UUID
- `allow_workflow` must be `true` to boot into workflow mode
- `ip_addresses.address` is the IP to hand out
- `network_ports` is the worker MAC address
- `network.interfaces[].netboot.allow_workflow` must be `true` to boot into workflow mode
- `network.interfaces[].dhcp.ip.address` is the IP to hand out
- `network.interfaces[].dhcp.mac` is the worker MAC address

Now that we have the hardware data, we need to push it into the database.
In order to do so, remove the extra spaces in the above JSON and use the following command to push the data:
In order to do so, save the above JSON into a file (e.g., `data.json`) and use either of the following commands to push the data:

```
$ tink hardware push '<json-data-here>'
```shell
$ tink hardware push --file data.json
$ cat data.json | tink hardware push
```

Verify that the data was actually pushed using the command:
Expand Down Expand Up @@ -86,6 +92,7 @@ We can now define a workflow with the following steps:
- Create a workflow:

```shell
# the value of device_1 could be either the MAC address or IP address of the hardware/device
$ tink workflow create -t <template-uuid> -r '{"device_1":"mac/IP"}'
```

Expand Down

0 comments on commit 8ade723

Please sign in to comment.