Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upgrade services #520

Merged
merged 18 commits into from
Feb 27, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions lib/cisco_node_utils/cmd_ref/service.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,10 @@ upgrade:
set_context: ['terminal dont-ask']
set_value: "install all nxos <media><image>"

upgrade_force:
set_context: ['terminal dont-ask']
set_value: "install force-all nxos <media><image>"

upgraded:
kind: boolean
get_command: 'show install all status'
Expand Down
14 changes: 12 additions & 2 deletions lib/cisco_node_utils/service.rb
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,11 @@ def self.image_version(image=nil, media=nil)
end
end

# Return the image booted on the device
def self.image
config_get('show_version', 'system_image')
end

def self.save_config
config_set('service', 'save_config')
rescue Cisco::CliError => e
Expand All @@ -73,8 +78,13 @@ def self.upgraded?
end

# Attempts to upgrade the device to 'image'
def self.upgrade(image, media='bootflash:')
config_set('service', 'upgrade', image: image, media: media)
def self.upgrade(image, media='bootflash:', del_boot=false, force_all=false)
delete_boot(media) if del_boot
if force_all
config_set('service', 'upgrade_force', image: image, media: media)
else
config_set('service', 'upgrade', image: image, media: media)
end
end
end
end