Class: Sambot::DNS::Records
- Inherits:
-
Object
- Object
- Sambot::DNS::Records
- Defined in:
- lib/sambot/dns/records.rb
Constant Summary collapse
- RACKSPACE_PROXY_IP =
'134.213.17.37'
- DEFAULT_TF_FILENAME =
'dyn_dns.tf'
Instance Method Summary collapse
- #add(hostname, internal_address, team, commit_changes = false) ⇒ Object
-
#initialize(repository) ⇒ Records
constructor
A new instance of Records.
- #remove(hostname, team, commit_changes = false) ⇒ Object
Constructor Details
#initialize(repository) ⇒ Records
Returns a new instance of Records.
10 11 12 |
# File 'lib/sambot/dns/records.rb', line 10 def initialize(repository) @repository = repository end |
Instance Method Details
#add(hostname, internal_address, team, commit_changes = false) ⇒ Object
25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 |
# File 'lib/sambot/dns/records.rb', line 25 def add(hostname, internal_address, team, commit_changes = false) change(team, hostname, commit_changes) do |contents| if contents['module'].key?(hostname) UI.debug("The entry for \"<#{hostname}>\" will be overwritten.") else UI.debug("A new entry for \"<#{hostname}>\" will be added.") end contents['module'][hostname] = { 'source' => '../../modules/combined_dns', 'dnszone' => 'brighter.io', 'name' => hostname, 'enable-int' => '1', 'int-value' => internal_address, 'int-type' => 'A', 'enable-ext' => '1', 'ext-value' => RACKSPACE_PROXY_IP, 'ext-type' => 'A' } end end |
#remove(hostname, team, commit_changes = false) ⇒ Object
14 15 16 17 18 19 20 21 22 23 |
# File 'lib/sambot/dns/records.rb', line 14 def remove(hostname, team, commit_changes = false) change(team, hostname, commit_changes) do |contents| if contents['module'].key?(hostname) contents['module'].delete(hostname) UI.debug("The entry \"#{hostname}\" has been deleted.") else UI.debug("The entry \"#{hostname}\" was not found.") end end end |