Пример #1
0
    def add_deb_repository():
        repository_names = {
            ('ubuntu', '16.04'): 'ubuntu-xenial',
            ('ubuntu', '15.10'): 'ubuntu-wily',
            # Dropped Ubuntu 15.04 Vivid Vervet
            # Dropped Ubuntu 14.10 Utopic Unicorn
            ('ubuntu', '14.04'): 'ubuntu-trusty',
            ('debian', 'sid'): 'debian-stretch',
            ('debian', 'testing'): 'debian-stretch',
            ('debian', '9'): 'debian-stretch',
            ('debian', '8'): 'debian-jessie',
            # Dropped Debian 7 Wheezy
        }

        repo = repository_names.get((get_distro(), get_version()), None)
        if repo is None:
            # FIXME: warn/error
            repo = repository_names.get(('debian', 'sid'))

        apt_key = APTKey()
        apt_repo = APTRepo()

        apt_key.recv_keys('58118E89F3A912897C070ADBF76221572C52609D')
        apt_repo.add_repo('deb https://apt.dockerproject.org/repo ' + repo + ' main')
Пример #2
0
 def test_recv_keys_should_call_popen(self):
     with patch('genes.process.process.Popen') as mock_popen:
         APTKey.recv_keys('test')
         mock_popen.assert_called_once_with(
                 ('apt-key', 'adv', '--keyserver', 'hkp://pgp.mit.edu:80', '--recv-keys', 'test')
         )