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)
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)
def downgrade(cls, plugin_path): utils.exec_cmd('yum -y downgrade {0}'.format(plugin_path))
def update(cls, plugin_path): utils.exec_cmd('yum -y update {0}'.format(plugin_path))
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))