Browse Source

Merge "Update hieraedit for python3"

Zuul 1 month ago
parent
commit
9ed2297b2e
1 changed files with 4 additions and 4 deletions
  1. 4
    4
      tools/hieraedit.py

+ 4
- 4
tools/hieraedit.py View File

@@ -56,7 +56,7 @@ parser.add_argument('value', help='the value', nargs='?')
56 56
 parser.add_argument('-f', dest='file', help='file to read in as value')
57 57
 
58 58
 args = parser.parse_args()
59
-data = yaml.load(open(args.yaml))
59
+data = yaml.safe_load(open(args.yaml))
60 60
 
61 61
 changed = False
62 62
 if args.value:
@@ -65,12 +65,12 @@ if args.value:
65 65
 if args.file:
66 66
     data[args.key] = open(args.file).read()
67 67
     changed = True
68
-print data[args.key]
68
+print(data[args.key])
69 69
 
70 70
 if changed:
71 71
     dn = os.path.dirname(args.yaml)
72 72
     (out, fn) = tempfile.mkstemp(dir=dn)
73
-    os.write(out, yaml.dump(data, default_flow_style=False, Dumper=MyDumper))
73
+    os.write(out, yaml.dump(data, default_flow_style=False, Dumper=MyDumper).encode('utf8'))
74 74
     os.close(out)
75
-    os.chown(fn, pwd.getpwnam('puppet').pw_uid, grp.getgrnam('puppet').gr_gid)
75
+    os.chown(fn, pwd.getpwnam('root').pw_uid, grp.getgrnam('admin').gr_gid)
76 76
     os.rename(fn, args.yaml)

Loading…
Cancel
Save