ronnix/fabtools — pull request #246 by deanmalmgren (2014-06-17 14:03:14+00:00)
Title: apt_key_exists doesn't work properly

The fabtools.deb.apt_key_exists function only checks for keys matching in `/etc/apt/trusted.gpg`, but when you run fabtools.deb.add_apt_key with this `postgres` key on Ubuntu 12.04 it is actually installed in `/etc/apt/trusted.gpg.d/apt.postgresql.org.gpg`. As a result, this code snippet ends up downloading and reinstalling the apt key every time this it is run.

```python
if not fabtools.deb.apt_key_exists('7FCC7D46ACCC4CF8'):
fabtools.deb.add_apt_key(
url='https://www.postgresql.org/media/keys/ACCC4CF8.asc',
keyid='7FCC7D46ACCC4CF8',
)
fabtools.require.deb.source('postgresql',
'http://apt.postgresql.org/pub/repos/apt/',
'precise-pgdg',
'main')
```

Might be nice to generalize this a bit by having a `fabtools.require.deb.apt_key` function.