Method: Cisco::Yum.validate_installed
- Defined in:
- lib/cisco_node_utils/yum.rb
.validate_installed(pkg) ⇒ Object
25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 |
# File 'lib/cisco_node_utils/yum.rb', line 25 def self.validate_installed(pkg) # Sample data returned from config_get('yum', 'query_all') # ["nxos.sample-n8k_EOR.lib32_nxos", "1.0.0-7.0.3.F1.1", "@patching"], patch_data = config_get('yum', 'query_all') patch_data.each do |name_arch, version, _state| # Separate name and architecture next if name_arch.rindex('.').nil? arch = name_arch.slice!(name_arch.rindex('.')..-1).delete('.') # Version/Architecture info not available when only pkg name specified. version = arch = '' if name_arch == pkg # Check for match if pkg.match(name_arch) && pkg.match(version) && pkg.match(arch) return true end end fail 'Failed to install the requested rpm' end |