bsdci / libioc

A Python library to manage jails with ioc{age,ell}
https://bsd.ci/libioc
Other
38 stars 11 forks source link

Provision ix name attribute is broken #666

Open urosgruber opened 5 years ago

urosgruber commented 5 years ago

Using ix provisioning plugin and using plexmediaserver as name does not work. Steps to recreate

ioc create foo provisioning.method=ixs provisioning.source=plexmediaserver template=yes
ioc provision foo

It throws an error

Traceback (most recent call last):
  File "/usr/local/bin/ioc", line 10, in <module>
    sys.dd:exit(cli())
  File "/usr/local/lib/python3.6/site-packages/click/core.py", line 722, in __call__
    return self.main(*args, **kwargs)
  File "/usr/local/lib/python3.6/site-packages/click/core.py", line 697, in main
    rv = self.invoke(ctx)
  File "/usr/local/lib/python3.6/site-packages/click/core.py", line 1066, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/usr/local/lib/python3.6/site-packages/click/core.py", line 895, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/usr/local/lib/python3.6/site-packages/click/core.py", line 535, in invoke
    return callback(*args, **kwargs)
  File "/usr/local/lib/python3.6/site-packages/click/decorators.py", line 17, in new_func
    return f(get_current_context(), *args, **kwargs)
  File "/usr/local/lib/python3.6/site-packages/ioc_cli/provision.py", line 65, in cli
    **start_args
  File "/usr/local/lib/python3.6/site-packages/ioc_cli/provision.py", line 102, in _provision
    print_function(_execute_provisioner(jail))
  File "/usr/local/lib/python3.6/site-packages/ioc_cli/__init__.py", line 87, in print_events
    for event in generator:
  File "/usr/local/lib/python3.6/site-packages/ioc_cli/provision.py", line 123, in _execute_provisioner
    for event in jail.provisioner.provision():
  File "/usr/local/lib/python3.6/site-packages/libioc/Provisioning/__init__.py", line 183, in provision
    Prototype.check_requirements(self)
  File "/usr/local/lib/python3.6/site-packages/libioc/Provisioning/__init__.py", line 142, in check_requirements
    if self.source is None:
  File "/usr/local/lib/python3.6/site-packages/libioc/Provisioning/__init__.py", line 133, in source
    return None if (config_value is None) else Source(config_value)
  File "/usr/local/lib/python3.6/site-packages/libioc/Provisioning/__init__.py", line 50, in __init__
    self.value = value
  File "/usr/local/lib/python3.6/site-packages/libioc/Provisioning/__init__.py", line 87, in value
    raise ValueError("Provisioning Source must be AbsolutePath or URL")
ValueError: Provisioning Source must be AbsolutePath or URL

Trying to use URL as name also fail because in the code

return (
            "https://raw.githubusercontent.com/freenas/iocage-ix-plugins"
            f"/master/{name}.json"
        )

you can see it should be a regular name and not the URL. I think it would be nice if name can be either URL or a name. But the actual check is done in init . I'm have very basic Python knowledge and trying to fix this would take a lot of time.

gronke commented 5 years ago

That regression was introduced when becoming stricter with the paths in the puppet provisioner. The source should be the index repository (https://github.com/freenas/iocage-ix-plugins) while the name defines the actual plugin to install. Therefore the provvision.name needs to be restore.

urosgruber commented 5 years ago

Also one other thing I noticed, that overlay folder is not copied over as per iocage implementation. Should I create a separate ticket?

gronke commented 5 years ago

Also one other thing I noticed, that overlay folder is not copied over as per iocage implementation. Should I create a separate ticket?

Can be fixed in the same pull-request I guess. Maybe you spot even more differences.

urosgruber commented 5 years ago

I think this is what I found with a couple of bugs. I'll create a PR for one bug on events

gronke commented 5 years ago

@igalic would a provision.name be useful for puppet?

igalic commented 5 years ago

if we had a bunch of different control-repos on the same host, and actually cached them, instead of of doing it per-jail…