Top Level Namespace

Defined Under Namespace

Modules: Config, Regex, Rules Classes: InfraSecure

Instance Method Summary collapse

Instance Method Details

#get_config(root) ⇒ Object



14
15
16
# File 'lib/puppet-lint-infrasecure.rb', line 14

def get_config(root)
  return File.join(root, 'puppet-lint-infrasecure/config/')
end

#get_depen(root) ⇒ Object



18
19
20
# File 'lib/puppet-lint-infrasecure.rb', line 18

def get_depen(root)
  return File.join(root, 'puppet-lint-infrasecure/dependencies/')
end

#get_rootObject



10
11
12
# File 'lib/puppet-lint-infrasecure.rb', line 10

def get_root()
  return File.dirname(File.expand_path(__FILE__))
end

#load_regex(cpath) ⇒ Object



22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
# File 'lib/puppet-lint-infrasecure.rb', line 22

def load_regex(cpath)
  regex = Regex::FromConfig.new()
  # load dependencies list
  dpath = "#{cpath}dependencies.yml"
  regex.load_dependencies(dpath)

  # if a .env files exists
  if File.exist?('.env')
    # loads .env file
    Dotenv.load('.env')
    # if config for WHITELIST exists
    if ENV.has_key?('WHITELIST')
      # loads whitelist urls
      if ENV['WHITELIST'] != '' and File.exist?(ENV['WHITELIST'])
        regex.load_whitelist(ENV['WHITELIST'])
        return regex
      end
    end
  end
  # config default list
  wpath = "#{cpath}whitelist"
  regex.load_whitelist(wpath)
  return regex
end