Class: Puppet::Provider::DomainName::CiscoNexus

Inherits:
ResourceApi::SimpleProvider
  • Object
show all
Defined in:
lib/puppet/provider/domain_name/cisco_nexus.rb

Overview

Implementation for the domain_name type using the Resource API.

Instance Method Summary collapse

Instance Method Details

#canonicalize(_context, resources) ⇒ Object



18
19
20
# File 'lib/puppet/provider/domain_name/cisco_nexus.rb', line 18

def canonicalize(_context, resources)
  resources
end

#create(_context, name, _should) ⇒ Object



46
47
48
# File 'lib/puppet/provider/domain_name/cisco_nexus.rb', line 46

def create(_context, name, _should)
  Cisco::DomainName.new(name)
end

#delete(_context, name) ⇒ Object



50
51
52
53
# File 'lib/puppet/provider/domain_name/cisco_nexus.rb', line 50

def delete(_context, name)
  @domains = Cisco::DomainName.domainnames
  @domains[name].destroy
end

#get(_context, domains = nil) ⇒ Object



22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
# File 'lib/puppet/provider/domain_name/cisco_nexus.rb', line 22

def get(_context, domains=nil)
  require 'cisco_node_utils'
  current_state = []
  @domains = Cisco::DomainName.domainnames
  if domains.nil? || domains.empty?
    @domains.each_key do |id|
      current_state << get_current_state(id)
    end
  else
    domains.each do |domain|
      next if @domains[domain].nil?
      current_state << get_current_state(domain)
    end
  end
  current_state
end

#get_current_state(name) ⇒ Object



39
40
41
42
43
44
# File 'lib/puppet/provider/domain_name/cisco_nexus.rb', line 39

def get_current_state(name)
  {
    name:   name,
    ensure: 'present',
  }
end