Run client.py instead of fetch_and_update on the client
This commit is contained in:
14
client/run
14
client/run
@@ -4,10 +4,12 @@ set -ex
|
|||||||
|
|
||||||
exec 2>&1
|
exec 2>&1
|
||||||
|
|
||||||
# Mitigate crash looping
|
BASE=$(dirname $0)
|
||||||
sleep 60
|
|
||||||
|
|
||||||
while :; do
|
FLAGS="$(cat /icon/config/client.flags)"
|
||||||
./fetch_and_update.sh
|
|
||||||
sleep 3600
|
HTTPS_CLIENT_KEY="/systemid/$(hostname).www.key.pem"
|
||||||
done
|
HTTPS_CLIENT_CERT="/systemid/$(hostname).www.cert.pem"
|
||||||
|
HTTPS_CA_CERT="/icon/config/ca.www.cert.pem"
|
||||||
|
|
||||||
|
exec "${BASE}/client.py" --https-ca-cert="${HTTPS_CA_CERT}" --https-client-cert="${HTTPS_CLIENT_CERT}" --https-client-key="${HTTPS_CLIENT_KEY}" ${FLAGS}
|
||||||
|
|||||||
@@ -32,6 +32,11 @@ parser.add_argument(
|
|||||||
action='store',
|
action='store',
|
||||||
type=int,
|
type=int,
|
||||||
default=5)
|
default=5)
|
||||||
|
parser.add_argument(
|
||||||
|
'--server',
|
||||||
|
dest='server',
|
||||||
|
action='store',
|
||||||
|
required=True)
|
||||||
FLAGS = parser.parse_args()
|
FLAGS = parser.parse_args()
|
||||||
|
|
||||||
|
|
||||||
@@ -70,14 +75,20 @@ def main():
|
|||||||
FLAGS.https_ca_cert,
|
FLAGS.https_ca_cert,
|
||||||
os.path.join(FLAGS.chroot_path, 'icon', 'config', 'ca.www.cert.pem'))
|
os.path.join(FLAGS.chroot_path, 'icon', 'config', 'ca.www.cert.pem'))
|
||||||
|
|
||||||
|
# TODO: remove after we integrate this into client.py
|
||||||
path = os.path.join(FLAGS.chroot_path, 'icon', 'config', 'fetcher.flags')
|
fetcher_flags = os.path.join(FLAGS.chroot_path, 'icon', 'config', 'fetcher.flags')
|
||||||
with open(path, 'w') as fh:
|
with open(fetcher_flags, 'w') as fh:
|
||||||
fh.write('--base-url=%(base_url)s --max-images=%(max_images)d\n' % {
|
fh.write('--base-url=%(base_url)s --max-images=%(max_images)d\n' % {
|
||||||
'base_url': FLAGS.base_url,
|
'base_url': FLAGS.base_url,
|
||||||
'max_images': FLAGS.max_images,
|
'max_images': FLAGS.max_images,
|
||||||
})
|
})
|
||||||
|
|
||||||
|
client_flags = os.path.join(FLAGS.chroot_path, 'icon', 'config', 'client.flags')
|
||||||
|
with open(client_flags, 'w') as fh:
|
||||||
|
fh.write('--server=%(server)s\n' % {
|
||||||
|
'server': FLAGS.server,
|
||||||
|
})
|
||||||
|
|
||||||
os.symlink(
|
os.symlink(
|
||||||
'/icon/iconograph/client',
|
'/icon/iconograph/client',
|
||||||
os.path.join(FLAGS.chroot_path, 'etc', 'service', 'iconograph-client'))
|
os.path.join(FLAGS.chroot_path, 'etc', 'service', 'iconograph-client'))
|
||||||
|
|||||||
Reference in New Issue
Block a user