From 96230945a7c53ad7b17e9b701b7010674a146f89 Mon Sep 17 00:00:00 2001 From: Michael Krotscheck Date: Wed, 20 Apr 2016 15:54:41 -0700 Subject: [PATCH] Added clean exit hooks to npm registry script This patch adds the openstack-registry-hooks project, which will check the current update sequence of the mirror after every package has been downloaded, and exit the process cleanly if the update sequence matches the latest sequence from the registry. This will effectively de-daemonize the registry-static script, assuming that it can update in a reasonable amount of time. Note: When this lands, the index of the registry should be cleaned, and the entire index should be rebuilt. This should not impact the tarballs, only the json files, as shasums are checked before downloading. Change-Id: Ia94187f1f1d60ad2cbb3e71f76502bec75e228ae --- modules/openstack_project/manifests/npm_mirror.pp | 9 +++++++++ modules/openstack_project/templates/npm-mirror-update.sh | 2 +- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/modules/openstack_project/manifests/npm_mirror.pp b/modules/openstack_project/manifests/npm_mirror.pp index 3eefe147bc..b235327307 100644 --- a/modules/openstack_project/manifests/npm_mirror.pp +++ b/modules/openstack_project/manifests/npm_mirror.pp @@ -49,4 +49,13 @@ class openstack_project::npm_mirror ( Class['nodejs'], ] } + + # Common registry hooks + package { 'openstack-registry-hooks': + ensure => '1.1.0', + provider => 'npm', + require => [ + Class['nodejs'], + ] + } } diff --git a/modules/openstack_project/templates/npm-mirror-update.sh b/modules/openstack_project/templates/npm-mirror-update.sh index 61416303b1..dd95e1a8d5 100644 --- a/modules/openstack_project/templates/npm-mirror-update.sh +++ b/modules/openstack_project/templates/npm-mirror-update.sh @@ -17,7 +17,7 @@ set -e CMD="/usr/bin/registry-static" -CMD_ARGS="-d <%= @uri_rewrite %> -o <%= @data_directory %> --blobstore afs-blob-store" +CMD_ARGS="-d <%= @uri_rewrite %> -o <%= @data_directory %> --blobstore afs-blob-store --hooks openstack-registry-hooks" echo "Obtaining npm tokens and running registry-static." k5start -t -f /etc/npm.keytab service/npm -- timeout -k 2m 30m $CMD $CMD_ARGS