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

Poetry2nixify #3

Closed
wants to merge 4 commits into from
Closed

Poetry2nixify #3

wants to merge 4 commits into from

Conversation

grahamc
Copy link
Member

@grahamc grahamc commented Apr 3, 2020

black's and poetry2nix's the codebase. Untested: virtualbox doesn't work with the kernel that my computer requires.

@grahamc
Copy link
Member Author

grahamc commented Apr 3, 2020

testing steps:

  1. clone, check out the PR
  2. nix-shell
  3. poetry install
  4. poetry shell
  5. nixops create -d test tests/functional/single_machine_vbox_base.nix
  6. nixops deploy -d test

... make sure it works :P


[tool.poetry.dependencies]
python = "^3.7"
nixops = {git = "https://github.com/adisbladis/nixops.git", rev = "poetry2nix-plugins"}
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Once NixOS/nixops#1256 merges this should point to master.

@jhillyerd
Copy link

Tested. Successfully deployed a VM.

Destroy failed:


nixops destroy
warning: are you sure you want to destroy VirtualBox VM ‘webserver’? (y/N) y
webserver> destroying VirtualBox VM...
webserver> 0%...10%...20%...30%...40%...50%...60%...70%...80%...90%...100%
Traceback (most recent call last):
  File "/home/james/.cache/pypoetry/virtualenvs/nixops-vbox-vAlhE9FH-py3.7/bin/nixops", line 11, in <module>
    load_entry_point('nixops', 'console_scripts', 'nixops')()
  File "/home/james/.cache/pypoetry/virtualenvs/nixops-vbox-vAlhE9FH-py3.7/src/nixops/nixops/__main__.py", line 626, in main
    args.op(args)
  File "/home/james/.cache/pypoetry/virtualenvs/nixops-vbox-vAlhE9FH-py3.7/src/nixops/nixops/script_defs.py", line 625, in op_destroy
    include=args.include or [], exclude=args.exclude or [], wipe=args.wipe
  File "/home/james/.cache/pypoetry/virtualenvs/nixops-vbox-vAlhE9FH-py3.7/src/nixops/nixops/deployment.py", line 1516, in destroy_resources
    "destroy", lambda: self._destroy_resources(include, exclude, wipe)
  File "/home/james/.cache/pypoetry/virtualenvs/nixops-vbox-vAlhE9FH-py3.7/src/nixops/nixops/deployment.py", line 1378, in run_with_notify
    f()
  File "/home/james/.cache/pypoetry/virtualenvs/nixops-vbox-vAlhE9FH-py3.7/src/nixops/nixops/deployment.py", line 1516, in <lambda>
    "destroy", lambda: self._destroy_resources(include, exclude, wipe)
  File "/home/james/.cache/pypoetry/virtualenvs/nixops-vbox-vAlhE9FH-py3.7/src/nixops/nixops/deployment.py", line 1506, in _destroy_resources
    nr_workers=-1, tasks=list(self.resources.values()), worker_fun=worker
  File "/home/james/.cache/pypoetry/virtualenvs/nixops-vbox-vAlhE9FH-py3.7/src/nixops/nixops/parallel.py", line 108, in run_tasks
    raise list(exceptions.values())[0]
  File "/home/james/.cache/pypoetry/virtualenvs/nixops-vbox-vAlhE9FH-py3.7/src/nixops/nixops/parallel.py", line 72, in thread_fun
    work_result = (worker_fun(t), None, t.name)
  File "/home/james/.cache/pypoetry/virtualenvs/nixops-vbox-vAlhE9FH-py3.7/src/nixops/nixops/deployment.py", line 1497, in worker
    if m.destroy(wipe=wipe):
  File "/home/james/devel/nixops-vbox/nixops_vbox/backends/virtualbox.py", line 595, in destroy
    nixops.known_hosts.update(self.private_ipv4, None, self.public_host_key)
  File "/home/james/.cache/pypoetry/virtualenvs/nixops-vbox-vAlhE9FH-py3.7/src/nixops/nixops/known_hosts.py", line 69, in update
    add(new_address, public_host_key)
  File "/home/james/.cache/pypoetry/virtualenvs/nixops-vbox-vAlhE9FH-py3.7/src/nixops/nixops/known_hosts.py", line 62, in add
    _rewrite(ip_address, True, public_host_key)
  File "/home/james/.cache/pypoetry/virtualenvs/nixops-vbox-vAlhE9FH-py3.7/src/nixops/nixops/known_hosts.py", line 46, in _rewrite
    new.append(ip_address + " " + public_host_key)
TypeError: unsupported operand type(s) for +: 'NoneType' and 'str'

nix-info
system: "x86_64-linux", multi-user?: yes, version: nix-env (Nix) 2.3.4, channels(root): "nixos-20.03.1589.9137f05564e", nixpkgs: /nix/var/nix/profiles/per-user/root/channels/nixos

@jhillyerd
Copy link

I updated nixops to master via local poetry link, and this still fails with both the test VM and my own VMs.

It may be related to NixOS/nixops#1010 and NixOS/nixops#1279 - it appears to be following the same code path.

Setting a breakpoint, we can see it's the IP that is None, but we are trying to add it:

  File "/home/james/devel/nixops-vbox/nixops_vbox/backends/virtualbox.py", line 595, in destroy
    nixops.known_hosts.update(self.private_ipv4, None, self.public_host_key)
  File "/home/james/devel/nixops/nixops/known_hosts.py", line 69, in update
    add(new_address, public_host_key)
  File "/home/james/devel/nixops/nixops/known_hosts.py", line 62, in add
    _rewrite(ip_address, True, public_host_key)
  File "/home/james/devel/nixops/nixops/known_hosts.py", line 46, in _rewrite
    new.append(ip_address + " " + public_host_key)
TypeError: unsupported operand type(s) for +: 'NoneType' and 'str'
(nixops-vbox-vAlhE9FH-py3.7) 

[james@nixvm:~/devel/nixops-vbox]$ nixops destroy -d test
warning: are you sure you want to destroy VirtualBox VM ‘machine’? (y/N) y
machine> destroying VirtualBox VM...
> /home/james/devel/nixops/nixops/known_hosts.py(47)_rewrite()
-> new.append(ip_address + " " + public_host_key)
(Pdb) args
ip_address = None
add_ip = True
public_host_key = 'ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIPiyDEA2E24ESIlFzMWdKfO7sJujjqwvKSsnzLRL10ul NixOps auto-generated key'
(Pdb) 

@jhillyerd
Copy link

Updating nixops to master seems to have broken deploy after a fresh create, I cannot deploy my own or the test network.

machine> creating VirtualBox VM...
machine> Virtual machine 'nixops-056f2440-89db-11ea-9f41-000c297b45f0-machine' is created and registered.
machine> UUID: b45e098a-97e6-4ee5-8b0e-626fa1ea97ca
machine> Settings file: '/home/james/VirtualBox VMs/nixops-056f2440-89db-11ea-9f41-000c297b45f0-machine/nixops-056f2440-89db-11ea-9f41-000c297b45f0-machine.vbox'
Traceback (most recent call last):
  File "/home/james/.cache/pypoetry/virtualenvs/nixops-vbox-vAlhE9FH-py3.7/bin/nixops", line 11, in <module>
    load_entry_point('nixops', 'console_scripts', 'nixops')()
  File "/home/james/devel/nixops/nixops/__main__.py", line 630, in main
    args.op(args)
  File "/home/james/devel/nixops/nixops/script_defs.py", line 605, in op_deploy
    max_concurrent_activate=args.max_concurrent_activate,
  File "/home/james/devel/nixops/nixops/deployment.py", line 1379, in deploy
    self.run_with_notify("deploy", lambda: self._deploy(**kwargs))
  File "/home/james/devel/nixops/nixops/deployment.py", line 1368, in run_with_notify
    f()
  File "/home/james/devel/nixops/nixops/deployment.py", line 1379, in <lambda>
    self.run_with_notify("deploy", lambda: self._deploy(**kwargs))
  File "/home/james/devel/nixops/nixops/deployment.py", line 1286, in _deploy
    worker_fun=worker,
  File "/home/james/devel/nixops/nixops/parallel.py", line 108, in run_tasks
    raise list(exceptions.values())[0]
  File "/home/james/devel/nixops/nixops/parallel.py", line 72, in thread_fun
    work_result = (worker_fun(t), None, t.name)
  File "/home/james/devel/nixops/nixops/deployment.py", line 1245, in worker
    allow_recreate=allow_recreate,
  File "/home/james/devel/nixops-vbox/nixops_vbox/backends/virtualbox.py", line 303, in create
    for sf_name, sf_def in defn.config["virtualbox"]["sharedFolders"].items():
TypeError: 'MachineOptions' object is not subscriptable

@adisbladis
Copy link
Member

Superseded by #23

@adisbladis adisbladis closed this May 18, 2020
KjMaas added a commit to KjMaas/nixops-vbox that referenced this pull request May 16, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants