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

support publishing to local repositories/storage #30

Merged
merged 1 commit into from
Sep 20, 2021

Conversation

umlaeute
Copy link
Contributor

@umlaeute umlaeute commented Sep 14, 2021

at least with aptly 1.4.0+ds1-4+b4 doing a simple PUT /api/publish/local-repo or DELETE /api/publish/local-repo will result in a 404.

the proper way is to either use a storage specification :. or leave it
empty (but keep the slash intact)

Closes: #29

@pep8speaks
Copy link

pep8speaks commented Sep 14, 2021

Hello @umlaeute! Thanks for updating this PR. We checked the lines you've touched for PEP 8 issues, and found:

There are currently no PEP 8 issues detected in this Pull Request. Cheers! 🍻

Comment last updated at 2021-09-14 11:43:01 UTC

@umlaeute
Copy link
Contributor Author

umlaeute commented Sep 14, 2021

possibly my fix is bogus and the real problem is in the prefix handling (but i'm slightly confused about the --prefix flag).

in any case, i think that using the default storage should give a working config ;-)

at least with aptly_1.4.0+ds1-4+b4 (found in Debian) doing a simple
"PUT /api/publish/local-repo" or "DELETE /api/publish/local-repo"
will result in a 404.

the proper way is to either use a storage specification ":." or leave it
empty (but keep the slash intact)

Closes: tcpcloud#29
@umlaeute
Copy link
Contributor Author

Hello @umlaeute! Thanks for opening this PR. We checked the lines you've touched for PEP 8 issues, and found:

force pushed to fix this (although this was legacy cruft and i originally only touched other parts of this line)

@fpytloun fpytloun merged commit d9f07ca into tcpcloud:master Sep 20, 2021
@NeroBurner
Copy link
Contributor

I can confirm this fixes the issue for me running against aptly 1.5.0+162+g8029305d (latest nightly at the time aptly-dev/aptly@8029305 ) on newer Ubuntu releases (except 24.04)

Tested running the following command on Ubuntu 20.04, 22.04 on current master d9f07ca

python3 -m aptly.publisher --config config.yml --url http://example.com/aptly publish --force-overwrite --recreate

On Ubuntu 18.04 the current master is broken resulting in a 404 error

Traceback (most recent call last):
  File "/usr/lib/python3.6/runpy.py", line 193, in _run_module_as_main
    "__main__", mod_spec)
  File "/usr/lib/python3.6/runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "/home/gc/repos/aptly/python-aptly/aptly/publisher/__main__.py", line 352, in <module>
    main()
  File "/home/gc/repos/aptly/python-aptly/aptly/publisher/__main__.py", line 97, in main
    components=args.components)
  File "/home/gc/repos/aptly/python-aptly/aptly/publisher/__main__.py", line 348, in action_publish
    components=components)
  File "/home/gc/repos/aptly/python-aptly/aptly/publisher/__init__.py", line 117, in do_publish
    publish.do_publish(*args, **kwargs)
  File "/home/gc/repos/aptly/python-aptly/aptly/publisher/__init__.py", line 768, in do_publish
    self.drop_publish()
  File "/home/gc/repos/aptly/python-aptly/aptly/publisher/__init__.py", line 694, in drop_publish
    self.client.do_delete('/publish/%s' % (self.full_name))
  File "/home/gc/repos/aptly/python-aptly/aptly/client.py", line 88, in do_delete
    return self._process_result(res)
  File "/home/gc/repos/aptly/python-aptly/aptly/client.py", line 33, in _process_result
    "Something went wrong: %s (%s)" % (res.reason, res.status_code)
aptly.exceptions.AptlyException: Something went wrong: Not Found (404)

On Ubuntu 18.04 the current release python-aptly 0.12.12 works, but other newer Ubuntu versions are broken

On Ubuntu 24.04 noble the command errors with the following message (both master and 0.12.12):

Traceback (most recent call last):
  File "<frozen runpy>", line 198, in _run_module_as_main
  File "<frozen runpy>", line 88, in _run_code
  File "/home/gc/repos/aptly/python-aptly/aptly/publisher/__main__.py", line 352, in <module>
    main()
  File "/home/gc/repos/aptly/python-aptly/aptly/publisher/__main__.py", line 87, in main
    action_publish(client, publishmgr, config_file=args.config,
  File "/home/gc/repos/aptly/python-aptly/aptly/publisher/__main__.py", line 313, in action_publish
    config = load_config(config_file)
             ^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/gc/repos/aptly/python-aptly/aptly/publisher/__main__.py", line 23, in load_config
    return yaml.load(fh)
           ^^^^^^^^^^^^^
TypeError: load() missing 1 required positional argument: 'Loader'

I'll open an issue for Ubuntu 24.04 support. Should be related to the deprecation warning issued in Ubuntu 22.04 run:

/home/gc/repos/aptly/python-aptly/aptly/publisher/__main__.py:23: YAMLLoadWarning: calling yaml.load() without Loader=... is deprecated, as the default Loader is unsafe. Please read https://msg.pyyaml.org/load for full details.
  return yaml.load(fh)

@umlaeute
Copy link
Contributor Author

the error about the unsafe YAML parser is unrelated to this PR (it's just that newer versions of Python's yaml module become increasingly strict). i guess you should open a separate issue for that.

@NeroBurner
Copy link
Contributor

yes, opened issue: #32 and related PR fixing it, similar to how Ubuntu/Debian fixed it: #34

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.

promoting with local storage fails: Something went wrong
4 participants