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

Problem with plugin #3021

Open
ScarletEmanu opened this issue Dec 14, 2024 · 0 comments
Open

Problem with plugin #3021

ScarletEmanu opened this issue Dec 14, 2024 · 0 comments

Comments

@ScarletEmanu
Copy link

There are some bugs in file "archinstall/lib/plugins.py" and "archinstall/init.py".

First problem

If I add --plugin https://raw.githubusercontent.com/phisch/archinstall-aur/master/archinstall-aur.py in archinstall command, this error appears:

Loading plugin from url ParseResult(scheme='https', netloc='raw.githubusercontent.com', path='/phisch/archinstall-aur/refs/heads/master/archinstall-aur.py', params='', query='', fragment='')
Traceback (most recent call last):
  File "/home/archi/MyArchIso/install.py", line 3, in <module>
    from my_global_menu import Menu
  File "/home/archi/MyArchIso/my_global_menu.py", line 1, in <module>
    from archinstall.lib.global_menu import GlobalMenu
  File "/usr/lib/python3.12/site-packages/archinstall/__init__.py", line 282, in <module>
    post_process_arguments(arguments)
  File "/usr/lib/python3.12/site-packages/archinstall/__init__.py", line 275, in post_process_arguments
    load_plugin(path)
  File "/usr/lib/python3.12/site-packages/archinstall/lib/plugins.py", line 95, in load_plugin
    localized = _localize_path(path)
                ^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.12/site-packages/archinstall/lib/plugins.py", line 38, in _localize_path
    converted_path = Path(f'/tmp/{path.stem}_{hashlib.md5(os.urandom(12)).hexdigest()}.py')
                                  ^^^^^^^^^
AttributeError: 'str' object has no attribute 'stem'

Seems that the problem is in function post_process_arguments in file archinstall/__init__.py. This function passes a string to the function load_plugin instead of a 'Path' object.
I changed line 276 to path = Path(args['plugin']) and the problem was solved.

#Second Problem #
At this point new problem came out:

Loading plugin from url ParseResult(scheme='https', netloc='', path='/raw.githubusercontent.com/phisch/archinstall-aur/refs/heads/master/archinstall-aur.py', params='', query='', fragment='')
Traceback (most recent call last):
  File "/home/archi/MyArchIso/install.py", line 3, in <module>
    from my_global_menu import Menu
  File "/home/archi/MyArchIso/my_global_menu.py", line 1, in <module>
    from archinstall.lib.global_menu import GlobalMenu
  File "/usr/lib/python3.12/site-packages/archinstall/__init__.py", line 282, in <module>
    post_process_arguments(arguments)
  File "/usr/lib/python3.12/site-packages/archinstall/__init__.py", line 275, in post_process_arguments
    load_plugin(path)
  File "/usr/lib/python3.12/site-packages/archinstall/lib/plugins.py", line 95, in load_plugin
    localized = _localize_path(path)
                ^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.12/site-packages/archinstall/lib/plugins.py", line 41, in _localize_path
    temp_file.write(urllib.request.urlopen(url.geturl()).read().decode('utf-8'))
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.12/urllib/request.py", line 215, in urlopen
    return opener.open(url, data, timeout)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.12/urllib/request.py", line 512, in open
    req = meth(req)
          ^^^^^^^^^
  File "/usr/lib/python3.12/urllib/request.py", line 1268, in do_request_
    raise URLError('no host given')
urllib.error.URLError: <urlopen error no host given>

The problem seems localized in funcion _localize_path in file archinstall/lib/plugins.py, where funcion url.geturl() return "https:///raw.githubusercontent.com/phisch/archinstall-aur/master/archinstall-aur.py" (there are 3 backslash after "https:").

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

No branches or pull requests

1 participant