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

[Enhancement]: Provide a script for generating launchpad credentials separately from snapcraft #18

Open
lengau opened this issue Mar 26, 2024 · 2 comments
Assignees
Labels
enhancement New feature or request

Comments

@lengau
Copy link
Contributor

lengau commented Mar 26, 2024

What changes would you like?

Grabbing the credentials file that snapcraft generates is mostly okay, but it would be ideal to have a script that'll generate one that:

  1. Can use a different user
  2. Isn't a system-wide consumer
  3. Has limited access

Any extra information?

It came out of this discussion on Matrix: https://matrix.to/#/!cniCqhKpzVvOBMHAVt:matrix.org/$EWg88A8PPRwiC2IBGh671MiVjvVZlYp14287woJKw04

I'm mostly filing this as a TODO for myself, but if anyone else happens to do it before I get around to it I'll be grateful :-)

@lengau lengau added the enhancement New feature or request label Mar 26, 2024
@lengau lengau self-assigned this Mar 26, 2024
@lengau
Copy link
Contributor Author

lengau commented Mar 26, 2024

This gets a basic version, but doesn't really achieve what should be in the docs:

import sys
import tempfile
from launchpadlib.launchpad import Launchpad
from launchpadlib.uris import LPNET_SERVICE_ROOT

with tempfile.NamedTemporaryFile("w+") as credentials_file:

    Launchpad.login_with(
        application_name="Snapcrafters CI",
        service_root=LPNET_SERVICE_ROOT,
        credentials_file=credentials_file.name,
        version="devel",
        consumer_name="Snapcrafters CI"
    )

    print(credentials_file.read())

@soumyaDghosh
Copy link
Member

I think the tokenator is the best repo for this issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants