linode_api4-python icon indicating copy to clipboard operation
linode_api4-python copied to clipboard

400: We were unable to preform a lookup for 'test.example.com' at this time.;

Open adontz opened this issue 7 years ago • 4 comments

When trying to set rnds property for public IPv4 object I receive the following error:

400: We were unable to preform a lookup for '' at this time.;

Can you please explain what does it mean and how am I supposed to fix it?

OFF: It should be "perform" probably, not "preform"

adontz avatar Nov 16 '17 17:11 adontz

This looks to be an issue on our end - I'm adding it to our internal bug tracker and will update this item when it's been addressed.

Dorthu avatar Nov 17 '17 20:11 Dorthu

@Dorthu Has there been any movement on this? It's absolutely killing some scripting we're trying to do and properly attribute instances.

ravenium avatar Feb 14 '20 03:02 ravenium

@ravenium looking through our internal tracker, this was marked as resolved ages ago; I forgot to update the issue here. Can you paste in an excerpt of the code you're running and the error you're receiving so I can try to reproduce it?

Dorthu avatar Feb 14 '20 14:02 Dorthu

@Dorthu Certainly, though now I'm wondering if I am confusing two issues here. We're trying to stand up an instance, then create both forward (A) and PTR records all in the same script. I've read elsewhere that you cannot make a PTR record until ~24 hours after creating the instance or A record, is this correct?

Apologies again as I can't seem to find the python I was noodling on, but I did find the terraform (wrong language, but same api backend at least and same error result! :) ):

resource "linode_instance" "foo" { image = "linode/alpine3.9" region = "us-west" type = "g6-nanode-1" } resource "linode_domain_record" "foobar" { domain_id = 123456789 name = "myhost" record_type = "A" ttl_sec = 300 target = linode_instance.foo.ip_address } resource "linode_rdns" "foo" { address = linode_instance.foo.ip_address rdns = "${linode_instance.foo.ip_address}.my.domain.name" }

This gets you:

"Error: Error creating a Linode RDNS: [400] We were unable to perform a lookup for '1.2.3.4.my.domain.name' at this time."

(assume my.domain.name is a valid domain name and 1.2.3.4 is the public IP generated by the instance spinup).

Edit to add that I've tried waiting a couple hours before the instance and A/PTR additions and it didn't seem to help.

ravenium avatar Feb 14 '20 19:02 ravenium

I'm having similar issue - provisioning an instance with Terraform, and managing the A/AAAA and PTR records all together, but the PTR records fail because of the error in this issue. Running a manual dig of the A/AAAA records against ns1.linode.com shows that they ARE resolvable, but the API doesn't seem to agree.

Example (all performed using terraform):

  1. Create linode instance => IP Address 192.0.2.123 and 2001:db8::123
  2. Create A and AAAA records to point to server1.example.com
  3. Update PTR record for instance in Step 1 to point to server1.example.com <== FAILS
  4. Test dig @ns1.linode.com server1.example.com correctly returns the IP Addresses from step 1.

Really puts a dampener on provisioning automagically using TF :)

fukawi2 avatar Mar 18 '23 23:03 fukawi2

Hello @fukawi2, thanks for the feedback!

We have encountered similar issues when trying to automate RDNS in the past. As a workaround, we previously added a wait_for_available field to the linode_rdns resource in our Terraform Provider (see: https://github.com/linode/terraform-provider-linode/pull/570).

That said, this issue can definitely be a hindrance to infrastructure automation so I'll be sure to forward your feedback internally.

lgarber-akamai avatar Apr 18 '23 18:04 lgarber-akamai

Ah awesome! I missed that. Thanks for pointing me to it :tada:

fukawi2 avatar Apr 19 '23 01:04 fukawi2

I'm closing out this issue since it's not particularly relevant to this repository, but feel free to @ me if you feel this issue is still relevant.

Although we don't have plans to implement a workaround for this issue in this package, you can use the backoff package to poll for an RDNS update operation to succeed:

import backoff

from linode_api4 import LinodeClient, IPAddress, ApiError

client = LinodeClient(os.getenv("LINODE_TOKEN"))


@backoff.on_exception(
    backoff.constant,
    ApiError,
    interval=60,
    max_time=800,
    giveup=lambda e: e.status != 400,
)
def set_rdns_with_retries(ip: IPAddress, hostname: str):
    ip.rdns = hostname
    ip.save()


set_rdns_with_retries(client.load(IPAddress, "127.0.0.1"), "test.example.com")

Hope this helps 🙂

lgarber-akamai avatar Apr 19 '23 14:04 lgarber-akamai