Class: Entitlements::Util::Mirror
- Inherits:
-
Object
- Object
- Entitlements::Util::Mirror
show all
- Includes:
- Contracts::Core
- Defined in:
- lib/entitlements/util/mirror.rb
Constant Summary
collapse
- C =
::Contracts
Class Method Summary
collapse
common, extended, included
Class Method Details
.validate_mirror!(key) ⇒ Object
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
|
# File 'lib/entitlements/util/mirror.rb', line 16
def self.validate_mirror!(key)
begin
src = Entitlements::Util::Util.path_for_group(key)
raise ArgumentError, "#{key.inspect} is declared as a mirror OU but source #{src.inspect} exists!"
rescue Errno::ENOENT
end
target = Entitlements.config["groups"][key]["mirror"]
unless Entitlements.config["groups"].key?(target)
raise ArgumentError, "#{key.inspect} is declared as a mirror to a non-existing target #{target.inspect}!"
end
if Entitlements.config["groups"][target]["mirror"]
raise ArgumentError, "#{key.inspect} is declared as a mirror to a mirror target #{target.inspect}!"
end
nil
end
|