beaker 3.37.0 → 4.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (63) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +32 -1
  3. data/acceptance/lib/helpers/test_helper.rb +0 -28
  4. data/acceptance/pre_suite/subcommands/08_install_beaker.rb +1 -1
  5. data/acceptance/tests/base/dsl/helpers/host_helpers/backup_the_file_test.rb +9 -9
  6. data/acceptance/tests/base/dsl/helpers/host_helpers/create_remote_file_test.rb +106 -103
  7. data/acceptance/tests/base/dsl/helpers/host_helpers/curl_on_test.rb +2 -2
  8. data/acceptance/tests/base/dsl/helpers/host_helpers/install_package_test.rb +1 -50
  9. data/acceptance/tests/base/dsl/helpers/host_helpers/retry_on_test.rb +3 -3
  10. data/acceptance/tests/base/dsl/helpers/host_helpers/rsync_to_test.rb +71 -27
  11. data/acceptance/tests/base/dsl/helpers/host_helpers/scp_from_test.rb +3 -3
  12. data/acceptance/tests/base/dsl/helpers/host_helpers/scp_to_test.rb +3 -3
  13. data/acceptance/tests/base/host/file_test.rb +81 -0
  14. data/beaker.gemspec +6 -14
  15. data/docs/how_to/install_puppet.md +2 -0
  16. data/docs/how_to/the_beaker_dsl.md +150 -150
  17. data/docs/how_to/upgrade_from_3_to_4.md +52 -0
  18. data/lib/beaker.rb +0 -10
  19. data/lib/beaker/dsl.rb +7 -0
  20. data/lib/beaker/dsl/helpers.rb +4 -6
  21. data/lib/beaker/dsl/helpers/host_helpers.rb +10 -34
  22. data/lib/beaker/dsl/install_utils.rb +0 -5
  23. data/lib/beaker/dsl/roles.rb +1 -1
  24. data/lib/beaker/host.rb +12 -11
  25. data/lib/beaker/host/aix/file.rb +2 -2
  26. data/lib/beaker/host/aix/group.rb +1 -0
  27. data/lib/beaker/host/aix/user.rb +1 -0
  28. data/lib/beaker/host/freebsd/pkg.rb +9 -0
  29. data/lib/beaker/host/mac/group.rb +1 -0
  30. data/lib/beaker/host/mac/user.rb +8 -13
  31. data/lib/beaker/host/pswindows/file.rb +2 -2
  32. data/lib/beaker/host/pswindows/group.rb +1 -0
  33. data/lib/beaker/host/pswindows/user.rb +1 -0
  34. data/lib/beaker/host/unix/exec.rb +5 -5
  35. data/lib/beaker/host/unix/file.rb +43 -2
  36. data/lib/beaker/host/unix/group.rb +1 -0
  37. data/lib/beaker/host/unix/user.rb +1 -0
  38. data/lib/beaker/host/windows/file.rb +32 -2
  39. data/lib/beaker/host/windows/group.rb +1 -0
  40. data/lib/beaker/host/windows/user.rb +1 -0
  41. data/lib/beaker/host_prebuilt_steps.rb +0 -4
  42. data/lib/beaker/hypervisor.rb +1 -5
  43. data/lib/beaker/result.rb +4 -0
  44. data/lib/beaker/version.rb +1 -1
  45. data/spec/beaker/dsl/helpers/host_helpers_spec.rb +14 -51
  46. data/spec/beaker/dsl/wrappers_spec.rb +0 -46
  47. data/spec/beaker/host/mac/user_spec.rb +5 -8
  48. data/spec/beaker/host/unix/exec_spec.rb +1 -1
  49. data/spec/beaker/host/unix/file_spec.rb +39 -0
  50. data/spec/beaker/host/windows/file_spec.rb +55 -0
  51. data/spec/beaker/host_prebuilt_steps_spec.rb +16 -67
  52. data/spec/beaker/host_spec.rb +10 -14
  53. data/spec/beaker/hypervisor/hypervisor_spec.rb +1 -1
  54. metadata +47 -165
  55. data/acceptance/lib/beaker/acceptance/install_utils.rb +0 -58
  56. data/acceptance/tests/base/dsl/helpers/host_helpers/create_tmpdir_on_test.rb +0 -68
  57. data/acceptance/tests/base/dsl/install_utils/clone_git_repo_on_test.rb +0 -49
  58. data/lib/beaker/dsl/helpers/facter_helpers.rb +0 -57
  59. data/lib/beaker/dsl/install_utils/pe_defaults.rb +0 -143
  60. data/lib/beaker/dsl/install_utils/windows_utils.rb +0 -223
  61. data/spec/beaker/dsl/ezbake_utils_spec.rb +0 -279
  62. data/spec/beaker/dsl/install_utils/pe_defaults_spec.rb +0 -61
  63. data/spec/beaker/dsl/install_utils/windows_utils_spec.rb +0 -263
@@ -0,0 +1,52 @@
1
+ # How To Upgrade from 3.y to 4.0
2
+
3
+ This is a guide detailing all the issues to be aware of, and to help people make any changes that you might need to move from beaker 2.y to 3.0. To test out beaker 4.0.0, we recommend implementing the strategy outlined [here](test_arbitrary_beaker_versions.md) to ensure this new major release does not break your existing testing.
4
+
5
+ ## PE Dependency
6
+
7
+ In Beaker 3.0.0, `beaker-pe` was removed as a dependency. A mechanism to automatically include that module, if available, was added for convenience and to ease the transition. That shim has been removed. As of 4.0, you will have to explicitly require `beaker-pe` alongside `beaker` as a dependency in your project if you need it in your tests. You'll also need to add `require 'beaker-pe'` to any tests that use it.
8
+
9
+ ## `PEDefaults` and `#configure_type_defaults_on`
10
+
11
+ PEDefaults has been moved to `beaker-pe`. The call to `#configure_type_defaults_on` that was previously made in `#set_env` is no longer made. You will now need to explicitly call `#configure_type_defaults_on` in your tests when needed.
12
+
13
+ ## Puppet Dependency
14
+
15
+ Just like `beaker-pe` was removed as a dependency in 3.0, we have removed `beaker-puppet` as a dependency in 4.0. This means that you will have to explicitly require `beaker-puppet` alongside `beaker` as a dependency in your project if you need it in your tests. You'll also need to add `require 'beaker-puppet'` to any of your tests that use it.
16
+
17
+ ## Hypervisor Loading
18
+
19
+ We have also removed the explicit dependency on all previously-included hypervisor libraries. Don't worry, the transition should be easy.
20
+
21
+ In order to use a specific hypervisor or DSL extension library in your project, you will need to include them alongside Beaker in your Gemfile or project.gemspec. E.g.
22
+
23
+ ~~~ruby
24
+ # Gemfile
25
+ gem 'beaker', '~>4.0'
26
+ gem 'beaker-aws'
27
+ # project.gemspec
28
+ s.add_runtime_dependency 'beaker', '~>4.0'
29
+ s.add_runtime_dependency 'beaker-aws'
30
+ ~~~
31
+
32
+ Beaker will automatically load the appropriate hypervisors for any given hosts file, so as long as your project dependencies are satisfied there's nothing else to do. No need to `require` this library in your tests. Simply specify `hypervisor: hypervisor_name` in your hosts file.
33
+
34
+ The following hypervisor libraries were removed in 4.0:
35
+
36
+ - [beaker-abs](github.com/puppetlabs/beaker-abs)
37
+ - [beaker-aws](github.com/puppetlabs/beaker-aws)
38
+ - [beaker-docker](github.com/puppetlabs/beaker-docker)
39
+ - [beaker-google](github.com/puppetlabs/beaker-google)
40
+ - [beaker-openstack](github.com/puppetlabs/beaker-openstack)
41
+ - [beaker-vagrant](github.com/puppetlabs/beaker-vagrant)
42
+ - [beaker-vcloud](github.com/puppetlabs/beaker-vcloud)
43
+ - [beaker-vmpooler](github.com/puppetlabs/beaker-vmpooler)
44
+ - [beaker-vmware](github.com/puppetlabs/beaker-vmware)
45
+
46
+ For acceptance testing, beaker-vmpooler, beaker-aws, and beaker-abs have been retained as development dependencies. These will be removed as the CI pipelines is upgraded, so *do not rely on them being there for your project*.
47
+
48
+ ## `Host.rsync_to` and Rsync-dependent Methods
49
+
50
+ The `Host.rsync_to()` method has been overhauled, fixing a number of lingering issues and edge cases including [BKR-462](http://tickets.puppetlabs.com/browse/BKR-462) and [BKR-463](http://tickets.puppetlabs.com/browse/BKR-463). When a call to `rsync_to` fails for any reason, Beaker will throw `CommandFailure` as standard, including an error message from the Rsync library. The two primary causes for previously silent Rsync failures are Rsync not installed on remote host (which caused failures on Windows, as well as hosts without Rsync installed by default) and remote path not existing, both documented in the linked tickets.
51
+
52
+ However, it is important to note that any error causing Rsync to fail, including SSH transport errors and hostname mismatches, will throw `CommandFailure` for `rsync_to` *and any method that relies on `rsync_to` including `create_remote_file_on()`*. If the remote file is not created for any reason, the command will fail.
@@ -45,14 +45,4 @@ module Beaker
45
45
  rescue LoadError
46
46
  # do nothing
47
47
  end
48
-
49
- # If beaker-pe is available, pull it in. The gem beaker-pe will need to be
50
- # specified in the project Gemfile independent of beaker itself. If not available,
51
- # catch LoadError and continue.
52
- begin
53
- require 'beaker-pe'
54
- rescue LoadError
55
- # do nothing
56
- end
57
-
58
48
  end
@@ -83,6 +83,13 @@ module Beaker
83
83
 
84
84
  def self.register(helper_module)
85
85
  include helper_module
86
+
87
+ # Modules added into a module which has previously been included are not
88
+ # retroactively included in the including class. Do this here so we don't
89
+ # have to in every DSL extension library.
90
+ #
91
+ # https://github.com/adrianomitre/retroactive_module_inclusion
92
+ Beaker::TestCase.class_eval { include Beaker::DSL }
86
93
  end
87
94
  end
88
95
  end
@@ -3,13 +3,13 @@
3
3
  require "beaker/dsl/helpers/#{lib}_helpers"
4
4
  end
5
5
 
6
- require "beaker-hiera"
7
- require 'beaker-puppet'
8
6
  module Beaker
9
7
  module DSL
10
8
 
11
- # Contains methods to help you manage and configure your SUTs and configure and interact with puppet, facter
12
- # and hiera.
9
+ # Contains methods to help you manage and configure your SUTs.
10
+
11
+ # Extensions, available in separate modules, enable you to configure and interact with puppet, facter
12
+ # and hiera. See [the docs](/docs/how_to/the_beaker_dsl.md).
13
13
 
14
14
  # To mix this is into a class you need the following:
15
15
  # * a method *hosts* that yields any hosts implementing
@@ -28,8 +28,6 @@ module Beaker
28
28
  include Beaker::DSL::Helpers::TestHelpers
29
29
  include Beaker::DSL::Helpers::WebHelpers
30
30
  include Beaker::DSL::Helpers::HoconHelpers
31
- include Beaker::DSL::Helpers::Hiera
32
- include BeakerPuppet::Helpers
33
31
  end
34
32
  end
35
33
  end
@@ -394,6 +394,16 @@ module Beaker
394
394
  host.install_package package_name, '', package_version
395
395
  end
396
396
 
397
+ # Uninstall a package on a host
398
+ #
399
+ # @param [Host] host A host object
400
+ # @param [String] package_name Name of the package to uninstall
401
+ #
402
+ # @return [Result] An object representing the outcome of *uninstall command*.
403
+ def uninstall_package host, package_name
404
+ host.uninstall_package package_name
405
+ end
406
+
397
407
  # Check to see if a package is installed on a remote host
398
408
  #
399
409
  # @param [Host] host A host object
@@ -558,40 +568,6 @@ module Beaker
558
568
  end
559
569
  end
560
570
 
561
- # Create a temp directory on remote host owned by specified user.
562
- #
563
- # @param [Host, Array<Host>, String, Symbol] host One or more hosts to act upon,
564
- # or a role (String or Symbol) that identifies one or more hosts.
565
- # @param [String] path_prefix A remote path prefix for the new temp
566
- # directory.
567
- # @param [String] user The name of user that should own the temp
568
- # directory. If no username is specified defaults to the currently logged in user
569
- # per host
570
- #
571
- # @return [String, Array<String>] Returns the name of the newly-created dir, or an array
572
- # of names of newly-created dirs per-host
573
- def create_tmpdir_on(host, path_prefix = '', user=nil)
574
-
575
- block_on host do | host |
576
- # use default user logged into this host
577
- if not user
578
- user = host['user']
579
- end
580
-
581
- if not on(host, "getent passwd #{user}").exit_code == 0
582
- raise "User #{user} does not exist on #{host}."
583
- end
584
-
585
- if defined? host.tmpdir
586
- dir = host.tmpdir(path_prefix)
587
- on host, "chown #{user}:#{user} #{dir}"
588
- dir
589
- else
590
- raise "Host platform not supported by `create_tmpdir_on`."
591
- end
592
- end
593
- end
594
-
595
571
  # 'echo' the provided value on the given host(s)
596
572
  # @param [Host, Array<Host>, String, Symbol] hosts One or more hosts to act upon,
597
573
  # or a role (String or Symbol) that identifies one or more hosts.
@@ -1,12 +1,7 @@
1
- require "beaker/dsl/install_utils/pe_defaults"
2
- require 'beaker-puppet'
3
-
4
1
  module Beaker
5
2
  module DSL
6
3
  # Collection of installation methods and support
7
4
  module InstallUtils
8
- include DSL::InstallUtils::PEDefaults
9
- include BeakerPuppet::InstallUtils
10
5
  end
11
6
  end
12
7
  end
@@ -139,7 +139,7 @@ module Beaker
139
139
  return !version_is_less(version, '4.0') if version && !version.empty?
140
140
  end
141
141
  return true if host[:roles] && host[:roles].include?('aio')
142
- return true if host[:type] && !!(host[:type] =~ /(\A|-)aio(\Z|-)/ )
142
+ return true if host[:type] && !!(host[:type] =~ /(\A|-)(aio|git)(\Z|-)/ )
143
143
  false
144
144
  end
145
145
 
@@ -502,6 +502,8 @@ module Beaker
502
502
  # @param to_path [String] The destination path on the host
503
503
  # @param opts [Hash{Symbol=>String}] Options to alter execution
504
504
  # @option opts [Array<String>] :ignore An array of file/dir paths that will not be copied to the host
505
+ # @raise [Beaker::Host::CommandFailure] With Rsync error (if available)
506
+ # @return [Rsync::Result] Rsync result with status code
505
507
  def do_rsync_to from_path, to_path, opts = {}
506
508
  ssh_opts = self['ssh']
507
509
  rsync_args = []
@@ -532,18 +534,15 @@ module Beaker
532
534
  ssh_opts.has_key?('auth_methods') and
533
535
  ssh_opts['auth_methods'].include?('publickey')
534
536
 
535
- key = ssh_opts['keys']
536
-
537
- # If an array was set, then we use the first value
538
- if key.is_a? Array
539
- key = key.first
537
+ # find the first SSH key that exists
538
+ key = Array(ssh_opts['keys']).find do |k|
539
+ File.exist?(k)
540
540
  end
541
541
 
542
- # We need to expand tilde manually as rsync can be
543
- # funny sometimes
544
- key = File.expand_path(key)
545
-
546
- ssh_args << "-i #{key}"
542
+ if key
543
+ # rsync doesn't always play nice with tilde, so be sure to expand first
544
+ ssh_args << "-i #{File.expand_path(key)}"
545
+ end
547
546
  end
548
547
  end
549
548
 
@@ -571,7 +570,9 @@ module Beaker
571
570
  @logger.notify "rsync: localhost:#{from_path} to #{hostname_with_user}:#{to_path} {:ignore => #{opts[:ignore]}}"
572
571
  result = Rsync.run(from_path, to_path, rsync_args)
573
572
  @logger.debug("rsync returned #{result.inspect}")
574
- result
573
+
574
+ return result if result.success?
575
+ raise Beaker::Host::CommandFailure, result.error
575
576
  end
576
577
 
577
578
  end
@@ -1,11 +1,11 @@
1
1
  module Aix::File
2
2
  include Beaker::CommandFactory
3
3
 
4
- def tmpfile(name)
4
+ def tmpfile(name = '')
5
5
  execute("rndnum=${RANDOM} && touch /tmp/#{name}.${rndnum} && echo /tmp/#{name}.${rndnum}")
6
6
  end
7
7
 
8
- def tmpdir(name)
8
+ def tmpdir(name = '')
9
9
  execute("rndnum=${RANDOM} && mkdir /tmp/#{name}.${rndnum} && echo /tmp/#{name}.${rndnum}")
10
10
  end
11
11
 
@@ -14,6 +14,7 @@ module Aix::Group
14
14
  fail_test "failed to get group #{name}" unless result.stdout =~ /^#{name} id/
15
15
 
16
16
  yield result if block_given?
17
+ result
17
18
  end
18
19
  end
19
20
 
@@ -19,6 +19,7 @@ module Aix::User
19
19
  fail_test "failed to get user #{name}" unless result.stdout =~ /^#{name} id/
20
20
 
21
21
  yield result if block_given?
22
+ result
22
23
  end
23
24
  end
24
25
 
@@ -25,6 +25,15 @@ module FreeBSD::Pkg
25
25
  execute(cmd, opts) { |result| result }
26
26
  end
27
27
 
28
+ def uninstall_package(package, cmdline_args = nil, opts = {})
29
+ cmd = if pkgng_active?
30
+ "pkg delete #{cmdline_args || '-y'} #{package}"
31
+ else
32
+ "pkg_delete #{cmdline_args || '-r'} #{package}"
33
+ end
34
+ execute(cmd, opts) { |result| result }
35
+ end
36
+
28
37
  def check_for_package(package, opts = {})
29
38
  opts = {:accept_all_exit_codes => true}.merge(opts)
30
39
  cmd = if pkgng_active?
@@ -39,6 +39,7 @@ module Mac::Group
39
39
  answer = "#{gi[:name]}:#{gi[:password]}:#{gi[:gid]}"
40
40
 
41
41
  yield answer if block_given?
42
+ answer
42
43
  end
43
44
  end
44
45
 
@@ -21,28 +21,23 @@ module Mac::User
21
21
 
22
22
  # Gets the user information in /etc/passwd format
23
23
  #
24
+ # @note Calls POSIX-compliant `$ id -P <user>` to get /etc/passwd-style
25
+ # output
26
+ #
24
27
  # @param [String] name Name of the user
25
28
  # @param [Proc] block Additional actions or insertions
26
29
  #
27
- # @yield [String] The actual mac dscacheutil output
28
- # @return [String] User information in /etc/passwd format
30
+ # @yield [Result] User information in /etc/passwd format
31
+ # @return [Result] User information in /etc/passwd format
29
32
  # @raise [FailTest] Raises an Assertion failure if it can't find the name
30
33
  # queried for in the returned block
31
34
  def user_get(name, &block)
32
- answer = ""
33
- execute("dscacheutil -q user -a name #{name}") do |result|
34
- fail_test "failed to get user #{name}" unless result.stdout =~ /^name: #{name}/
35
- ui = Hash.new # user info
36
- result.stdout.each_line { |line|
37
- pieces = line.split(': ')
38
- ui[pieces[0].to_sym] = pieces[1].strip if pieces[1] != nil
39
- }
40
- answer = "#{ui[:name]}:#{ui[:password]}:#{ui[:uid]}:#{ui[:gid]}:"
41
- answer << "#{ui[:name]}:#{ui[:dir]}:#{ui[:shell]}"
35
+ execute("id -P #{name}") do |result|
36
+ fail_test "failed to get user #{name}" unless result.stdout =~ /^#{name}:/
42
37
 
43
38
  yield result if block_given?
39
+ result
44
40
  end
45
- answer
46
41
  end
47
42
 
48
43
  # Makes sure the user is present, creating them if necessary
@@ -1,12 +1,12 @@
1
1
  module PSWindows::File
2
2
  include Beaker::CommandFactory
3
3
 
4
- def tmpfile(name)
4
+ def tmpfile(name = '')
5
5
  result = exec(powershell('[System.IO.Path]::GetTempFileName()'))
6
6
  result.stdout.chomp()
7
7
  end
8
8
 
9
- def tmpdir(name)
9
+ def tmpdir(name = '')
10
10
  result = exec(powershell('[System.IO.Path]::GetTempPath()'))
11
11
  result.stdout.chomp()
12
12
  end
@@ -19,6 +19,7 @@ module PSWindows::Group
19
19
  fail_test "failed to get group #{name}" if result.exit_code != 0
20
20
 
21
21
  yield result if block_given?
22
+ result
22
23
  end
23
24
  end
24
25
 
@@ -19,6 +19,7 @@ module PSWindows::User
19
19
  fail_test "failed to get user #{name}" if result.exit_code != 0
20
20
 
21
21
  yield result if block_given?
22
+ result
22
23
  end
23
24
  end
24
25
 
@@ -189,25 +189,25 @@ module Unix::Exec
189
189
  def ssh_permit_user_environment
190
190
  case self['platform']
191
191
  when /debian|ubuntu|cumulus|huaweios|archlinux/
192
- directory = create_tmpdir_on(self)
192
+ directory = tmpdir()
193
193
  exec(Beaker::Command.new("echo 'PermitUserEnvironment yes' | cat - /etc/ssh/sshd_config > #{directory}/sshd_config.permit"))
194
194
  exec(Beaker::Command.new("mv #{directory}/sshd_config.permit /etc/ssh/sshd_config"))
195
195
  when /el-7|centos-7|redhat-7|oracle-7|scientific-7|eos-7/
196
- directory = create_tmpdir_on(self)
196
+ directory = tmpdir()
197
197
  exec(Beaker::Command.new("echo 'PermitUserEnvironment yes' | cat - /etc/ssh/sshd_config > #{directory}/sshd_config.permit"))
198
198
  exec(Beaker::Command.new("mv #{directory}/sshd_config.permit /etc/ssh/sshd_config"))
199
199
  when /el-|centos|fedora|redhat|oracle|scientific|eos/
200
- directory = create_tmpdir_on(self)
200
+ directory = tmpdir()
201
201
  exec(Beaker::Command.new("echo 'PermitUserEnvironment yes' | cat - /etc/ssh/sshd_config > #{directory}/sshd_config.permit"))
202
202
  exec(Beaker::Command.new("mv #{directory}/sshd_config.permit /etc/ssh/sshd_config"))
203
203
  when /sles/
204
- directory = create_tmpdir_on(self)
204
+ directory = tmpdir()
205
205
  exec(Beaker::Command.new("echo 'PermitUserEnvironment yes' | cat - /etc/ssh/sshd_config > #{directory}/sshd_config.permit"))
206
206
  exec(Beaker::Command.new("mv #{directory}/sshd_config.permit /etc/ssh/sshd_config"))
207
207
  when /solaris/
208
208
  # kept solaris here because refactoring it into its own Host module
209
209
  # conflicts with the solaris hypervisor that already exists
210
- directory = create_tmpdir_on(self)
210
+ directory = tmpdir()
211
211
  exec(Beaker::Command.new("echo 'PermitUserEnvironment yes' | cat - /etc/ssh/sshd_config > #{directory}/sshd_config.permit"))
212
212
  exec(Beaker::Command.new("mv #{directory}/sshd_config.permit /etc/ssh/sshd_config"))
213
213
  when /(free|open)bsd/
@@ -1,11 +1,11 @@
1
1
  module Unix::File
2
2
  include Beaker::CommandFactory
3
3
 
4
- def tmpfile(name)
4
+ def tmpfile(name = '')
5
5
  execute("mktemp -t #{name}.XXXXXX")
6
6
  end
7
7
 
8
- def tmpdir(name)
8
+ def tmpdir(name = '')
9
9
  execute("mktemp -dt #{name}.XXXXXX")
10
10
  end
11
11
 
@@ -13,6 +13,47 @@ module Unix::File
13
13
  '/tmp'
14
14
  end
15
15
 
16
+ # Change user ownership of a path
17
+ #
18
+ # @see http://pubs.opengroup.org/onlinepubs/9699919799/utilities/chown.html
19
+ #
20
+ # @note To maintain argument order consistency with the underlying
21
+ # syscall, avoid having to specify nil arguments, and not do
22
+ # anything hacky with the arguments list, this method does not
23
+ # allow you to modify group ownership. Use Host::chgrp instead.
24
+ # @param [String] user User to chown to
25
+ # @param [String] path Path to chown
26
+ # @param [Boolean] recursive Whether to pass the recursive flag
27
+ #
28
+ # @return [Beaker::Result] result of command execution
29
+ def chown(user, path, recursive=false)
30
+ execute("chown #{recursive ? '-R ' : ''}#{user} #{path}")
31
+ end
32
+
33
+ # Change group ownership of a path
34
+ #
35
+ # @see http://pubs.opengroup.org/onlinepubs/9699919799/utilities/chgrp.html
36
+ #
37
+ # @param [String] group Group to chgrp to
38
+ # @param [String] path Path to chgrp
39
+ # @param [Boolean] recursive Whether to pass the recursive flag
40
+ #
41
+ # @return [Beaker::Result] result of command execution
42
+ def chgrp(group, path, recursive=false)
43
+ execute("chgrp #{recursive ? '-R ' : ''}#{group} #{path}")
44
+ end
45
+
46
+ # List long output of a path
47
+ #
48
+ # @see http://pubs.opengroup.org/onlinepubs/9699919799/utilities/ls.html
49
+ #
50
+ # @param [String] path Path to list properties of
51
+ #
52
+ # @return [Beaker::Result] result of command execution
53
+ def ls_ld(path)
54
+ execute("ls -ld #{path}")
55
+ end
56
+
16
57
  # Handles any changes needed in a path for SCP
17
58
  #
18
59
  # @param [String] path File path to SCP to