Class: Junos::Ez::UserAuths::Provider

Inherits:
Provider::Parent show all
Defined in:
lib/junos-ez/system/userauths.rb,
lib/junos-ez/system/userauths.rb,
lib/junos-ez/system/userauths.rb

Overview


Provider Collection Methods


Instance Attribute Summary

Attributes inherited from Provider::Parent

#catalog, #has, #list, #name, #ndev, #parent, #properties, #providers, #should

Instance Method Summary collapse

Methods inherited from Provider::Parent

#[], #[]=, #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, #with, #write!, #xml_at_edit, #xml_change__active, #xml_change__exist, #xml_change_admin, #xml_change_description, #xml_config_read!, #xml_element_newname, #xml_on_create, #xml_on_delete

Constructor Details

This class inherits a constructor from Junos::Ez::Provider::Parent

Instance Method Details

#build_catalogObject



79
80
81
# File 'lib/junos-ez/system/userauths.rb', line 79

def build_catalog
  {}
end

#build_listObject



75
76
77
# File 'lib/junos-ez/system/userauths.rb', line 75

def build_list
  []
end

#xml_at_topObject


XML top placement




29
30
31
32
33
34
35
36
37
38
39
40
41
# File 'lib/junos-ez/system/userauths.rb', line 29

def xml_at_top
  Nokogiri::XML::Builder.new{|x| x.configuration{ 
    x.system { x. { x.user { 
      x.name @name[:user]
      x.authentication {          
        x.send( @name[:keytype].to_sym ) {
          x.name @name[:publickey]
          return x
        }
      }
    }}}
  }}
end

#xml_build_change(xml_at_here = nil) ⇒ Object

!! since we’re not actually modifying any properties, we need !! to overload the xml_build_change method to simply return !! the config at-top (includes ssh name)



64
65
66
# File 'lib/junos-ez/system/userauths.rb', line 64

def xml_build_change( xml_at_here = nil )
  xml_at_top.doc.root
end

#xml_get_has_xml(xml) ⇒ Object


XML readers




47
48
49
50
# File 'lib/junos-ez/system/userauths.rb', line 47

def xml_get_has_xml( xml )
  @should[:_active] = true              # mark it so it will write!    
  xml.xpath('//user/authentication/*')[0]    
end

#xml_read_parser(as_xml, as_hash) ⇒ Object



52
53
54
# File 'lib/junos-ez/system/userauths.rb', line 52

def xml_read_parser( as_xml, as_hash )
  set_has_status( as_xml, as_hash )
end