From 5d30642816d135b9e14faa23d2a8c6d2725f8671 Mon Sep 17 00:00:00 2001 From: Ian Gulliver Date: Mon, 9 May 2016 22:58:25 +0000 Subject: [PATCH] Run client.py instead of fetch_and_update on the client --- client/run | 14 ++++++++------ server/modules/iconograph.py | 17 ++++++++++++++--- 2 files changed, 22 insertions(+), 9 deletions(-) diff --git a/client/run b/client/run index 28ffa7b..e287b71 100755 --- a/client/run +++ b/client/run @@ -4,10 +4,12 @@ set -ex exec 2>&1 -# Mitigate crash looping -sleep 60 +BASE=$(dirname $0) -while :; do - ./fetch_and_update.sh - sleep 3600 -done +FLAGS="$(cat /icon/config/client.flags)" + +HTTPS_CLIENT_KEY="/systemid/$(hostname).www.key.pem" +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} diff --git a/server/modules/iconograph.py b/server/modules/iconograph.py index ddd34ec..27ee609 100755 --- a/server/modules/iconograph.py +++ b/server/modules/iconograph.py @@ -32,6 +32,11 @@ parser.add_argument( action='store', type=int, default=5) +parser.add_argument( + '--server', + dest='server', + action='store', + required=True) FLAGS = parser.parse_args() @@ -70,14 +75,20 @@ def main(): FLAGS.https_ca_cert, os.path.join(FLAGS.chroot_path, 'icon', 'config', 'ca.www.cert.pem')) - - path = os.path.join(FLAGS.chroot_path, 'icon', 'config', 'fetcher.flags') - with open(path, 'w') as fh: + # TODO: remove after we integrate this into client.py + fetcher_flags = os.path.join(FLAGS.chroot_path, 'icon', 'config', 'fetcher.flags') + with open(fetcher_flags, 'w') as fh: fh.write('--base-url=%(base_url)s --max-images=%(max_images)d\n' % { 'base_url': FLAGS.base_url, '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( '/icon/iconograph/client', os.path.join(FLAGS.chroot_path, 'etc', 'service', 'iconograph-client'))