Class: Chef::Resource::Dns

Inherits:
Chef::Resource show all
Defined in:
lib/chef/providers/dns_resource.rb

Overview

RightScript chef resource. Set DNS for given id to the current address of this node

Example

dns “my.domain.id.com” do

user "account_user_name"
passwd "account_password"
ip_address "nnn.nnn.nnn.nnn"

end

Instance Method Summary collapse

Constructor Details

#initialize(name, run_context = nil) ⇒ Dns

Initialize DNS resource with default values

Parameters

name(String)

FQDN or Id for server

collection(Array)

Collection of included recipes

node(Chef::Node)

Node where resource will be used



53
54
55
56
57
58
59
60
61
# File 'lib/chef/providers/dns_resource.rb', line 53

def initialize(name, run_context=nil)
  super(name, run_context)
  @resource_name = :dns
  @dns_id = nil
  @user = nil
  @passwd = nil
  @ip_address = nil
  @action = :register        
end

Instance Method Details

#ip_address(arg = nil) ⇒ Object

(String) IP address in the format ddd.ddd.ddd.ddd



82
83
84
85
86
87
88
# File 'lib/chef/providers/dns_resource.rb', line 82

def ip_address(arg=nil)
  set_or_return(
    :ip_address,
    arg,
    :regex => /\b(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\b/
  )
end

#passwd(arg = nil) ⇒ Object

(String) password for dns provider account



73
74
75
76
77
78
79
# File 'lib/chef/providers/dns_resource.rb', line 73

def passwd(arg=nil)
  set_or_return(
    :passwd,
    arg,
    :kind_of => [ String ]
  )
end

#user(arg = nil) ⇒ Object

(String) username for dns provider account



64
65
66
67
68
69
70
# File 'lib/chef/providers/dns_resource.rb', line 64

def user(arg=nil)
  set_or_return(
    :user,
    arg,
    :kind_of => [ String ]
  )
end