Ejemplo n.º 1
0
    def install_packages(self,
                         java_version='openjdk-11-headless',
                         packages=[]):
        """Installs openjdk and extra packages requested."""

        apt_update()
        apt_install(self.PACKAGE_LIST[java_version] + self.EXTRA_PACKAGES +
                    packages)
Ejemplo n.º 2
0
    def test_installs_apt_packages_as_string(self, log, mock_call):
        packages = 'foo bar'
        options = ['--foo', '--bar']

        fetch.apt_install(packages, options)

        mock_call.assert_called_with([
            'apt-get', '--assume-yes', '--foo', '--bar', 'install', 'foo bar'
        ],
                                     env={})
Ejemplo n.º 3
0
    def test_installs_apt_packages_without_options(self, log, mock_call):
        packages = ['foo', 'bar']

        fetch.apt_install(packages)

        mock_call.assert_called_with([
            'apt-get', '--assume-yes',
            '--option=Dpkg::Options::=--force-confold', 'install', 'foo', 'bar'
        ],
                                     env={})
Ejemplo n.º 4
0
 def _on_install(self, _):
     """Install packages"""
     self.unit.status = MaintenanceStatus("Installing packages")
     # os_brick lib needs systool from sysfsutils to be able to retrieve
     # the data from FC links:
     # https://github.com/openstack/os-brick/blob/ \
     #     1b2e2295421615847d86508dcd487ec51fa45f25/ \
     #     os_brick/initiator/linuxfc.py#L151
     apt_install(['python3-3parclient', 'sysfsutils'])
     self.unit.status = ActiveStatus("Unit is ready")
Ejemplo n.º 5
0
    def test_installs_apt_packages_as_string(self, log, mock_call):
        packages = 'foo bar'
        options = ['--foo', '--bar']

        fetch.apt_install(packages, options)

        mock_call.assert_called_with(
            ['apt-get', '--assume-yes',
             '--foo', '--bar', 'install', 'foo bar'],
            env=getenv({'DEBIAN_FRONTEND': 'noninteractive'}))
Ejemplo n.º 6
0
    def test_installs_apt_packages_without_options(self, log, mock_call):
        packages = ['foo', 'bar']

        fetch.apt_install(packages)

        mock_call.assert_called_with(
            ['apt-get', '--assume-yes',
             '--option=Dpkg::Options::=--force-confold',
             'install', 'foo', 'bar'],
            env=getenv({'DEBIAN_FRONTEND': 'noninteractive'}))
Ejemplo n.º 7
0
def install():
    hookenv.log('Installing gitlab-runner')
    ubuntu.apt_install(ubuntu.filter_installed_packages(['docker.io']))
    docker.run_container()
    hookenv.log('Started gitlab-runner container')
    templating.render(source='update-gitlab-runner.sh',
                      target='/etc/cron.daily/update-gitlab-runner.sh',
                      context={},
                      perms=0o755,
                      owner='root',
                      group='root')
Ejemplo n.º 8
0
    def test_installs_apt_packages_with_possible_errors(self, log, check_call):
        packages = ['foo', 'bar']
        options = ['--foo', '--bar']

        fetch.apt_install(packages, options, fatal=True)

        check_call.assert_called_with([
            'apt-get', '--assume-yes', '--foo', '--bar', 'install', 'foo',
            'bar'
        ],
                                      env={})
Ejemplo n.º 9
0
    def test_installs_apt_packages_with_possible_errors(self, log,
                                                        check_call):
        packages = ['foo', 'bar']
        options = ['--foo', '--bar']

        fetch.apt_install(packages, options, fatal=True)

        check_call.assert_called_with(
            ['apt-get', '--assume-yes',
             '--foo', '--bar', 'install', 'foo', 'bar'],
            env=getenv({'DEBIAN_FRONTEND': 'noninteractive'}))