Skip to content
This repository has been archived by the owner on Dec 17, 2023. It is now read-only.

check guest and host version #242

Closed
yvesguerinmtl opened this issue Jan 12, 2017 · 1 comment
Closed

check guest and host version #242

yvesguerinmtl opened this issue Jan 12, 2017 · 1 comment
Labels

Comments

@yvesguerinmtl
Copy link

Dear,

I hacked the code to check only the first two digit of the version, I didn't need to update virtualbox if the major.minor digits are the same

Sorry but Ruby is not my usual programming language and no time to learn a new markup language of the github's issue system

File: machine.rb

def state
guest_version = installer.guest_version(true)
host_version = installer.host_version
running = installer.running?
@logger.debug("Current states for VM '#{vm.name}' are : guest_version=#{guest_version} : host_version=#{host_version} : running=#{running}")

    return :clean       if !guest_version

    vh = host_version.split('.').map{|s|s.to_i}
    vg = guest_version.split('.').map{|s|s.to_i}

    if vh.at(0) == vg.at(0)
       if vh.at(1) == vg.at(1)
            return :ok
       else
            return :unmatched
       end
    else
            return :unmatched
    end

  #return :clean       if !guest_version
  #return :unmatched   if host_version != guest_version
  return :not_running if !running
  return :ok
end

Diff machine.rb machine.rb.orig (output):

B72,73c72,89
< return :clean if !guest_version
< return :unmatched if host_version != guest_version

    return :clean       if !guest_version

    vh = host_version.split('.').map{|s|s.to_i}
    vg = guest_version.split('.').map{|s|s.to_i}

    if vh.at(0) == vg.at(0) 
       if vh.at(1) == vg.at(1)
            return :ok
       else
            return :unmatched
       end
    else
            return :unmatched
    end


  #return :clean       if !guest_version
  #return :unmatched   if host_version != guest_version

Regards,

Yves

@stale
Copy link

stale bot commented Jan 11, 2019

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the wontfix label Jan 11, 2019
@stale stale bot closed this as completed Jan 18, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

1 participant