403Webshell
Server IP : 66.29.132.122  /  Your IP : 3.144.26.138
Web Server : LiteSpeed
System : Linux business142.web-hosting.com 4.18.0-553.lve.el8.x86_64 #1 SMP Mon May 27 15:27:34 UTC 2024 x86_64
User : admazpex ( 531)
PHP Version : 7.2.34
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : ON  |  Sudo : OFF  |  Pkexec : OFF
Directory :  /proc/self/root/opt/puppetlabs/puppet/vendor_modules/host_core/lib/puppet/provider/host/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /proc/self/root/opt/puppetlabs/puppet/vendor_modules/host_core/lib/puppet/provider/host/parsed.rb
require 'puppet/provider/parsedfile'

case Facter.value('os.family')
when 'Solaris'
  hosts = '/etc/inet/hosts'
when 'windows'
  require 'win32/resolv'
  hosts = Win32::Resolv.get_hosts_path
else
  hosts = '/etc/hosts'
end

Puppet::Type.type(:host).provide(:parsed, parent: Puppet::Provider::ParsedFile,
                                          default_target: hosts, filetype: :flat) do
  @doc = "Installs and manages host entries.  For most systems, these
      entries will just be in `/etc/hosts`, but some systems (notably OS X)
      will have different solutions."

  confine exists: hosts

  text_line :comment, match: %r{^#}
  text_line :blank, match: %r{^\s*$}
  hosts_pattern = '^([0-9a-f:]\S+)\s+([^#\s+]\S+)\s*(.*?)?(?:\s*#\s*(.*))?$'
  record_line :parsed, fields: ['ip', 'name', 'host_aliases', 'comment'],
                       optional: ['host_aliases', 'comment'],
                       match: %r{#{hosts_pattern}},
                       post_parse: proc { |hash|
                                     # An absent comment should match "comment => ''"
                                     hash[:comment] = '' if hash[:comment].nil? || hash[:comment] == :absent
                                     unless hash[:host_aliases].nil? || hash[:host_aliases] == :absent
                                       hash[:host_aliases].gsub!(%r{\s+}, ' ') # Change delimiter
                                     end
                                   },
                       to_line: proc { |hash|
                                  [:ip, :name].each do |n|
                                    raise ArgumentError, _('%{attr} is a required attribute for hosts') % { attr: n } unless hash[n] && hash[n] != :absent
                                  end
                                  str = "#{hash[:ip]}\t#{hash[:name]}"
                                  if hash.include?(:host_aliases) && !hash[:host_aliases].nil? && hash[:host_aliases] != :absent
                                    str += "\t#{hash[:host_aliases]}"
                                  end
                                  if hash.include?(:comment) && !hash[:comment].empty?
                                    str += "\t# #{hash[:comment]}"
                                  end
                                  str
                                }

  text_line :incomplete, match: %r{(?! (#{hosts_pattern}))}
end

Youez - 2016 - github.com/yon3zu
LinuXploit