chiark / gitweb /
make-secnet-sites: OpBase.write_out: Move heading back into OpUserv
authorIan Jackson <ijackson@chiark.greenend.org.uk>
Wed, 4 Dec 2019 16:44:58 +0000 (16:44 +0000)
committerIan Jackson <ijackson@chiark.greenend.org.uk>
Sat, 15 Feb 2020 21:56:53 +0000 (21:56 +0000)
This relies on self.user, and in more general cases we want the output
to be reproducible so don't want the time either.

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
make-secnet-sites

index f9c249b..d9ed821 100755 (executable)
@@ -304,9 +304,7 @@ class OpBase():
                else:
                        f=open(self.sitesfile+"-tmp",'w')
                f.write("# sites file autogenerated by make-secnet-sites\n")
-               f.write("# generated %s, invoked by %s\n"%
-                       (time.asctime(time.localtime(time.time())),
-                        self.user))
+               self.write_out_heading(f)
                f.write("# use make-secnet-sites to turn this file into a\n")
                f.write("# valid /etc/secnet/sites.conf file\n\n")
                self.write_out_contents(f)
@@ -381,6 +379,10 @@ class OpUserv(OpBase):
                os.rename(self.groupfiledir+"/T"+self.group.groupname(),
                          self.groupfiledir+"/R"+self.group.groupname())
                OpBase.write_out(self)
+       def write_out_heading(self,f):
+               f.write("# generated %s, invoked by %s\n"%
+                       (time.asctime(time.localtime(time.time())),
+                        self.user))
        def write_out_contents(self,f):
                for i in self.headerinput: f.write(i)
                files=os.listdir(self.groupfiledir)