add rc-scripts and confs. Make log message clear when host is not found

This commit is contained in:
ahmadbilalkhalid 2019-11-27 19:19:57 +05:00
parent 789e37df6b
commit db7fcdd66f
5 changed files with 26 additions and 1 deletions

1
hack/conf.d/ucloud-host Normal file
View file

@ -0,0 +1 @@
HOSTNAME=server1.place10

View file

@ -0,0 +1,8 @@
#!/sbin/openrc-run
name="$RC_SVCNAME"
pidfile="/var/run/${name}.pid"
command="$(which pipenv)"
command_args="run python ucloud.py api"
command_background="true"
directory="/root/ucloud"

View file

@ -0,0 +1,8 @@
#!/sbin/openrc-run
name="$RC_SVCNAME"
pidfile="/var/run/${name}.pid"
command="$(which pipenv)"
command_args="run python ucloud.py host ${HOSTNAME}"
command_background="true"
directory="/root/ucloud"

View file

@ -0,0 +1,8 @@
#!/sbin/openrc-run
name="$RC_SVCNAME"
pidfile="/var/run/${name}.pid"
command="$(which pipenv)"
command_args="run python ucloud.py scheduler"
command_background="true"
directory="/root/ucloud"

View file

@ -76,7 +76,7 @@ def main(hostname):
host_pool = HostPool(etcd_client, env_vars.get('HOST_PREFIX'))
host = next(filter(lambda h: h.hostname == hostname, host_pool.hosts), None)
assert host is not None, "No such host"
assert host is not None, "No such host with name = {}".format(hostname)
try:
heartbeat_updating_process.start()