diff --git a/lib/beaker/cli.rb b/lib/beaker/cli.rb index d312f27e8..017cd1ae9 100644 --- a/lib/beaker/cli.rb +++ b/lib/beaker/cli.rb @@ -106,7 +106,7 @@ def execute! end # Setup perf monitoring if needed - @perf = Beaker::Perf.new(@hosts, @options) if /(aggressive)|(normal)/.match?(@options[:collect_perf_data].to_s) + @perf = Beaker::Perf.new(@hosts, @options) if /aggressive|normal/.match?(@options[:collect_perf_data].to_s) # pre acceptance phase run_suite(:pre_suite, :fast) @@ -138,7 +138,7 @@ def execute! end # cleanup on error - if /(never)|(onpass)/.match?(@options[:preserve_hosts].to_s) + if /never|onpass/.match?(@options[:preserve_hosts].to_s) @logger.notify "Cleanup: cleaning up after failed run" @network_manager.cleanup if @network_manager else @@ -159,7 +159,7 @@ def execute! end # cleanup on success - if /(never)|(onfail)/.match?(@options[:preserve_hosts].to_s) + if /never|onfail/.match?(@options[:preserve_hosts].to_s) @logger.notify "Cleanup: cleaning up after successful run" @network_manager.cleanup if @network_manager else diff --git a/lib/beaker/host.rb b/lib/beaker/host.rb index 8bb729897..1b104cf47 100644 --- a/lib/beaker/host.rb +++ b/lib/beaker/host.rb @@ -489,11 +489,7 @@ def do_rsync_to from_path, to_path, opts = {} # We enable achieve mode and compression rsync_args << "-az" - user = if not self['user'] - "root" - else - self['user'] - end + user = self['user'] || 'root' hostname_with_user = "#{user}@#{reachable_name}" Rsync.host = hostname_with_user diff --git a/lib/beaker/platform.rb b/lib/beaker/platform.rb index f83b39d8c..4cb90626f 100644 --- a/lib/beaker/platform.rb +++ b/lib/beaker/platform.rb @@ -117,9 +117,7 @@ def to_array # @example Platform.new('debian-7-xxx').with_version_codename == 'debian-wheezy-xxx' # @return [String] the platform string with the platform version represented as a codename def with_version_codename - version_array = [@variant, @version, @arch] - version_array = [@variant, @codename, @arch] if @codename - return version_array.join('-') + [@variant, @codename || @version, @arch].join('-') end # Returns the platform string with the platform version as a number. If no conversion is necessary