Run client.py instead of fetch_and_update on the client

This commit is contained in:
Ian Gulliver
2016-05-09 22:58:25 +00:00
parent a1a1a4e822
commit 5d30642816
2 changed files with 22 additions and 9 deletions

View File

@@ -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}

View File

@@ -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'))