logstash/qa/rspec/commands/redhat.rb
Joao Duarte fa0eeb579f add single command release task and other release support tooling
Purpose:

* manage releases through a minimum number of rake tasks
* simplify building of snapshot builds
* create staged artifacts, candidates for releases, that required no changes to become releases
* this means the snapshot release process will not involve publishing gems, therefore:
* the gem artifacts should only be published to rubygems as a final artifact, at the time of GA

Changes:

* release artifacts no longer depend on gems of core components
* all core components are used locally AS-IS to minimize code changes between snapshot, RC and GA
* `versions.yml` describes the versions of all logstash parts and package
  * `rake version:set[version]` manage the yaml file and push the changes to the gemspecs/version.rb files
  * `rake version:set_plugin_api[version]` manage the yaml file and push the changes to the gemspecs/version.rb files
  * `rake artifact:all` generates SNAPSHOT artifacts: tar.gz, zip, rpm, deb
  * `RELEASE=1 rake artifact:all` creates release candidate artifacts + 4 gems: logstash-core, logstash-core-event, logstash-core-event-java and logstash-core-plugin-api

implements #5416 and #5414

Fixes #5460
2016-06-21 12:29:18 +01:00

49 lines
1.2 KiB
Ruby

# encoding: utf-8
require_relative "base"
module ServiceTester
class RedhatCommands < Base
include ::ServiceTester::SystemD
def installed?(hosts, package)
stdout = ""
at(hosts, {in: :serial}) do |host|
cmd = exec!("yum list installed #{package}")
stdout = cmd.stdout
end
stdout.match(/^Installed Packages$/)
stdout.match(/^logstash.noarch/)
end
def package_for(filename, base=ServiceTester::Base::LOCATION)
File.join(base, "#{filename}.rpm")
end
def install(package, host=nil)
hosts = (host.nil? ? servers : Array(host))
errors = {}
at(hosts, {in: :serial}) do |_host|
cmd = sudo_exec!("yum install -y #{package}")
errors[_host] = cmd.stderr unless cmd.stderr.empty?
end
errors
end
def uninstall(package, host=nil)
hosts = (host.nil? ? servers : Array(host))
at(hosts, {in: :serial}) do |_|
sudo_exec!("yum remove -y #{package}")
end
end
def removed?(hosts, package)
stdout = ""
at(hosts, {in: :serial}) do |host|
cmd = sudo_exec!("yum list installed #{package}")
stdout = cmd.stderr
end
stdout.match(/^Error: No matching Packages to list$/)
end
end
end