Add client hostname
This commit is contained in:
parent
371b4883dd
commit
366bac782a
1 changed files with 3 additions and 1 deletions
4
main.py
4
main.py
|
@ -2,6 +2,7 @@ import logging
|
||||||
import logging.config
|
import logging.config
|
||||||
import pathlib
|
import pathlib
|
||||||
import traceback
|
import traceback
|
||||||
|
import socket
|
||||||
|
|
||||||
import click
|
import click
|
||||||
import toml
|
import toml
|
||||||
|
@ -11,6 +12,7 @@ from re2oapi import Re2oAPIClient
|
||||||
from gandi import GandiAPIClient, DomainsRecords, Record
|
from gandi import GandiAPIClient, DomainsRecords, Record
|
||||||
|
|
||||||
RUN_PATH = pathlib.Path(__file__).parent
|
RUN_PATH = pathlib.Path(__file__).parent
|
||||||
|
CLIENT_HOSTNAME = socket.gethostname().split('.', 1)[0]
|
||||||
|
|
||||||
|
|
||||||
@click.command()
|
@click.command()
|
||||||
|
@ -174,7 +176,7 @@ def main(config_dir, dry_run, keep):
|
||||||
if not keep and not dry_run:
|
if not keep and not dry_run:
|
||||||
for service in re2o_client.list("services/regen/"):
|
for service in re2o_client.list("services/regen/"):
|
||||||
if (
|
if (
|
||||||
service["hostname"] == client_hostname
|
service["hostname"] == CLIENT_HOSTNAME
|
||||||
and service["service_name"] == "dns"
|
and service["service_name"] == "dns"
|
||||||
and service["need_regen"]
|
and service["need_regen"]
|
||||||
):
|
):
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue