propagate authenticationkey via VM extension
This commit is contained in:
Родитель
8051c6037e
Коммит
8adef9eec1
|
@ -388,10 +388,14 @@ def install():
|
||||||
else:
|
else:
|
||||||
host_name = curhostname
|
host_name = curhostname
|
||||||
public_settings = hutil._context._config['runtimeSettings'][0]['handlerSettings'].get('publicSettings')
|
public_settings = hutil._context._config['runtimeSettings'][0]['handlerSettings'].get('publicSettings')
|
||||||
|
protect_settings = hutil._context._config['runtimeSettings'][0]['handlerSettings'].get('protectedSettings')
|
||||||
|
authentication_key = ""
|
||||||
|
if protect_settings is not None:
|
||||||
|
authentication_key = protect_settings.get('AuthenticationKey')
|
||||||
|
authentication_key = authentication_key if authentication_key is not None else ""
|
||||||
cluster_connstring = public_settings.get('ClusterConnectionString')
|
cluster_connstring = public_settings.get('ClusterConnectionString')
|
||||||
if not cluster_connstring:
|
if not cluster_connstring:
|
||||||
waagent.Log("ClusterConnectionString is not specified")
|
waagent.Log("ClusterConnectionString is not specified")
|
||||||
protect_settings = hutil._context._config['runtimeSettings'][0]['handlerSettings'].get('protectedSettings')
|
|
||||||
cluster_connstring = protect_settings.get('ClusterName')
|
cluster_connstring = protect_settings.get('ClusterName')
|
||||||
if not cluster_connstring:
|
if not cluster_connstring:
|
||||||
error_msg = "neither ClusterConnectionString nor ClusterName is specified."
|
error_msg = "neither ClusterConnectionString nor ClusterName is specified."
|
||||||
|
@ -456,6 +460,8 @@ def install():
|
||||||
configjson["TrustedCAFile"] = os.path.join(certsdir, "nodemanager.pem")
|
configjson["TrustedCAFile"] = os.path.join(certsdir, "nodemanager.pem")
|
||||||
configjson["CertificateChainFile"] = os.path.join(certsdir, "nodemanager.crt")
|
configjson["CertificateChainFile"] = os.path.join(certsdir, "nodemanager.crt")
|
||||||
configjson["PrivateKeyFile"] = os.path.join(certsdir, "nodemanager.key")
|
configjson["PrivateKeyFile"] = os.path.join(certsdir, "nodemanager.key")
|
||||||
|
if authentication_key:
|
||||||
|
configjson["ClusterAuthenticationKey"] = authentication_key
|
||||||
configfile = os.path.join(InstallRoot, 'nodemanager.json')
|
configfile = os.path.join(InstallRoot, 'nodemanager.json')
|
||||||
waagent.SetFileContents(configfile, json.dumps(configjson))
|
waagent.SetFileContents(configfile, json.dumps(configjson))
|
||||||
shutil.copy2(configfile, backup_configfile)
|
shutil.copy2(configfile, backup_configfile)
|
||||||
|
@ -465,16 +471,11 @@ def install():
|
||||||
hutil.do_exit(1, 'Install','error','1', '{0}'.format(e))
|
hutil.do_exit(1, 'Install','error','1', '{0}'.format(e))
|
||||||
|
|
||||||
def enable():
|
def enable():
|
||||||
#Check whether monitor process is running.
|
#Always restart daemon and clear PID file
|
||||||
#If it does, return. Otherwise clear pid file
|
|
||||||
hutil = parse_context('Enable')
|
hutil = parse_context('Enable')
|
||||||
if os.path.isfile(DaemonPidFilePath):
|
if os.path.isfile(DaemonPidFilePath):
|
||||||
pid = waagent.GetFileContents(DaemonPidFilePath)
|
pid = waagent.GetFileContents(DaemonPidFilePath)
|
||||||
if os.path.isdir(os.path.join("/proc", pid)) and _is_nodemanager_daemon(pid):
|
if os.path.isdir(os.path.join("/proc", pid)) and _is_nodemanager_daemon(pid):
|
||||||
if hutil.is_seq_smaller():
|
|
||||||
hutil.do_exit(0, 'Enable', 'success', '0',
|
|
||||||
'HPC Linux node manager daemon is already running')
|
|
||||||
else:
|
|
||||||
waagent.Log("Stop old daemon: {0}".format(pid))
|
waagent.Log("Stop old daemon: {0}".format(pid))
|
||||||
os.killpg(int(pid), 9)
|
os.killpg(int(pid), 9)
|
||||||
os.remove(DaemonPidFilePath)
|
os.remove(DaemonPidFilePath)
|
||||||
|
|
Загрузка…
Ссылка в новой задаче