File: specinfra_stubs.rb

package info (click to toggle)
puppet-module-puppetlabs-concat 7.3.1-2
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 532 kB
  • sloc: ruby: 2,584; sh: 46; makefile: 2
file content (22 lines) | stat: -rw-r--r-- 698 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
# frozen_string_literal: true

# class Specinfra::Command::Windows::Base::File
class Specinfra::Command::Windows::Base::File < Specinfra::Command::Windows::Base
  class << self
    def check_is_owned_by(file, owner)
      Backend::PowerShell::Command.new do
        exec "if((Get-Item '#{file}').GetAccessControl().Owner -match '#{owner}'
          -or ((Get-Item '#{file}').GetAccessControl().Owner -match '#{owner}').Length -gt 0){ exit 0 } else { exit 1 }"
      end
    end
  end
end

# class Specinfra::Command::Base::File
class Specinfra::Command::Base::File < Specinfra::Command::Base
  class << self
    def get_content(file)
      "cat '#{file}' 2> /dev/null || echo -n"
    end
  end
end