- Timestamp:
- May 2, 2012, 10:29:52 PM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
tools/gformat.py
r10649 r10654 84 84 'resolv.conf', 85 85 'motd', 86 'ntp.conf', 86 87 'wleiden.yaml', 87 88 ] … … 749 750 750 751 752 def generate_ntp_conf(datadump): 753 """ Generate configuration file '/etc/ntp.conf' """ 754 # XXX: This should properly going to be an datastructure soon 755 756 datadump['autogen_header'] = generate_header("#") 757 datadump['autogen_ntp_servers'] = '' 758 for host in get_proxylist(): 759 hostdump = get_yaml(host) 760 datadump['autogen_ntp_servers'] += "server %(masterip)-15s iburst maxpoll 9 # %(autogen_realname)s\n" % hostdump 761 for host in get_hybridlist(): 762 hostdump = get_yaml(host) 763 if hostdump['service_proxy_ileiden'] or hostdump['service_proxy_normal']: 764 datadump['autogen_ntp_servers'] += "server %(masterip)-15s iburst maxpoll 9 # %(autogen_realname)s\n" % hostdump 765 766 return Template("""\ 767 {{ autogen_header }} 768 769 {% if service_proxy_normal or service_proxy_ileiden or nodetype == 'Proxy' -%} 770 # Machine hooked to internet. 771 server 0.nl.pool.ntp.org iburst maxpoll 9 772 server 1.nl.pool.ntp.org iburst maxpoll 9 773 server 2.nl.pool.ntp.org iburst maxpoll 9 774 server 3.nl.pool.ntp.org iburst maxpoll 9 775 {% else -%} 776 # Local Wireless Leiden NTP Servers. 777 server 0.pool.ntp.wleiden.net iburst maxpoll 9 778 server 1.pool.ntp.wleiden.net iburst maxpoll 9 779 server 2.pool.ntp.wleiden.net iburst maxpoll 9 780 server 3.pool.ntp.wleiden.net iburst maxpoll 9 781 782 # All the configured NTP servers 783 {{ autogen_ntp_servers }} 784 {% endif %} 785 786 # If a server loses sync with all upstream servers, NTP clients 787 # no longer follow that server. The local clock can be configured 788 # to provide a time source when this happens, but it should usually 789 # be configured on just one server on a network. For more details see 790 # http://support.ntp.org/bin/view/Support/UndisciplinedLocalClock 791 # The use of Orphan Mode may be preferable. 792 # 793 server 127.127.1.0 794 fudge 127.127.1.0 stratum 10 795 """).render(datadump) 796 797 798 751 799 def generate_motd(datadump): 752 800 """ Generate configuration file '/etc/motd' """ … … 865 913 elif config == 'resolv.conf': 866 914 output += generate_resolv_conf(datadump) 915 elif config == 'ntp.conf': 916 output += generate_ntp_conf(datadump) 867 917 elif config == 'motd': 868 918 output += generate_motd(datadump)
Note:
See TracChangeset
for help on using the changeset viewer.