Class: Junos::Ez::SysConfig::Provider
Instance Attribute Summary
#catalog, #has, #list, #name, #ndev, #parent, #properties, #providers, #should
Instance Method Summary
collapse
#[], #[]=, #activate!, #active?, #catalog!, #create, #create!, #create_from_hash!, #create_from_yaml!, #deactivate!, #delete!, #each, #exists?, #init_has, #initialize, #is_new?, #is_provider?, #list!, #name_decorated, #need_write?, #read!, #rename!, #reorder!, #select, #to_h, #to_h_expanded, #to_yaml, #write!, #xml_at_edit, #xml_build_change, #xml_change__active, #xml_change__exist, #xml_change_admin, #xml_change_description, #xml_element_newname, #xml_on_create, #xml_on_delete
Instance Method Details
#xml_at_top ⇒ Object
7
8
9
10
11
12
13
|
# File 'lib/junos-ez/system/syscfg.rb', line 7
def xml_at_top
xml = Nokogiri::XML::Builder.new {|xml| xml.configuration {
xml.system {
return xml
}
}}
end
|
#xml_change_date(xml) ⇒ Object
95
96
|
# File 'lib/junos-ez/system/syscfg.rb', line 95
def xml_change_date( xml )
end
|
#xml_change_dns_servers(xml) ⇒ Object
89
90
|
# File 'lib/junos-ez/system/syscfg.rb', line 89
def xml_change_dns_servers( xml )
end
|
#xml_change_domain_name(xml) ⇒ Object
78
79
80
|
# File 'lib/junos-ez/system/syscfg.rb', line 78
def xml_change_domain_name( xml )
xml.send(:'domain-name', @should[:domain_name] )
end
|
#xml_change_domain_search(xml) ⇒ Object
82
83
|
# File 'lib/junos-ez/system/syscfg.rb', line 82
def xml_change_domain_search( xml )
end
|
#xml_change_host_name(xml) ⇒ Object
74
75
76
|
# File 'lib/junos-ez/system/syscfg.rb', line 74
def xml_change_host_name( xml )
xml.send(:'host-name', @should[:host_name] )
end
|
#xml_change_location(xml) ⇒ Object
98
99
|
# File 'lib/junos-ez/system/syscfg.rb', line 98
def xml_change_location( xml )
end
|
#xml_change_ntp_servers(xml) ⇒ Object
92
93
|
# File 'lib/junos-ez/system/syscfg.rb', line 92
def xml_change_ntp_servers( xml )
end
|
#xml_change_timezone(xml) ⇒ Object
85
86
87
|
# File 'lib/junos-ez/system/syscfg.rb', line 85
def xml_change_timezone( xml )
xml.send(:'time-zone', @should[:timezone])
end
|
#xml_config_read! ⇒ Object
15
16
17
18
19
20
21
22
23
24
25
|
# File 'lib/junos-ez/system/syscfg.rb', line 15
def xml_config_read!
xml = xml_at_top
xml.send(:'host-name')
xml.send(:'domain-name')
xml.send(:'domain-search')
xml.send(:'time-zone')
xml.location
xml.send(:'name-server')
xml.ntp
@ndev.rpc.get_configuration( xml )
end
|
#xml_get_has_xml(xml) ⇒ Object
31
32
33
|
# File 'lib/junos-ez/system/syscfg.rb', line 31
def xml_get_has_xml( xml )
xml.xpath('system')[0]
end
|
#xml_read_parser(as_xml, as_hash) ⇒ Object
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
|
# File 'lib/junos-ez/system/syscfg.rb', line 35
def xml_read_parser( as_xml, as_hash )
set_has_status( as_xml, as_hash )
as_hash[:host_name] = as_xml.xpath('host-name').text
unless (data = as_xml.xpath('domain-name')).empty?
as_hash[:domain_name] = data.text
end
unless (data = as_xml.xpath('domain-search')).empty?
as_hash[:domain_search] = data.collect{|i| i.text}
end
unless (data = as_xml.xpath('time-zone')).empty?
as_hash[:timezone] = data.text
end
unless (data = as_xml.xpath('name-server/name')).empty?
as_hash[:dns_servers] = data.collect{|i| i.text}
end
unless (data = as_xml.xpath('ntp/server/name')).empty?
as_hash[:ntp_servers] = data.collect{|i| i.text}
end
unless (location = as_xml.xpath('location')).empty?
as_hash[:location] = {}
unless (data = location.xpath('building')).empty?
as_hash[:location][:building] = data.text
end
unless (data = location.xpath('country-code')).empty?
as_hash[:location][:countrycode] = data.text
end
unless (data = location.xpath('floor')).empty?
as_hash[:location][:floor] = data.text
end
unless (data = location.xpath('rack')).empty?
as_hash[:location][:rack] = data.text
end
end
end
|