|
20 | 20 |
|
21 | 21 | args = parser.parse_args() |
22 | 22 |
|
23 | | -if args.log_file == '-': |
24 | | - logging.basicConfig(level=getattr(logging,args.log_level.upper())) |
25 | | -else: |
26 | | - logging.basicConfig(level=getattr(logging,args.log_level.upper()), filename=args.log_file) |
| 23 | +logging.basicConfig(level=getattr(logging,args.log_level.upper()), |
| 24 | + format='%(asctime)s - %(name)s - %(levelname)s - %(message)s', |
| 25 | + filename=(args.log_file if args.log_file != '-' else None)) |
27 | 26 |
|
28 | 27 | if args.zone is None: |
29 | 28 | args.zone = args.domain |
|
52 | 51 | if m: |
53 | 52 | event = m.group(2) |
54 | 53 | container_id = m.group(1) |
55 | | - logging.info("Got event %s for container %s", event, container_id) |
| 54 | + logging.debug("Got event %s for container %s", event, container_id) |
56 | 55 |
|
57 | 56 | if event == "start": |
58 | | - logging.info("Starting %s", container_id) |
59 | 57 | detail = c.inspect_container(container_id) |
60 | 58 | container_hostname = detail["Config"]["Hostname"] |
61 | 59 | container_name = detail["Name"].split('/',1)[1] |
62 | 60 | container_ip = detail["NetworkSettings"]["IPAddress"] |
| 61 | + |
| 62 | + logging.info("Updating %s to ip (%s|%s) -> %s", container_id, container_hostname, container_name, container_ip) |
63 | 63 | nsupdate = Popen(['nsupdate', '-k', args.key], stdin=PIPE) |
64 | 64 | nsupdate.stdin.write(bytes(zone_update_template.format(args.server, args.zone, container_hostname, args.domain, container_ip), "UTF-8")) |
65 | 65 | if container_name != container_hostname: |
|
0 commit comments