1
0
mirror of https://github.com/OpenNebula/one.git synced 2024-12-23 17:33:56 +03:00

M #-: fix provision minor bug in hosts (#686)

This commit is contained in:
Alejandro Huertas Herrero 2021-01-21 13:57:50 +01:00 committed by GitHub
parent c95884aa51
commit 575b8ce23a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 7 additions and 12 deletions

View File

@ -450,9 +450,8 @@ class OneProvisionHelper < OpenNebulaHelper::OneHelper
#
# @param host [OpenNebula::Host]
# @param operation [String] Operation to perform
# @param options [Hash] User CLI options
# @param args [Array] Operation arguments
def host_operation(host, operation, options, args)
def host_operation(host, operation, args)
p_id = host['TEMPLATE/PROVISION/ID']
return OpenNebula::Error.new('No provision ID found') unless p_id
@ -471,7 +470,7 @@ class OneProvisionHelper < OpenNebulaHelper::OneHelper
when 'delete'
provision.update_objects('hosts', :remove, host.one['ID'])
when 'configure'
host.configure((options.key? :force))
host.configure
when 'ssh'
host.ssh(args)
end
@ -503,7 +502,7 @@ class OneProvisionHelper < OpenNebulaHelper::OneHelper
case type
when 'HOSTS'
host_operation(obj, operation, options, args[1])
host_operation(obj, operation, args[1])
else
msg = "Deleting #{type} #{obj['ID']}"

View File

@ -261,8 +261,7 @@ CommandParser::CmdParser.new(ARGV) do
command [:host, :configure],
host_configure_desc,
[:range, :hostid_list],
:options => [OneProvisionHelper::MODES,
OneProvisionHelper::FORCE] do
:options => [OneProvisionHelper::MODES] do
operation = { :operation => 'configure', :message => 'enabled' }
rc = helper.resources_operation(args, operation, options, 'HOSTS')

View File

@ -83,7 +83,7 @@ module OneProvision
# @param hosts [OpenNebula::Datastore array] Datastores for vars
# @param provision [OpenNebula::Provision] Provision info
# @param ping [Boolean] True to check ping to hosts
def configure(hosts, datastores, provision = nil, ping = true)
def configure(hosts, datastores = nil, provision = nil, ping = true)
return if hosts.nil? || hosts.empty?
Driver.retry_loop('Failed to configure hosts', provision) do

View File

@ -204,11 +204,8 @@ module OneProvision
end
# Configures the HOST
#
# @param force [Boolean] Force the configuration if the HOST
# is already configured
def configure(force)
Ansible.configure([{ 'id' => @one['ID'] }], force)
def configure
Ansible.configure([{ 'id' => @one['ID'] }])
end
# Checks that the HOST is a baremetal HOST