Revision c008906b lib/bootstrap.py

b/lib/bootstrap.py
100 100
    os.close(fd)
101 101

  
102 102

  
103
def GenerateHmacKey(file_name):
104
  """Writes a new HMAC key.
105

  
106
  @type file_name: str
107
  @param file_name: Path to output file
108

  
109
  """
110
  utils.WriteFile(file_name, data=utils.GenerateSecret(), mode=0400)
111

  
112

  
103 113
def _InitGanetiServerSetup():
104 114
  """Setup the necessary configuration for the initial node daemon.
105 115

  
......
114 124
    GenerateSelfSignedSslCert(constants.RAPI_CERT_FILE)
115 125

  
116 126
  if not os.path.exists(constants.HMAC_CLUSTER_KEY):
117
    utils.WriteFile(constants.HMAC_CLUSTER_KEY,
118
                    data=utils.GenerateSecret(),
119
                    mode=0400)
127
    GenerateHmacKey(constants.HMAC_CLUSTER_KEY)
120 128

  
121 129
  result = utils.RunCmd([constants.NODE_INITD_SCRIPT, "restart"])
122 130

  

Also available in: Unified diff