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

move SRV check from models/dns.py to dns.py #157

Open
miesi opened this issue Dec 6, 2021 · 0 comments
Open

move SRV check from models/dns.py to dns.py #157

miesi opened this issue Dec 6, 2021 · 0 comments

Comments

@miesi
Copy link
Contributor

miesi commented Dec 6, 2021

    def create(name, type, view, ttl, comment=None, **kwargs):
        if type == 'SRV':
            labels = name.split('.')
            if len(labels) < 2 or not labels[0].startswith('_') or not labels[1].startswith('_'):
                raise InvalidParameterError('SRV records must start with two _ labels service and proto')
        kwargs = RR.validate_args(type, **kwargs)
        rr = RR(name=name, type=type, view=view, ttl=ttl, comment=comment)
        for field in list(kwargs.keys()):
            if field == 'ip':
                rr.ipblock = kwargs['ip']
            elif field in RRType.target_fields:
                rr.target = make_fqdn(kwargs[field], view.zone.name)
        rr.value = RR.get_class(type).value_from_fields(**kwargs)
        return rr
@miesi miesi added this to the next milestone Dec 17, 2021
@Srudush Srudush removed this from the next milestone Feb 15, 2022
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

No branches or pull requests

2 participants