Revision 82b22e19

b/lib/backend.py
59 59
from ganeti import ssconf
60 60
from ganeti import serializer
61 61
from ganeti import netutils
62
from ganeti import runtime
62 63

  
63 64

  
64 65
_BOOT_ID_PATH = "/proc/sys/kernel/random/boot_id"
......
2403 2404

  
2404 2405
  """
2405 2406
  _EnsureJobQueueFile(file_name)
2407
  getents = runtime.GetEnts()
2406 2408

  
2407 2409
  # Write and replace the file atomically
2408
  utils.WriteFile(file_name, data=_Decompress(content))
2410
  utils.WriteFile(file_name, data=_Decompress(content), uid=getents.masterd_uid,
2411
                  gid=getents.masterd_gid)
2409 2412

  
2410 2413

  
2411 2414
def JobQueueRename(old, new):
b/lib/jqueue.py
53 53
from ganeti import utils
54 54
from ganeti import jstore
55 55
from ganeti import rpc
56
from ganeti import runtime
56 57
from ganeti import netutils
57 58
from ganeti import compat
58 59

  
......
1070 1071
    @param replicate: whether to spread the changes to the remote nodes
1071 1072

  
1072 1073
    """
1073
    utils.WriteFile(file_name, data=data)
1074
    getents = runtime.GetEnts()
1075
    utils.WriteFile(file_name, data=data, uid=getents.masterd_uid,
1076
                    gid=getents.masterd_gid)
1074 1077

  
1075 1078
    if replicate:
1076 1079
      names, addrs = self._GetNodeIp()
......
1314 1317
    @param drain_flag: Whether to set or unset the drain flag
1315 1318

  
1316 1319
    """
1320
    getents = runtime.GetEnts()
1321

  
1317 1322
    if drain_flag:
1318
      utils.WriteFile(constants.JOB_QUEUE_DRAIN_FILE, data="", close=True)
1323
      utils.WriteFile(constants.JOB_QUEUE_DRAIN_FILE, data="", close=True,
1324
                      uid=getents.masterd_uid, gid=getents.masterd_gid)
1319 1325
    else:
1320 1326
      utils.RemoveFile(constants.JOB_QUEUE_DRAIN_FILE)
1321 1327

  
b/lib/jstore.py
25 25

  
26 26
from ganeti import constants
27 27
from ganeti import errors
28
from ganeti import runtime
28 29
from ganeti import utils
29 30

  
30 31

  
......
73 74
           locking mode.
74 75

  
75 76
  """
76
  dirs = [(d, constants.JOB_QUEUE_DIRS_MODE) for d in constants.JOB_QUEUE_DIRS]
77
  utils.EnsureDirs(dirs)
77
  getents = runtime.GetEnts()
78 78

  
79 79
  # Lock queue
80 80
  queue_lock = utils.FileLock.Open(constants.JOB_QUEUE_LOCK_FILE)
......
99 99
      if version is None:
100 100
        # Write new version file
101 101
        utils.WriteFile(constants.JOB_QUEUE_VERSION_FILE,
102
                        uid=getents.masterd_uid, gid=getents.masterd_gid,
102 103
                        data="%s\n" % constants.JOB_QUEUE_VERSION)
103 104

  
104 105
        # Read again
......
112 113
      if serial is None:
113 114
        # Write new serial file
114 115
        utils.WriteFile(constants.JOB_QUEUE_SERIAL_FILE,
116
                        uid=getents.masterd_uid, gid=getents.masterd_gid,
115 117
                        data="%s\n" % 0)
116 118

  
117 119
        # Read again

Also available in: Unified diff