add rc-scripts and confs. Make log message clear when host is not found
This commit is contained in:
parent
789e37df6b
commit
db7fcdd66f
5 changed files with 26 additions and 1 deletions
1
hack/conf.d/ucloud-host
Normal file
1
hack/conf.d/ucloud-host
Normal file
|
@ -0,0 +1 @@
|
||||||
|
HOSTNAME=server1.place10
|
8
hack/rc-scripts/ucloud-api
Normal file
8
hack/rc-scripts/ucloud-api
Normal 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"
|
8
hack/rc-scripts/ucloud-host
Normal file
8
hack/rc-scripts/ucloud-host
Normal 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"
|
8
hack/rc-scripts/ucloud-scheduler
Normal file
8
hack/rc-scripts/ucloud-scheduler
Normal 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"
|
|
@ -76,7 +76,7 @@ def main(hostname):
|
||||||
|
|
||||||
host_pool = HostPool(etcd_client, env_vars.get('HOST_PREFIX'))
|
host_pool = HostPool(etcd_client, env_vars.get('HOST_PREFIX'))
|
||||||
host = next(filter(lambda h: h.hostname == hostname, host_pool.hosts), None)
|
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:
|
try:
|
||||||
heartbeat_updating_process.start()
|
heartbeat_updating_process.start()
|
||||||
|
|
Loading…
Reference in a new issue