コード例 #1
0
    def test_install_packages_4050_initramfs(self):
        self.add_commands(
            CommandCaptureCommand(('yum', 'clean', 'all', '--enablerepo=*')),
            CommandCaptureCommand(
                ('repoquery', '--requires', '--enablerepo=myrepo', 'foo'),
                stdout="""/usr/bin/python
python >= 2.4
python(abi) = 2.6
yum >= 3.2.29
/bin/sh
kernel = 2.6.32-279.14.1.el6_lustre
lustre-backend-fs
        """),
            CommandCaptureCommand(
                ('yum', 'install', '-y', '--exclude', 'kernel-debug',
                 '--enablerepo=myrepo', 'foo',
                 'kernel-2.6.32-279.14.1.el6_lustre')),
            CommandCaptureCommand(
                ('grubby', '--default-kernel'),
                stdout='/boot/vmlinuz-2.6.32-504.3.3.el6.x86_64'))

        def isfile(arg):
            return False

        with patch('os.path.isfile', side_effect=isfile):
            self.assertTrue(
                'error' in agent_updates.install_packages(['myrepo'], ['foo']))

        self.assertRanAllCommandsInOrder()
コード例 #2
0
    def test_install_packages_hyd_4050_grubby(self):
        self.add_commands(
            CommandCaptureCommand(("yum", "clean", "all", "--enablerepo=*")),
            CommandCaptureCommand(
                ("repoquery", "--requires", "--enablerepo=myrepo", "foo"),
                stdout="""/usr/bin/python
python >= 2.4
python(abi) = 2.6
yum >= 3.2.29
/bin/sh
kernel = 2.6.32-279.14.1.el6_lustre
lustre-backend-fs
        """,
            ),
            CommandCaptureCommand((
                "yum",
                "install",
                "-y",
                "--exclude",
                "kernel-debug",
                "--enablerepo=myrepo",
                "foo",
                "kernel-2.6.32-279.14.1.el6_lustre",
            )),
            CommandCaptureCommand(("grubby", "--default-kernel"), rc=1),
        )

        def isfile(arg):
            return True

        with patch("os.path.isfile", side_effect=isfile):
            self.assertTrue(
                "error" in agent_updates.install_packages(["myrepo"], ["foo"]))

        self.assertRanAllCommandsInOrder()
コード例 #3
0
    def test_install_packages(self):
        self.add_commands(
            CommandCaptureCommand(('yum', 'clean', 'all', '--enablerepo=*')),
            CommandCaptureCommand(('repoquery', '--requires',
                                   '--enablerepo=myrepo', 'foo', 'bar'),
                                  stdout="""/usr/bin/python
python >= 2.4
python(abi) = 2.6
yum >= 3.2.29
/bin/sh
kernel = 2.6.32-279.14.1.el6_lustre
lustre-backend-fs
        """),
            CommandCaptureCommand(
                ('yum', 'install', '-y', '--exclude', 'kernel-debug',
                 '--enablerepo=myrepo', 'foo', 'bar',
                 'kernel-2.6.32-279.14.1.el6_lustre')),
            CommandCaptureCommand(
                ('grubby', '--default-kernel'),
                stdout='/boot/vmlinuz-2.6.32-504.3.3.el6.x86_64'),
            CommandCaptureCommand(('systemctl', 'start', 'iml-update-check')),
            CommandCaptureCommand(
                ('systemctl', 'is-active', 'iml-update-check')),
        )

        def isfile(arg):
            return True

        with patch('os.path.isfile', side_effect=isfile):
            self.assertEqual(
                agent_updates.install_packages(['myrepo'], ['foo', 'bar']),
                agent_result_ok)

        self.assertRanAllCommandsInOrder()
コード例 #4
0
    def test_install_packages(self):
        self.add_commands(CommandCaptureCommand(('yum', 'clean', 'all', '--enablerepo=*')),
                          CommandCaptureCommand(('repoquery', '--requires', '--enablerepo=myrepo', 'foo', 'bar'),
                                                stdout="""/usr/bin/python
python >= 2.4
python(abi) = 2.6
yum >= 3.2.29
/bin/sh
kernel = 2.6.32-279.14.1.el6_lustre
lustre-backend-fs
        """),
                          CommandCaptureCommand(('yum', 'install', '-y', '--enablerepo=myrepo', 'foo', 'bar', 'kernel-2.6.32-279.14.1.el6_lustre')),
                          CommandCaptureCommand(('yum', 'check-update', '-q', '--disablerepo=*', '--enablerepo=myrepo'), stdout="""
jasper-libs.x86_64                                                                             1.900.1-16.el6_6.3                                                                             myrepo
"""),
                          CommandCaptureCommand(('yum', 'update', '-y', '--enablerepo=myrepo', 'jasper-libs.x86_64')),
                          CommandCaptureCommand(('grubby', '--default-kernel'), stdout='/boot/vmlinuz-2.6.32-504.3.3.el6.x86_64'))

        def isfile(arg):
            return True

        with patch('os.path.isfile', side_effect=isfile):
            self.assertEqual(agent_updates.install_packages(['myrepo'], ['foo', 'bar']), agent_result({}))

        self.assertRanAllCommandsInOrder()
コード例 #5
0
    def test_install_packages_hyd_4050_grubby(self):
        self.add_commands(
            CommandCaptureCommand(('dnf', 'clean', 'all', '--enablerepo=*')),
            CommandCaptureCommand(('dnf', 'repoquery', '--latest-limit', '1',
                                   '--requires', '--enablerepo=myrepo', 'foo'),
                                  stdout="""/usr/bin/python
python >= 2.4
python(abi) = 2.6
yum >= 3.2.29
/bin/sh
kernel = 2.6.32-279.14.1.el6_lustre
lustre-backend-fs
        """),
            CommandCaptureCommand(
                ('dnf', 'install', '--allowerasing', '-y', '--exclude',
                 'kernel-debug', '--enablerepo=myrepo', 'foo',
                 'kernel-2.6.32-279.14.1.el6_lustre')),
            CommandCaptureCommand((
                'dnf', 'repoquery',
                '--queryformat=%{name} %{version}-%{release}.%{arch} %{repoid}',
                '--upgrades', '--disablerepo=*', '--enablerepo=myrepo')),
            CommandCaptureCommand(('grubby', '--default-kernel'), rc=1))

        def isfile(arg):
            return True

        with patch('os.path.isfile', side_effect=isfile):
            self.assertTrue(
                'error' in agent_updates.install_packages(['myrepo'], ['foo']))

        self.assertRanAllCommandsInOrder()
コード例 #6
0
    def test_install_packages(self):
        self.add_commands(
            CommandCaptureCommand(("yum", "clean", "all", "--enablerepo=*")),
            CommandCaptureCommand(
                ("repoquery", "--requires", "--enablerepo=myrepo", "foo",
                 "bar"),
                stdout="""/usr/bin/python
python >= 2.4
python(abi) = 2.6
yum >= 3.2.29
/bin/sh
kernel = 2.6.32-279.14.1.el6_lustre
lustre-backend-fs
        """,
            ),
            CommandCaptureCommand((
                "yum",
                "install",
                "-y",
                "--exclude",
                "kernel-debug",
                "--enablerepo=myrepo",
                "foo",
                "bar",
                "kernel-2.6.32-279.14.1.el6_lustre",
            )),
            CommandCaptureCommand(
                ("grubby", "--default-kernel"),
                stdout="/boot/vmlinuz-2.6.32-504.3.3.el6.x86_64",
            ),
            CommandCaptureCommand(("systemctl", "start", "iml-update-check")),
            CommandCaptureCommand(
                ("systemctl", "is-active", "iml-update-check")),
        )

        def isfile(arg):
            return True

        with patch("os.path.isfile", side_effect=isfile):
            self.assertEqual(
                agent_updates.install_packages(["myrepo"], ["foo", "bar"]),
                agent_result_ok,
            )

        self.assertRanAllCommandsInOrder()
コード例 #7
0
    def test_install_packages_hyd_4050_grubby(self):
        self.add_commands(CommandCaptureCommand(('yum', 'clean', 'all', '--enablerepo=*')),
                          CommandCaptureCommand(('repoquery', '--requires', '--enablerepo=myrepo', 'foo'), stdout="""/usr/bin/python
python >= 2.4
python(abi) = 2.6
yum >= 3.2.29
/bin/sh
kernel = 2.6.32-279.14.1.el6_lustre
lustre-backend-fs
        """),
                          CommandCaptureCommand(('yum', 'install', '-y', '--enablerepo=myrepo', 'foo', 'kernel-2.6.32-279.14.1.el6_lustre')),
                          CommandCaptureCommand(('yum', 'check-update', '-q', '--disablerepo=*', '--enablerepo=myrepo')),
                          CommandCaptureCommand(('grubby', '--default-kernel'), rc=1))

        def isfile(arg):
            return True

        with patch('os.path.isfile', side_effect=isfile):
            self.assertTrue('error' in agent_updates.install_packages(['myrepo'], ['foo']))

        self.assertRanAllCommandsInOrder()