chiark / gitweb /
make-secnet-sites: Actually fix -P option (!)
[secnet.git] / make-secnet-sites
index d7a849468cd9c7823cb1d781abdd05ade47b15e6..c26cab0922e3f308f30c2dbff637150be59a3b33 100755 (executable)
@@ -214,6 +214,7 @@ def parse_args():
        global group
        global user
        global of
+       global prefix
        global key_prefix
 
        ap = argparse.ArgumentParser(description='process secnet sites files')
@@ -228,6 +229,7 @@ def parse_args():
        av = ap.parse_args()
        #print(repr(av), file=sys.stderr)
        service = 1 if av.userv else 0
+       prefix = '' if av.prefix is None else av.prefix[0]
        key_prefix = av.conf_key_prefix
        if service:
                if len(av.arg)!=4:
@@ -417,7 +419,7 @@ class level:
        def prop_out(self,n):
                return self.allow_properties[n](n,str(self.properties[n]))
        def output_props(self,w,ind):
-               for i in self.properties.keys():
+               for i in sorted(self.properties.keys()):
                        if self.allow_properties[i]:
                                self.indent(w,ind)
                                w.write("%s"%self.prop_out(i))
@@ -430,7 +432,8 @@ class level:
                w.write("%s {\n"%(self.kname()))
                self.output_props(w,ind+2)
                if self.depth==1: w.write("\n");
-               for c in self.children.values():
+               for k in sorted(self.children.keys()):
+                       c=self.children[k]
                        c.output_data(w,path+(c,))
                self.indent(w,ind)
                w.write("};\n")
@@ -553,7 +556,6 @@ root=level([UntaintedRoot(x) for x in ['root','root']])
 # All vpns are children of this node
 obstack=[root]
 allow_defs=0   # Level above which new definitions are permitted
-prefix=''
 
 def set_property(obj,w):
        "Set a property on a configuration node"