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

Handle JSON in Zone POST requests #538

Merged
merged 4 commits into from
May 28, 2024

Conversation

pederhan
Copy link
Member

@pederhan pederhan commented May 27, 2024

Checks content type before trying to call getlist on request data.

@coveralls
Copy link
Collaborator

coveralls commented May 27, 2024

Coverage Status

coverage: 98.925% (-0.01%) from 98.938%
when pulling fdb50d1 on pederhan:zone-json-support
into fa6ca20 on unioslo:master.

@pederhan pederhan requested a review from terjekv May 28, 2024 07:41
@oyvindhagberg
Copy link
Contributor

I tested this with mreg-cli from the migrate_to_pydandic branch (248a19e) and verified that the "zone create" commands in the testsuite work now.

Copy link
Collaborator

@terjekv terjekv left a comment

Choose a reason for hiding this comment

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

- zone.primary_ns = request.data.getlist('primary_ns')[0]
+ zone.primary_ns = nameservers[0]

I'm not going to pretend that I understand why we're simply picking the first one, but the PR retains behaviour and fixes the issue with content type management. That works for me. :)

@pederhan pederhan merged commit b497579 into unioslo:master May 28, 2024
22 checks passed
@pederhan pederhan deleted the zone-json-support branch May 28, 2024 12:04
@oyvindkolbu
Copy link
Collaborator

- zone.primary_ns = request.data.getlist('primary_ns')[0]
+ zone.primary_ns = nameservers[0]

I'm not going to pretend that I understand why we're simply picking the first one, but the PR retains behaviour and fixes the issue with content type management. That works for me. :)

It is due to

"mname": idna_encode(qualify(self.primary_ns, self.name, shortform=False)),

We (ab)use the first name server in the list to be used as mname server in the SOA record for the zone.

The zone's primary_ns field could possibly be changed to mname to better reflect usage.

@terjekv
Copy link
Collaborator

terjekv commented May 28, 2024

We (ab)use the first name server in the list to be used as mname server in the SOA record for the zone.

Now that I know I wish I didn't know. :)

The zone's primary_ns field could possibly be changed to mname to better reflect usage.

Yep.

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.

5 participants