From: Peter Palfrader Date: Sat, 8 Dec 2012 17:09:46 +0000 (+0100) Subject: Ship list of mirrors with puppet too X-Git-Url: https://git.adam-barratt.org.uk/?a=commitdiff_plain;h=5a0eade9f4a8531e7394b19ddaad072e8f38692d;p=mirror%2Fdsa-puppet.git Ship list of mirrors with puppet too --- diff --git a/modules/roles/files/static-mirroring/static-master-run b/modules/roles/files/static-mirroring/static-master-run index 24ea3e11b..0d7003d45 100755 --- a/modules/roles/files/static-mirroring/static-master-run +++ b/modules/roles/files/static-mirroring/static-master-run @@ -15,9 +15,12 @@ subdirs = { 'master': 'master', # where updates from off-site end up going serialname = '.serial' clients = [] -with open('/home/staticsync/etc/static-clients') as f: +with open('/etc/static-clients.conf') as f: for line in f: - clients.append(line.strip()) + line = line.strip() + if line == "": continue + if line.startswith('#'): continue + clients.append(line) def log(m): t = time.strftime("[%Y-%m-%d %H:%M:%S]", time.gmtime()) diff --git a/modules/roles/files/static-mirroring/static-master-update-component b/modules/roles/files/static-mirroring/static-master-update-component index 64bca4928..2f1742bec 100755 --- a/modules/roles/files/static-mirroring/static-master-update-component +++ b/modules/roles/files/static-mirroring/static-master-update-component @@ -29,7 +29,7 @@ # OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -componentlist=/home/staticsync/etc/static-components +componentlist=/etc/static-components.conf base=/home/staticsync/static-master/master set -e diff --git a/modules/roles/manifests/static_master.pp b/modules/roles/manifests/static_master.pp index bb722be7d..4f982bd39 100644 --- a/modules/roles/manifests/static_master.pp +++ b/modules/roles/manifests/static_master.pp @@ -19,6 +19,9 @@ class roles::static_master inherits roles::static_base { '/etc/static-components.conf': source => "puppet:///modules/roles/static-mirroring/static-components.conf", ; + '/etc/static-clients.conf': + content => template('roles/static-clients.conf.erb'), + ; } } # vim:set et: diff --git a/modules/roles/templates/static-clients.conf.erb b/modules/roles/templates/static-clients.conf.erb new file mode 100644 index 000000000..edbf31365 --- /dev/null +++ b/modules/roles/templates/static-clients.conf.erb @@ -0,0 +1,19 @@ +## +## THIS FILE IS UNDER PUPPET CONTROL. DON'T EDIT IT HERE. +## + +<%= + +mirrors = [] +scope.lookupvar('site::localinfo').keys.sort.each do |node| + if scope.lookupvar('site::localinfo')[node]['static_mirror'] + mirrors << node + end +end + + +mirrors.join("\n") +# vim:set et: +# vim:set sts=4 ts=4: +# vim:set shiftwidth=4: +%>