• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

hercules-team / augeasproviders_puppet / 44

pending completion
44

push

travis-ci-com

raphink
chore: remove FUNDING

46 of 96 relevant lines covered (47.92%)

0.96 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

81.58
/lib/puppet/type/puppet_auth.rb
1
# Manages settings in Puppet's auth.conf file
2
#
3
# Copyright (c) 2012 Raphaƫl Pinson
4
# Licensed under the Apache License, Version 2.0
5

6
Puppet::Type.newtype(:puppet_auth) do
2✔
7
  @doc = "Manages settings in Puppet's auth.conf."
2✔
8

9
  ensurable
2✔
10

11
  def munge_boolean(value)
2✔
12
    case value
×
13
    when true, "true", :true
14
      :true
×
15
    when false, "false", :false
16
      :false
×
17
    else
18
      fail("munge_boolean only takes booleans")
×
19
    end
20
  end
21

22
  newparam(:name) do
2✔
23
    desc "The name of the resource."
2✔
24
    isnamevar
2✔
25
  end
26

27
  newparam(:path) do
2✔
28
    desc "The path for the auth rule."
2✔
29
  end
30

31
  newparam(:path_regex, :boolean => true) do
2✔
32
    desc "Whether the path is specified as a regex."
2✔
33

34
    newvalues(:true, :false)
2✔
35

36
    munge do |value|
2✔
37
      @resource.munge_boolean(value)
×
38
    end
39
  end
40

41
  newparam(:ins_before) do
2✔
42
    desc "Optional XPath expression to specify where to insert the auth rule.
2✔
43

44
This parameter takes special values working as aliases:
45

46
- `first allow`, mapping to `path[allow][1]`;
47
- `last allow`, mapping to `path[allow][last()]`;
48
- `first deny`, mapping to `path[count(allow)=0][1]`;
49
- `last deny`, mapping to path[count(allow)=0][last()]`"
50
  end
51

52
  newparam(:ins_after) do
2✔
53
    desc "Optional XPath expression to specify where to insert the auth rule.
2✔
54

55
This parameter takes special values working as aliases:
56

57
- `first allow`, mapping to `path[allow][1]`;
58
- `last allow`, mapping to `path[allow][last()]`;
59
- `first deny`, mapping to `path[count(allow)=0][1]`;
60
- `last deny`, mapping to path[count(allow)=0][last()]`"
61
  end
62

63
  newproperty(:environments, :array_matching => :all) do
2✔
64
    desc "The list of environments the rule applies to."
2✔
65
  end
66

67
  newproperty(:methods, :array_matching => :all) do
2✔
68
    desc "The list of methods the rule applies to. Possible values are:
2✔
69

70
- find;
71
- search;
72
- save;
73
- destroy."
74
  end
75

76
  newproperty(:allow, :array_matching => :all) do
2✔
77
    desc "The list of hosts allowed for this rule,
2✔
78
specified by hostname or cername. Regexes are allowed,
79
as well as the special value `*`."
80

81
    validate do |val|
2✔
82
      raise ArgumentError, "The allow parameter cannot be undef" if val == :undef
×
83
    end
84
  end
85

86
  newproperty(:allow_ip, :array_matching => :all) do
2✔
87
    desc "The list of IPs allowed for this rule.
2✔
88
Requires Puppet 3.0.0 or greater."
89
  end
90

91
  newproperty(:authenticated) do
2✔
92
    desc "The type of authentication for the rule. Possible values are:
2✔
93

94
- yes;
95
- no;
96
- on;
97
- off;
98
- any."
99
  end
100

101
  newparam(:target) do
2✔
102
    desc "The file in which to store the settings, defaults to
2✔
103
      `/etc/puppet/auth.conf`."
104
  end
105

106
  autorequire(:file) do
2✔
107
    self[:target]
×
108
  end
109
end
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2023 Coveralls, Inc