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

InstanceRebuildOptions no longer requires all fields to be specified #135

Merged
merged 2 commits into from
Apr 2, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,8 @@ run_fixtures:

sanitize:
@echo "* Sanitizing fixtures"
@for yaml in fixtures/*yaml; do \
sed -E -i.bak -e "s/$(LINODE_TOKEN)/awesometokenawesometokenawesometoken/g" \
@for yaml in test/integration/fixtures/*yaml; do \
sed -E -i.bak \
-e 's_stats/20[0-9]{2}/[1-9][0-2]?_stats/2018/1_g' \
-e 's/20[0-9]{2}-[01][0-9]-[0-3][0-9]T[0-2][0-9]:[0-9]{2}:[0-9]{2}/2018-01-02T03:04:05/g' \
-e 's/nb-[0-9]{1,3}-[0-9]{1,3}-[0-9]{1,3}-[0-9]{1,3}\./nb-10-20-30-40./g' \
Expand All @@ -63,7 +63,7 @@ sanitize:
-e 's/(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))/1234::5678/g' \
$$yaml; \
done
@find fixtures -name *yaml.bak -exec rm {} \;
@find test/integration/fixtures -name *yaml.bak -exec rm {} \;

fixtures: run_fixtures sanitize

Expand Down
14 changes: 7 additions & 7 deletions instances.go
Original file line number Diff line number Diff line change
Expand Up @@ -398,13 +398,13 @@ func (c *Client) RebootInstance(ctx context.Context, id int, configID int) error

// InstanceRebuildOptions is a struct representing the options to send to the rebuild linode endpoint
type InstanceRebuildOptions struct {
Image string `json:"image"`
RootPass string `json:"root_pass"`
AuthorizedKeys []string `json:"authorized_keys"`
AuthorizedUsers []string `json:"authorized_users"`
StackscriptID int `json:"stackscript_id"`
StackscriptData map[string]string `json:"stackscript_data"`
Booted bool `json:"booted"`
Image string `json:"image,omitempty"`
RootPass string `json:"root_pass,omitempty"`
AuthorizedKeys []string `json:"authorized_keys,omitempty"`
AuthorizedUsers []string `json:"authorized_users,omitempty"`
StackScriptID int `json:"stackscript_id,omitempty"`
StackScriptData map[string]string `json:"stackscript_data,omitempty"`
Booted *bool `json:"booted,omitempty"`
}

// RebuildInstance Deletes all Disks and Configs on this Linode,
Expand Down
10 changes: 5 additions & 5 deletions test/integration/fixtures/TestListEvents.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ interactions:
method: POST
response:
body: '{"id": 19967871, "label": "linodego-test-instance", "group": "", "status":
"provisioning", "created": "2020-04-01T15:14:50", "updated": "2020-04-01T15:14:50",
"type": "g6-nanode-1", "ipv4": ["45.33.51.250"], "ipv6": "2600:3c01::f03c:92ff:fe60:c1b2/64",
"provisioning", "created": "2018-01-02T03:04:05", "updated": "2018-01-02T03:04:05",
"type": "g6-nanode-1", "ipv4": ["10.20.30.40"], "ipv6": "1234::5678/64",
"image": "linode/debian9", "region": "us-west", "specs": {"disk": 25600, "memory":
1024, "vcpus": 1, "gpus": 0, "transfer": 1000}, "alerts": {"cpu": 90, "network_in":
10, "network_out": 10, "transfer_quota": 80, "io": 10000}, "backups": {"enabled":
Expand Down Expand Up @@ -91,7 +91,7 @@ interactions:
body: '{"id": 21348302, "label": "linodego-test-config", "helpers": {"updatedb_disabled":
true, "distro": true, "modules_dep": true, "network": true, "devtmpfs_automount":
true}, "kernel": "linode/latest-64bit", "comments": "", "memory_limit": 0, "created":
"2020-04-01T15:14:51", "updated": "2020-04-01T15:14:51", "root_device": "/dev/sda",
"2018-01-02T03:04:05", "updated": "2018-01-02T03:04:05", "root_device": "/dev/sda",
"devices": {"sda": null, "sdb": null, "sdc": null, "sdd": null, "sde": null,
"sdf": null, "sdg": null, "sdh": null}, "initrd": null, "run_level": "default",
"virt_mode": "paravirt"}'
Expand Down Expand Up @@ -163,14 +163,14 @@ interactions:
url: https://api.linode.com/v4beta/account/events
method: GET
response:
body: '{"data": [{"id": 79166449, "created": "2020-04-01T15:14:51", "seen": false,
body: '{"data": [{"id": 79166449, "created": "2018-01-02T03:04:05", "seen": false,
"read": false, "percent_complete": null, "time_remaining": null, "rate": null,
"duration": null, "action": "linode_config_create", "username": "pccampbell",
"entity": {"label": "linodego-test-instance", "id": 19967871, "type": "linode",
"url": "/v4/linode/instances/19967871"}, "status": "notification", "secondary_entity":
{"id": 21348302, "type": "linode_config", "label": "linodego-test-config", "url":
"/v4/linode/instances/19967871/configs/21348302"}}, {"id": 79166446, "created":
"2020-04-01T15:14:51", "seen": false, "read": false, "percent_complete": 0,
"2018-01-02T03:04:05", "seen": false, "read": false, "percent_complete": 0,
"time_remaining": null, "rate": null, "duration": null, "action": "linode_create",
"username": "pccampbell", "entity": {"label": "linodego-test-instance", "id":
19967871, "type": "linode", "url": "/v4/linode/instances/19967871"}, "status":
Expand Down
72 changes: 36 additions & 36 deletions test/integration/fixtures/TestListFirewalls.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
version: 1
interactions:
- request:
body: '{"label":"a83ef3go2h76-linodego-testing","rules":{"inbound":[{"ports":"22","protocol":"TCP","addresses":{"ipv4":["0.0.0.0/0"],"ipv6":["::0/0"]}}],"outbound":[{"ports":"22","protocol":"TCP","addresses":{"ipv4":["0.0.0.0/0"],"ipv6":["::0/0"]}}]},"tags":["testing"],"devices":{}}'
body: '{"label":"a83ef3go2h76-linodego-testing","rules":{"inbound":[{"ports":"22","protocol":"TCP","addresses":{"ipv4":["10.20.30.40/0"],"ipv6":["1234::5678/0"]}}],"outbound":[{"ports":"22","protocol":"TCP","addresses":{"ipv4":["10.20.30.40/0"],"ipv6":["1234::5678/0"]}}]},"tags":["testing"],"devices":{}}'
form: {}
headers:
Accept:
Expand All @@ -14,11 +14,11 @@ interactions:
url: https://api.linode.com/v4beta/networking/firewalls
method: POST
response:
body: '{"id": 37, "label": "a83ef3go2h76-linodego-testing", "created": "2020-02-19T19:38:16",
"updated": "2020-02-19T19:38:16", "status": "enabled", "rules": {"inbound":
[{"ports": "22", "protocol": "TCP", "addresses": {"ipv4": ["0.0.0.0/0"], "ipv6":
["::0/0"]}}], "outbound": [{"ports": "22", "protocol": "TCP", "addresses": {"ipv4":
["0.0.0.0/0"], "ipv6": ["::0/0"]}}]}, "tags": ["testing"]}'
body: '{"id": 37, "label": "a83ef3go2h76-linodego-testing", "created": "2018-01-02T03:04:05",
"updated": "2018-01-02T03:04:05", "status": "enabled", "rules": {"inbound":
[{"ports": "22", "protocol": "TCP", "addresses": {"ipv4": ["10.20.30.40/0"], "ipv6":
["1234::5678/0"]}}], "outbound": [{"ports": "22", "protocol": "TCP", "addresses": {"ipv4":
["10.20.30.40/0"], "ipv6": ["1234::5678/0"]}}]}, "tags": ["testing"]}'
headers:
Access-Control-Allow-Credentials:
- "true"
Expand Down Expand Up @@ -85,39 +85,39 @@ interactions:
url: https://api.linode.com/v4beta/networking/firewalls
method: GET
response:
body: '{"data": [{"id": 19, "label": "firewall19", "created": "2020-02-10T22:24:05",
"updated": "2020-02-10T22:24:05", "status": "disabled", "rules": {"inbound":
[{"ports": "22", "protocol": "TCP", "addresses": {"ipv4": ["172.104.2.4"]}}]},
"tags": []}, {"id": 20, "label": "firewall20", "created": "2020-02-11T14:48:23",
"updated": "2020-02-11T14:48:23", "status": "disabled", "rules": {"inbound":
[{"ports": "22", "protocol": "TCP", "addresses": {"ipv4": ["172.104.2.4"]}}]},
"tags": []}, {"id": 31, "label": "firewall31", "created": "2020-02-14T22:31:45",
"updated": "2020-02-14T22:31:45", "status": "disabled", "rules": {"inbound":
[{"ports": "3306", "protocol": "TCP", "addresses": {"ipv4": ["0.0.0.0/0"], "ipv6":
["::0/0"]}}], "outbound": [{"ports": "3306", "protocol": "TCP", "addresses":
{"ipv4": ["0.0.0.0/0"], "ipv6": ["::0/0"]}}]}, "tags": []}, {"id": 32, "label":
"blah", "created": "2020-02-19T15:36:40", "updated": "2020-02-19T15:36:40",
body: '{"data": [{"id": 19, "label": "firewall19", "created": "2018-01-02T03:04:05",
"updated": "2018-01-02T03:04:05", "status": "disabled", "rules": {"inbound":
[{"ports": "22", "protocol": "TCP", "addresses": {"ipv4": ["10.20.30.40"]}}]},
"tags": []}, {"id": 20, "label": "firewall20", "created": "2018-01-02T03:04:05",
"updated": "2018-01-02T03:04:05", "status": "disabled", "rules": {"inbound":
[{"ports": "22", "protocol": "TCP", "addresses": {"ipv4": ["10.20.30.40"]}}]},
"tags": []}, {"id": 31, "label": "firewall31", "created": "2018-01-02T03:04:05",
"updated": "2018-01-02T03:04:05", "status": "disabled", "rules": {"inbound":
[{"ports": "3306", "protocol": "TCP", "addresses": {"ipv4": ["10.20.30.40/0"], "ipv6":
["1234::5678/0"]}}], "outbound": [{"ports": "3306", "protocol": "TCP", "addresses":
{"ipv4": ["10.20.30.40/0"], "ipv6": ["1234::5678/0"]}}]}, "tags": []}, {"id": 32, "label":
"blah", "created": "2018-01-02T03:04:05", "updated": "2018-01-02T03:04:05",
"status": "enabled", "rules": {"inbound": [{"ports": "80", "protocol": "TCP",
"addresses": {"ipv4": ["0.0.0.0/0"], "ipv6": ["::0/0"]}}, {"ports": "443", "protocol":
"TCP", "addresses": {"ipv4": ["0.0.0.0/0"], "ipv6": ["::0/0"]}}], "outbound":
[{"ports": "80", "protocol": "TCP", "addresses": {"ipv4": ["0.0.0.0/0"], "ipv6":
["::0/0"]}}, {"ports": "443", "protocol": "TCP", "addresses": {"ipv4": ["0.0.0.0/0"],
"ipv6": ["::0/0"]}}]}, "tags": []}, {"id": 33, "label": "test-firewall", "created":
"2020-02-19T17:45:58", "updated": "2020-02-19T17:45:58", "status": "enabled",
"addresses": {"ipv4": ["10.20.30.40/0"], "ipv6": ["1234::5678/0"]}}, {"ports": "443", "protocol":
"TCP", "addresses": {"ipv4": ["10.20.30.40/0"], "ipv6": ["1234::5678/0"]}}], "outbound":
[{"ports": "80", "protocol": "TCP", "addresses": {"ipv4": ["10.20.30.40/0"], "ipv6":
["1234::5678/0"]}}, {"ports": "443", "protocol": "TCP", "addresses": {"ipv4": ["10.20.30.40/0"],
"ipv6": ["1234::5678/0"]}}]}, "tags": []}, {"id": 33, "label": "test-firewall", "created":
"2018-01-02T03:04:05", "updated": "2018-01-02T03:04:05", "status": "enabled",
"rules": {"inbound": [{"ports": "80", "protocol": "TCP", "addresses": {"ipv4":
["0.0.0.0/0"], "ipv6": ["::0/0"]}}, {"ports": "443", "protocol": "TCP", "addresses":
{"ipv4": ["0.0.0.0/0"], "ipv6": ["::0/0"]}}], "outbound": [{"ports": "80", "protocol":
"TCP", "addresses": {"ipv4": ["0.0.0.0/0"], "ipv6": ["::0/0"]}}, {"ports": "443",
"protocol": "TCP", "addresses": {"ipv4": ["0.0.0.0/0"], "ipv6": ["::0/0"]}}]},
"tags": []}, {"id": 34, "label": "asdf", "created": "2020-02-19T18:03:47", "updated":
"2020-02-19T18:03:47", "status": "disabled", "rules": {"inbound": [{"ports":
"443", "protocol": "TCP", "addresses": {"ipv4": ["0.0.0.0/0"], "ipv6": ["::0/0"]}}],
"outbound": [{"ports": "443", "protocol": "TCP", "addresses": {"ipv4": ["0.0.0.0/0"],
"ipv6": ["::0/0"]}}]}, "tags": []}, {"id": 37, "label": "a83ef3go2h76-linodego-testing",
"created": "2020-02-19T19:38:17", "updated": "2020-02-19T19:38:17", "status":
["10.20.30.40/0"], "ipv6": ["1234::5678/0"]}}, {"ports": "443", "protocol": "TCP", "addresses":
{"ipv4": ["10.20.30.40/0"], "ipv6": ["1234::5678/0"]}}], "outbound": [{"ports": "80", "protocol":
"TCP", "addresses": {"ipv4": ["10.20.30.40/0"], "ipv6": ["1234::5678/0"]}}, {"ports": "443",
"protocol": "TCP", "addresses": {"ipv4": ["10.20.30.40/0"], "ipv6": ["1234::5678/0"]}}]},
"tags": []}, {"id": 34, "label": "asdf", "created": "2018-01-02T03:04:05", "updated":
"2018-01-02T03:04:05", "status": "disabled", "rules": {"inbound": [{"ports":
"443", "protocol": "TCP", "addresses": {"ipv4": ["10.20.30.40/0"], "ipv6": ["1234::5678/0"]}}],
"outbound": [{"ports": "443", "protocol": "TCP", "addresses": {"ipv4": ["10.20.30.40/0"],
"ipv6": ["1234::5678/0"]}}]}, "tags": []}, {"id": 37, "label": "a83ef3go2h76-linodego-testing",
"created": "2018-01-02T03:04:05", "updated": "2018-01-02T03:04:05", "status":
"enabled", "rules": {"inbound": [{"ports": "22", "protocol": "TCP", "addresses":
{"ipv4": ["0.0.0.0/0"], "ipv6": ["::0/0"]}}], "outbound": [{"ports": "22", "protocol":
"TCP", "addresses": {"ipv4": ["0.0.0.0/0"], "ipv6": ["::0/0"]}}]}, "tags": ["testing"]}],
{"ipv4": ["10.20.30.40/0"], "ipv6": ["1234::5678/0"]}}], "outbound": [{"ports": "22", "protocol":
"TCP", "addresses": {"ipv4": ["10.20.30.40/0"], "ipv6": ["1234::5678/0"]}}]}, "tags": ["testing"]}],
"page": 1, "pages": 1, "results": 7}'
headers:
Access-Control-Allow-Credentials:
Expand Down
Loading