Code Monkey home page Code Monkey logo

Comments (5)

ColdHeat avatar ColdHeat commented on May 29, 2024

This issue is undoubtedly the single most annoying issue I run into with mech. If I install docker inside of a virtual machine, vmrun will no longer find the IP address correctly and you end up having to go into Fusion to get the actual IP address

❯ mech up
Bringing machine up...
Getting IP address...
Sharing current folder...
VM started on 172.17.0.1

from mech.

Kronuz avatar Kronuz commented on May 29, 2024

I was checking how this is done in Vagrant, it seems it also suffers from the same problem, they had/have (hashicorp/vagrant#6580) and they added enable_vmrun_ip_lookup, which must be using a script to get the IP, somehow. I wonder how they’re doing it...

from mech.

ColdHeat avatar ColdHeat commented on May 29, 2024

This problem was getting annoying so I looked into it.

        vmrun.user = 'vagrant'
        vmrun.password = 'vagrant'
        vmrun.runScriptInGuest('/bin/sh', "hostname -I > /tmp/ip_address")
        with tempfile.NamedTemporaryFile() as fp:
            vmrun.copyFileFromGuestToHost('/tmp/ip_address', fp.name)
            fp.seek(0)
            ip_addresses = fp.read()
            if ip_addresses:
                print(ip_addresses.split()[0])

This code works although the hostname man page says we can't rely on its order for output. Perhaps a better way is to use a more advanced command or test the IPs?

from mech.

ColdHeat avatar ColdHeat commented on May 29, 2024

I don't like my current approach (changes to getGuestIPAddress), do you think this should be a change in vmrun or higher in mech/utils?

from mech.

ColdHeat avatar ColdHeat commented on May 29, 2024

I implemented an enable_ip_lookup as of e77d319

from mech.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.