alphagov/fabric-scripts — pull request #72 by dcarley (2014-10-24 15:55:32+00:00)
Title: Improve puppet_class and deprecate puppet.loadhosts

#### Speed up and reduce output of puppet_class

This was quite slow and produced a lot of output compared to `class` or
`puppet.loadhosts`. The latter takes an array of items, but for consistency
with `class` I think it's probably right to take multiple invocations.

Before:

(fabric)➜ fabric-scripts git:(master) ✗ time fab preview puppet_class:varnish puppet_class:'postgresql::server' puppet_class:'mysql::server' hosts
[cache-1.router.production] Executing task 'puppet_class'
[cache-2.router.production] Executing task 'puppet_class'
[cache-3.router.production] Executing task 'puppet_class'
[cache-1.router.production] Executing task 'puppet_class'
[cache-2.router.production] Executing task 'puppet_class'
[cache-3.router.production] Executing task 'puppet_class'
[mapit-server-1.backend.production] Executing task 'puppet_class'
[mapit-server-2.backend.production] Executing task 'puppet_class'
[postgresql-master-1.backend.production] Executing task 'puppet_class'
[postgresql-slave-1.backend.production] Executing task 'puppet_class'
[puppetmaster-1.management.production] Executing task 'puppet_class'
[transition-postgresql-master-1.backend.production] Executing task 'puppet_class'
[transition-postgresql-slave-1.backend.production] Executing task 'puppet_class'
[cache-1.router.production] Executing task 'hosts'
backup-1.management.production
cache-1.router.production
cache-2.router.production
cache-3.router.production
mapit-server-1.backend.production
mapit-server-2.backend.production
mysql-backup-1.backend.production
mysql-master-1.backend.production
mysql-slave-1.backend.production
postgresql-master-1.backend.production
postgresql-slave-1.backend.production
puppetmaster-1.management.production
support-contacts-1.backend.production
transition-postgresql-master-1.backend.production
transition-postgresql-slave-1.backend.production
whitehall-mysql-backup-1.backend.production
whitehall-mysql-master-1.backend.production
whitehall-mysql-slave-1.backend.production

Done.
Disconnecting from jumpbox.preview.alphagov.co.uk... done.
fab preview puppet_class:varnish puppet_class:'postgresql::server' hosts 0.52s user 0.17s system 8% cpu 8.320 total

After:

(fabric)➜ fabric-scripts git:(improve_puppet_class) ✗ time fab preview puppet_class:varnish puppet_class:'postgresql::server' puppet_class:'mysql::server' hosts
[localhost] Executing task 'puppet_class'
[localhost] Executing task 'puppet_class'
[localhost] Executing task 'puppet_class'
[cache-2.router.production] Executing task 'hosts'
backup-1.management.production
cache-1.router.production
cache-2.router.production
cache-3.router.production
mapit-server-1.backend.production
mapit-server-2.backend.production
mysql-backup-1.backend.production
mysql-master-1.backend.production
mysql-slave-1.backend.production
postgresql-master-1.backend.production
postgresql-slave-1.backend.production
puppetmaster-1.management.production
support-contacts-1.backend.production
transition-postgresql-master-1.backend.production
transition-postgresql-slave-1.backend.production
whitehall-mysql-backup-1.backend.production
whitehall-mysql-master-1.backend.production
whitehall-mysql-slave-1.backend.production

Done.
Disconnecting from jumpbox.preview.alphagov.co.uk... done.
fab preview puppet_class:varnish puppet_class:'postgresql::server' hosts 0.36s user 0.09s system 19% cpu 2.305 total

#### Deprecate puppet.loadhosts for puppet_class

For consistency with the `class` task. I can't find any documentation that
references either, but the deprecation will serve to warn people that I've
taught about using `puppet.loadhosts`.