mechboxes / mech

Easy command line virtual machines for VMWare
https://mechboxes.github.io/mech/
MIT License
311 stars 49 forks source link

Mech init TypeError: unorderable types: NoneType() < str()` #61

Open network-shark opened 5 years ago

network-shark commented 5 years ago

I'm trying to import a freebsd box, but this results in the following error.

╰─ mech init https://app.vagrantup.com/roboxes/boxes/freebsd11 Initializing mech Traceback (most recent call last): File "/Users/sharky/.pyenv/versions/ansible/bin/mech", line 11, in load_entry_point('mech==0.7.6', 'console_scripts', 'mech')() File "/Users/sharky/.pyenv/versions/3.5.7/envs/ansible/lib/python3.5/site-packages/mech/main.py", line 39, in main return Mech(arguments)() File "/Users/sharky/.pyenv/versions/3.5.7/envs/ansible/lib/python3.5/site-packages/mech/command.py", line 89, in call obj = klass(arguments) File "/Users/sharky/.pyenv/versions/3.5.7/envs/ansible/lib/python3.5/site-packages/mech/mech.py", line 569, in init if utils.init_mechfile(instance_name, url, name=name, version=version, requests_kwargs=requests_kwargs): File "/Users/sharky/.pyenv/versions/3.5.7/envs/ansible/lib/python3.5/site-packages/mech/utils.py", line 474, in init_mechfile path = index_active_instance(instance_name) File "/Users/sharky/.pyenv/versions/3.5.7/envs/ansible/lib/python3.5/site-packages/mech/utils.py", line 463, in index_active_instance 'path': path, File "/Users/sharky/.pyenv/versions/3.5.7/envs/ansible/lib/python3.5/site-packages/mech/utils.py", line 222, in settle_instance json.dump(instances, fp, sort_keys=True, indent=2, separators=(',', ': ')) File "/Users/sharky/.pyenv/versions/3.5.7/lib/python3.5/json/init.py", line 178, in dump for chunk in iterable: File "/Users/sharky/.pyenv/versions/3.5.7/lib/python3.5/json/encoder.py", line 429, in _iterencode yield from _iterencode_dict(o, _current_indent_level) File "/Users/sharky/.pyenv/versions/3.5.7/lib/python3.5/json/encoder.py", line 352, in _iterencode_dict items = sorted(dct.items(), key=lambda kv: kv[0]) TypeError: unorderable types: NoneType() < str()

network-shark commented 5 years ago

After deleting the ~/.mech folder I could successfully add the the vm, but if I try to start it , mech is using the wrong URL for bootstrapping.

╰─ mech --debug up
DEBUG: Attempting to acquire lock 4490481616 on /Users/sharky/.mech/data/index.lock
INFO: Lock 4490481616 acquired on /Users/sharky/.mech/data/index.lock
DEBUG: Attempting to release lock 4490481616 on /Users/sharky/.mech/data/index.lock
INFO: Lock 4490481616 released on /Users/sharky/.mech/data/index.lock
Provided box name is not valid
Loading metadata for box 'freebsd11'
DEBUG: Starting new HTTPS connection (1): app.vagrantup.com:443
DEBUG: https://app.vagrantup.com:443 "GET /freebsd11/boxes/ HTTP/1.1" 301 113
DEBUG: https://app.vagrantup.com:443 "GET /freebsd11/boxes/boxes HTTP/1.1" 404 None
Bad response from HashiCorp's Vagrant Cloud API: 404 Client Error: Not Found for url: https://app.vagrantup.com/freebsd11/boxes/boxes
 OSX  sharkys-mbp  sharky  ~/VMs/freebsd11-zfs  ansible                                                                                                                                                                      2510
╰─ cat Mechfile
{
  "box": "freebsd11",
  "name": null,
  "url": "https://app.vagrantup.com/roboxes/boxes/freebsd11"
}%
network-shark commented 5 years ago

As a workaround I have created my own mechfile. I cloud successfully boot the vm.

{
  "box": "roboxes/freebsd11",
  "box_version": "1.9.16",
  "name": null,
  "url": "https://app.vagrantup.com/roboxes/boxes/freebsd11/versions/1.9.16/providers/vmware_desktop.box"
}