freebsd / iocage

A FreeBSD jail manager
Other
25 stars 10 forks source link

iocage fetch fails due to recent patch #28

Closed Defenso-QTH closed 2 months ago

Defenso-QTH commented 2 months ago

Bug introduced by 04133bd.

Dataset.create expects a data argument.

Test output:

=================================== FAILURES ===================================
__________________________________ test_fetch __________________________________

release = '14.1-RELEASE', server = 'download.freebsd.org', user = 'anonymous'
password = 'anonymous@', auth = None, root_dir = None, http = False
_file = False, noupdate = False
invoke_cli = <function invoke_cli.<locals>.invoke at 0x3905231c3880>

    @require_root
    @require_zpool
    def test_fetch(
        release, server, user, password, auth,
        root_dir, http, _file, noupdate, invoke_cli
    ):
        command = ['fetch', '-r', release]
        command += ['-s', server] if server else []
        command += ['-h'] if http else []
        command += ['-f', _file] if _file else []
        command += ['-u', user] if user else []
        command += ['-p', password] if password else []
        command += ['-a', auth] if auth else []
        command += ['-d', root_dir] if root_dir else []
        command += ['-NU'] if noupdate else []

>       invoke_cli(
            command
        )

tests/functional_tests/0002_fetch_test.py:47: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

cmd = ['iocage', 'fetch', '-r', '14.1-RELEASE', '-s', 'download.freebsd.org', ...]
reason = 'Traceback (most recent call last):\n  File "/usr/local/bin/iocage", line 10, in <module>\n    sys.exit(cli())\n             ^^^^^\n  File "/usr/local/lib/python3.11/site-packages/click/core.py", line 1157, in __call__\n    return self.main(*args, **kwargs)\n           ^^^^^^^^^^^^^^^^^^^^^^^^^^\n  File "/usr/local/lib/python3.11/site-packages/click/core.py", line 1078, in main\n    rv = self.invoke(ctx)\n         ^^^^^^^^^^^^^^^^\n  File "/usr/local/lib/python3.11/site-packages/click/core.py", line 1688, in invoke\n    return _process_result(sub_ctx.command.invoke(sub_ctx))\n                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n  File "/usr/local/lib/python3.11/site-packages/click/core.py", line 1434, in invoke\n    return ctx.invoke(self.callback, **ctx.params)\n           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n  File "/usr/local/lib/python3.11/site-packages/click/core.py", line 783, in invoke\n    return __callback(*args, **kwargs)\n           ^^^^^^^^^^^^^^^^^^^^^^^^^^^\n  File "/usr/local/lib/python3.11/site-packages/iocage_lib-1.7-py3.11.egg/iocage_cli/fetch.py", line 181, in cli\n    ioc.IOCage().fetch(**kwargs)\n  File "/usr/local/lib/python3.11/site-packages/iocage_lib-1.7-py3.11.egg/iocage_lib/iocage.py", line 1121, in fetch\n    **kwargs).fetch_release()\n              ^^^^^^^^^^^^^^^\n  File "/usr/local/lib/python3.11/site-packages/iocage_lib-1.7-py3.11.egg/iocage_lib/ioc_fetch.py", line 215, in fetch_release\n    rel = self.fetch_http_release(eol, _list=_list)\n          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n  File "/usr/local/lib/python3.11/site-packages/iocage_lib-1.7-py3.11.egg/iocage_lib/ioc_fetch.py", line 445, in fetch_http_release\n    self.fetch_download(self.files)\n  File "/usr/local/lib/python3.11/site-packages/iocage_lib-1.7-py3.11.egg/iocage_lib/ioc_fetch.py", line 664, in fetch_download\n    ds.create()\nTypeError: Dataset.create() missing 1 required positional argument: \'data\'\n'
assert_returncode = True

    def invoke(cmd, reason=None, assert_returncode=True):
        cmd.insert(0, 'iocage')
        cmd = [str(c) for c in cmd]

        result = subprocess.run(
            cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE
        )
        reason = f'{reason}: {result.stderr}' if reason else result.stderr

        if assert_returncode:
            # Empty or Template jails that should not be started/stopped but
            # sometimes make it in due to a race
            try:
                reason = reason.decode()
            except AttributeError:
                pass

            if 'execvp: /bin/sh: No such' not in reason:
>               assert result.returncode == 0, reason
E               AssertionError: Traceback (most recent call last):
E                   File "/usr/local/bin/iocage", line 10, in <module>
E                     sys.exit(cli())
E                              ^^^^^
E                   File "/usr/local/lib/python3.11/site-packages/click/core.py", line 1157, in __call__
E                     return self.main(*args, **kwargs)
E                            ^^^^^^^^^^^^^^^^^^^^^^^^^^
E                   File "/usr/local/lib/python3.11/site-packages/click/core.py", line 1078, in main
E                     rv = self.invoke(ctx)
E                          ^^^^^^^^^^^^^^^^
E                   File "/usr/local/lib/python3.11/site-packages/click/core.py", line 1688, in invoke
E                     return _process_result(sub_ctx.command.invoke(sub_ctx))
E                                            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
E                   File "/usr/local/lib/python3.11/site-packages/click/core.py", line 1434, in invoke
E                     return ctx.invoke(self.callback, **ctx.params)
E                            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
E                   File "/usr/local/lib/python3.11/site-packages/click/core.py", line 783, in invoke
E                     return __callback(*args, **kwargs)
E                            ^^^^^^^^^^^^^^^^^^^^^^^^^^^
E                   File "/usr/local/lib/python3.11/site-packages/iocage_lib-1.7-py3.11.egg/iocage_cli/fetch.py", line 181, in cli
E                     ioc.IOCage().fetch(**kwargs)
E                   File "/usr/local/lib/python3.11/site-packages/iocage_lib-1.7-py3.11.egg/iocage_lib/iocage.py", line 1121, in fetch
E                     **kwargs).fetch_release()
E                               ^^^^^^^^^^^^^^^
E                   File "/usr/local/lib/python3.11/site-packages/iocage_lib-1.7-py3.11.egg/iocage_lib/ioc_fetch.py", line 215, in fetch_release
E                     rel = self.fetch_http_release(eol, _list=_list)
E                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
E                   File "/usr/local/lib/python3.11/site-packages/iocage_lib-1.7-py3.11.egg/iocage_lib/ioc_fetch.py", line 445, in fetch_http_release
E                     self.fetch_download(self.files)
E                   File "/usr/local/lib/python3.11/site-packages/iocage_lib-1.7-py3.11.egg/iocage_lib/ioc_fetch.py", line 664, in fetch_download
E                     ds.create()
E                 TypeError: Dataset.create() missing 1 required positional argument: 'data'
E                 
E               assert 1 == 0
E                +  where 1 = CompletedProcess(args=['iocage', 'fetch', '-r', '14.1-RELEASE', '-s', 'download.freebsd.org', '-u', 'anonymous', '-p', 'anonymous@'], returncode=1, stdout=b'Creating pool/iocage\nCreating pool/iocage/download\nCreating pool/iocage/images\nCreating pool/iocage/jails\nCreating pool/iocage/log\nCreating pool/iocage/releases\nCreating pool/iocage/templates\nDefault configuration missing, creating one\nFetching: 14.1-RELEASE\n\n', stderr=b'Traceback (most recent call last):\n  File "/usr/local/bin/iocage", line 10, in <module>\n    sys.exit(cli())\n             ^^^^^\n  File "/usr/local/lib/python3.11/site-packages/click/core.py", line 1157, in __call__\n    return self.main(*args, **kwargs)\n           ^^^^^^^^^^^^^^^^^^^^^^^^^^\n  File "/usr/local/lib/python3.11/site-packages/click/core.py", line 1078, in main\n    rv = self.invoke(ctx)\n         ^^^^^^^^^^^^^^^^\n  File "/usr/local/lib/python3.11/site-packages/click/core.py", line 1688, in invoke\n    return _process_result(sub_ctx.command.invoke(sub_ctx))\n                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n  File "/usr/local/lib/python3.11/site-packages/click/core.py", line 1434, in invoke\n    return ctx.invoke(self.callback, **ctx.params)\n           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n  File "/usr/local/lib/python3.11/site-packages/click/core.py", line 783, in invoke\n    return __callback(*args, **kwargs)\n           ^^^^^^^^^^^^^^^^^^^^^^^^^^^\n  File "/usr/local/lib/python3.11/site-packages/iocage_lib-1.7-py3.11.egg/iocage_cli/fetch.py", line 181, in cli\n    ioc.IOCage().fetch(**kwargs)\n  File "/usr/local/lib/python3.11/site-packages/iocage_lib-1.7-py3.11.egg/iocage_lib/iocage.py", line 1121, in fetch\n    **kwargs).fetch_release()\n              ^^^^^^^^^^^^^^^\n  File "/usr/local/lib/python3.11/site-packages/iocage_lib-1.7-py3.11.egg/iocage_lib/ioc_fetch.py", line 215, in fetch_release\n    rel = self.fetch_http_release(eol, _list=_list)\n          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n  File "/usr/local/lib/python3.11/site-packages/iocage_lib-1.7-py3.11.egg/iocage_lib/ioc_fetch.py", line 445, in fetch_http_release\n    self.fetch_download(self.files)\n  File "/usr/local/lib/python3.11/site-packages/iocage_lib-1.7-py3.11.egg/iocage_lib/ioc_fetch.py", line 664, in fetch_download\n    ds.create()\nTypeError: Dataset.create() missing 1 required positional argument: \'data\'\n').returncode

tests/conftest.py:279: AssertionError
dgeo commented 2 months ago

Sorry… could you test this fix, I suppose this should work, Dataset.create definitely needs a 'properties' arg :/

dgeo commented 2 months ago

Your fix was better ;) Thank you @Defenso-QTH