Class: Cisco::Banner
- Defined in:
- lib/cisco_node_utils/banner.rb
Overview
Banner - node utility class for Banner configuration management
Instance Attribute Summary collapse
-
#name ⇒ Object
readonly
Returns the value of attribute name.
Class Method Summary collapse
Instance Method Summary collapse
- #==(other) ⇒ Object
- #default_motd ⇒ Object
-
#initialize(name) ⇒ Banner
constructor
A new instance of Banner.
- #motd ⇒ Object
- #motd=(val) ⇒ Object
Methods inherited from NodeUtil
client, #client, config_get, #config_get, #config_get_default, config_get_default, config_set, #config_set, #get, #ios_xr?, #nexus?, #node, node, platform, #platform, supports?, #supports?
Constructor Details
#initialize(name) ⇒ Banner
Returns a new instance of Banner.
26 27 28 29 30 31 32 |
# File 'lib/cisco_node_utils/banner.rb', line 26 def initialize(name) fail TypeError unless name.is_a?(String) fail ArgumentError, "This provider only accepts an id of 'default'" \ unless name.eql?('default') @name = name end |
Instance Attribute Details
#name ⇒ Object (readonly)
Returns the value of attribute name.
24 25 26 |
# File 'lib/cisco_node_utils/banner.rb', line 24 def name @name end |
Class Method Details
Instance Method Details
#==(other) ⇒ Object
40 41 42 |
# File 'lib/cisco_node_utils/banner.rb', line 40 def ==(other) name == other.name end |
#default_motd ⇒ Object
59 60 61 |
# File 'lib/cisco_node_utils/banner.rb', line 59 def default_motd config_get_default('banner', 'motd') end |
#motd ⇒ Object
44 45 46 |
# File 'lib/cisco_node_utils/banner.rb', line 44 def motd config_get('banner', 'motd') end |
#motd=(val) ⇒ Object
48 49 50 51 52 53 54 55 56 57 |
# File 'lib/cisco_node_utils/banner.rb', line 48 def motd=(val) if val.nil? && (motd != default_motd) config_set('banner', 'motd', state: 'no', motd: '') elsif !val.nil? config_set('banner', 'motd', state: '', motd: "^#{val.gsub(/\n/, '\\n')}^") end end |