def test_install_single_package(self): fake_run = Mock() with patch(self.to_patch, fake_run): pkg_managers.apt(Mock(), 'vim') result = fake_run.call_args_list[-1] assert 'install' in result[0][-1] assert result[0][-1][-1] == 'vim'
def test_install_multiple_packages(self): fake_run = Mock() with patch(self.to_patch, fake_run): pkg_managers.apt(Mock(), ['vim', 'zsh']) result = fake_run.call_args_list[-1] assert 'install' in result[0][-1] assert result[0][-1][-2:] == ['vim', 'zsh']
def repo_install(distro, repo_name, baseurl, gpgkey, **kw): # do we have specific components to install? # removed them from `kw` so that we don't mess with other defaults # note: when split packages for ceph land for Debian/Ubuntu, `packages` # can be used. Unused for now. packages = kw.pop('components', []) # Get some defaults safe_filename = '%s.list' % repo_name.replace(' ', '-') install_ceph = kw.pop('install_ceph', False) baseurl = baseurl.strip('/') # Remove trailing slashes if gpgkey: remoto.process.run( distro.conn, [ 'wget', '-O', 'release.asc', gpgkey, ], stop_on_nonzero=False, ) remoto.process.run( distro.conn, [ 'apt-key', 'add', 'release.asc' ] ) distro.conn.remote_module.write_sources_list( baseurl, distro.codename, safe_filename ) # set the repo priority for the right domain fqdn = urlparse(baseurl).hostname distro.conn.remote_module.set_apt_priority(fqdn) # repo is not operable until an update pkg_managers.apt_update(distro.conn) if install_ceph: # Before any install, make sure we have `wget` packages = ( 'ceph', 'ceph-mds', 'ceph-common', 'ceph-fs-common', # ceph only recommends gdisk, make sure we actually have # it; only really needed for osds, but minimal collateral 'gdisk', ) pkg_managers.apt(distro.conn, packages) pkg_managers.apt(distro.conn, 'ceph')
def repo_install(distro, repo_name, baseurl, gpgkey, **kw): # Get some defaults safe_filename = '%s.list' % repo_name.replace(' ', '-') install_ceph = kw.pop('install_ceph', False) baseurl = baseurl.strip('/') # Remove trailing slashes if gpgkey: remoto.process.run( distro.conn, [ 'wget', '-O', 'release.asc', gpgkey, ], stop_on_nonzero=False, ) remoto.process.run( distro.conn, [ 'apt-key', 'add', 'release.asc' ] ) distro.conn.remote_module.write_sources_list( baseurl, distro.codename, safe_filename ) # set the repo priority for the right domain fqdn = urlparse(baseurl).hostname distro.conn.remote_module.set_apt_priority(fqdn) # repo is not operable until an update pkg_managers.apt_update(distro.conn) if install_ceph: # Before any install, make sure we have `wget` packages = ( 'ceph', 'ceph-mds', 'ceph-common', 'ceph-fs-common', # ceph only recommends gdisk, make sure we actually have # it; only really needed for osds, but minimal collateral 'gdisk', ) pkg_managers.apt(distro.conn, packages) pkg_managers.apt(distro.conn, 'ceph')
def repo_install(distro, repo_name, baseurl, gpgkey, **kw): # Get some defaults safe_filename = '%s.list' % repo_name.replace(' ', '-') install_ceph = kw.pop('install_ceph', False) baseurl = baseurl.strip('/') # Remove trailing slashes if gpgkey: process.run( distro.conn, [ 'wget', '-O', 'release.asc', gpgkey, ], stop_on_nonzero=False, ) process.run( distro.conn, [ 'apt-key', 'add', 'release.asc' ] ) distro.conn.remote_module.write_sources_list( baseurl, distro.codename, safe_filename ) # repo is not operable until an update pkg_managers.apt_update(distro.conn) if install_ceph: # Before any install, make sure we have `wget` packages = ( 'ceph', 'ceph-mds', 'ceph-common', 'ceph-fs-common', # ceph only recommends gdisk, make sure we actually have # it; only really needed for osds, but minimal collateral 'gdisk', ) pkg_managers.apt(distro.conn, packages) pkg_managers.apt(distro.conn, 'ceph')
def mirror_install(distro, repo_url, gpg_url, adjust_repos, **kw): # note: when split packages for ceph land for Debian/Ubuntu, # `kw['components']` will have those. Unused for now. repo_url = repo_url.strip('/') # Remove trailing slashes gpg_path = gpg_url.split('file://')[-1] if adjust_repos: if not gpg_url.startswith('file://'): remoto.process.run( distro.conn, [ 'wget', '-O', 'release.asc', gpg_url, ], stop_on_nonzero=False, ) gpg_file = 'release.asc' if not gpg_url.startswith('file://') else gpg_path remoto.process.run( distro.conn, [ 'apt-key', 'add', gpg_file, ] ) # set the repo priority for the right domain fqdn = urlparse(repo_url).hostname distro.conn.remote_module.set_apt_priority(fqdn) distro.conn.remote_module.write_sources_list(repo_url, distro.codename) pkg_managers.apt_update(distro.conn) packages = ( 'ceph', 'ceph-mds', 'ceph-common', 'ceph-fs-common', # ceph only recommends gdisk, make sure we actually have # it; only really needed for osds, but minimal collateral 'gdisk', ) pkg_managers.apt(distro.conn, packages) pkg_managers.apt(distro.conn, 'ceph')
def mirror_install(distro, repo_url, gpg_url, adjust_repos): repo_url = repo_url.strip('/') # Remove trailing slashes gpg_path = gpg_url.split('file://')[-1] if adjust_repos: if not gpg_url.startswith('file://'): remoto.process.run( distro.conn, [ 'wget', '-O', 'release.asc', gpg_url, ], stop_on_nonzero=False, ) gpg_file = 'release.asc' if not gpg_url.startswith('file://') else gpg_path remoto.process.run( distro.conn, [ 'apt-key', 'add', gpg_file, ] ) # set the repo priority for the right domain fqdn = urlparse(repo_url).hostname distro.conn.remote_module.set_apt_priority(fqdn) distro.conn.remote_module.write_sources_list(repo_url, distro.codename) pkg_managers.apt_update(distro.conn) packages = ( 'ceph', 'ceph-mds', 'ceph-common', 'ceph-fs-common', # ceph only recommends gdisk, make sure we actually have # it; only really needed for osds, but minimal collateral 'gdisk', ) pkg_managers.apt(distro.conn, packages) pkg_managers.apt(distro.conn, 'ceph')
def mirror_install(distro, repo_url, gpg_url, adjust_repos): repo_url = repo_url.strip('/') # Remove trailing slashes gpg_path = gpg_url.split('file://')[-1] if adjust_repos: if not gpg_url.startswith('file://'): process.run( distro.conn, [ 'wget', '-O', 'release.asc', gpg_url, ], stop_on_nonzero=False, ) gpg_file = 'release.asc' if not gpg_url.startswith('file://') else gpg_path process.run( distro.conn, [ 'apt-key', 'add', gpg_file, ] ) distro.conn.remote_module.write_sources_list(repo_url, distro.codename) # Before any install, make sure we have `wget` pkg_managers.apt_update(distro.conn) packages = ( 'ceph', 'ceph-mds', 'ceph-common', 'ceph-fs-common', # ceph only recommends gdisk, make sure we actually have # it; only really needed for osds, but minimal collateral 'gdisk', ) pkg_managers.apt(distro.conn, packages) pkg_managers.apt(distro.conn, 'ceph')
def install(distro, packages): return pkg_managers.apt(distro.conn, packages)
def install(distro, packages): return pkg_managers.apt( distro.conn, packages )