def TestHooksInitialize():
  master = GetMasterNode().primary
  hooks_base_dir = MakeNodePath(master, pathutils.HOOKS_BASE_DIR)
  pre_path = MakeNodePath(master, PRE_PATH)
  post_path = MakeNodePath(master, POST_PATH)
  GetCommandOutput(master, "mkdir -p %s" % hooks_base_dir)
  GetCommandOutput(master, "mkdir -p %s" % pre_path)
  GetCommandOutput(master, "mkdir -p %s" % post_path)
  GetCommandOutput(master, "mkdir -p %s" % _GetHDir())
  h_name = "/qa_test_hook"
  create_hook_common = """
FOUT=%s
echo '#!/bin/sh' > $FOUT
echo 'touch %s/$GANETI_JOB_ID"_"$GANETI_OP_CODE%s' >> $FOUT
chmod +x $FOUT
"""
  create_pre = create_hook_common % (pre_path + h_name, _GetHDir(), '"_pre"')
  create_post = create_hook_common % (post_path + h_name, _GetHDir(),
                                      '"_post_"$GANETI_POST_STATUS')
  GetCommandOutput(master, create_pre)
  GetCommandOutput(master, create_post)
Creates global hooks on the master node
dataset/ETHPy150Open ganeti/ganeti/qa/qa_global_hooks.py/TestHooksInitialize