Merge branch 'PowerDNS-Admin:master' into docs-updates

This commit is contained in:
David Mc Ken 2022-12-12 17:17:23 -04:00 committed by GitHub
commit 23274301f8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 17 additions and 15 deletions

View File

@ -18,7 +18,7 @@ spec:
spec: spec:
containers: containers:
- name: powerdnsadmin - name: powerdnsadmin
image: ngoduykhanh/powerdns-admin image: powerdnsadmin/pda-legacy
ports: ports:
- containerPort: 80 - containerPort: 80
protocol: TCP protocol: TCP

View File

@ -2,7 +2,7 @@ version: "3"
services: services:
app: app:
image: ngoduykhanh/powerdns-admin:latest image: powerdnsadmin/pda-legacy:latest
container_name: powerdns_admin container_name: powerdns_admin
ports: ports:
- "9191:80" - "9191:80"

View File

@ -119,16 +119,12 @@ def fetch_json(remote_url,
def display_record_name(data): def display_record_name(data):
# Check that the data argument is a tuple containing two elements record_name, domain_name = data
if isinstance(data, Iterable) and len(data) == 2: if record_name == domain_name:
record_name, domain_name = data return '@'
if record_name == domain_name:
return '@'
else:
return record_name
else: else:
# If data is not a tuple of length 2, return an empty string return re.sub('\.{}$'.format(domain_name), '', record_name)
return ''
def display_master_name(data): def display_master_name(data):
""" """
@ -262,18 +258,24 @@ def pretty_domain_name(value):
raise Exception('Require the Punycode in string format') raise Exception('Require the Punycode in string format')
def to_idna(value, action): def to_idna(value, action):
splits = value.split() splits = value.split('.')
result = [] result = []
if action == 'encode': if action == 'encode':
for split in splits: for split in splits:
try: try:
# Try encoding to idna # Try encoding to idna
result.append(idna.encode(split).decode()) if not split.startswith('_') and not split.startswith('-'):
result.append(idna.encode(split).decode())
else:
result.append(split)
except idna.IDNAError: except idna.IDNAError:
result.append(split) result.append(split)
elif action == 'decode': elif action == 'decode':
for split in splits: for split in splits:
result.append(idna.decode(split)) if not split.startswith('_') and not split.startswith('--'):
result.append(idna.decode(split))
else:
result.append(split)
else: else:
raise Exception('No valid action received') raise Exception('No valid action received')
return ' '.join(result) return '.'.join(result)