Exemple #1
0
 def install(cls, plugin_path, force=False):
     if force:
         utils.exec_cmd(
             'yum -y install {0} || yum -y reinstall {0}'
             .format(plugin_path))
     else:
         utils.exec_cmd('yum -y install {0}'.format(plugin_path))
    def test_exec_cmd(self):
        cmd = "some command"

        process_mock = self.make_process_mock()
        with mock.patch.object(subprocess, "Popen", return_value=process_mock) as popen_mock:
            utils.exec_cmd(cmd)

        popen_mock.assert_called_once_with(cmd, stdout=None, stderr=subprocess.STDOUT, shell=True, cwd=None)
Exemple #3
0
 def install(cls, plugin_path, force=False):
     if force:
         utils.exec_cmd(
             'yum -y install --disablerepo=\'*\' {0} || '
             'yum -y reinstall --disablerepo=\'*\' {0}'
             .format(plugin_path))
     else:
         utils.exec_cmd('yum -y install --disablerepo=\'*\' {0}'
                        .format(plugin_path))
    def test_exec_cmd(self):
        cmd = 'some command'

        process_mock = self.make_process_mock()
        with mock.patch.object(subprocess, 'Popen',
                               return_value=process_mock) as popen_mock:
            utils.exec_cmd(cmd)

        popen_mock.assert_called_once_with(cmd,
                                           stdout=None,
                                           stderr=subprocess.STDOUT,
                                           shell=True,
                                           cwd=None)
Exemple #5
0
 def downgrade(cls, plugin_path):
     utils.exec_cmd('yum -y downgrade {0}'.format(plugin_path))
Exemple #6
0
 def update(cls, plugin_path):
     utils.exec_cmd('yum -y update {0}'.format(plugin_path))
Exemple #7
0
 def remove(cls, name, version):
     rpm_name = '{0}-{1}'.format(name, utils.major_plugin_version(version))
     utils.exec_cmd('yum -y remove {0}'.format(rpm_name))
Exemple #8
0
 def downgrade(cls, plugin_path):
     utils.exec_cmd('yum -y downgrade {0}'.format(plugin_path))
Exemple #9
0
 def update(cls, plugin_path):
     utils.exec_cmd('yum -y update {0}'.format(plugin_path))
Exemple #10
0
 def remove(cls, name, version):
     rpm_name = '{0}-{1}'.format(name, utils.major_plugin_version(version))
     utils.exec_cmd('yum -y remove {0}'.format(rpm_name))