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

add post method to create new question #1451

Merged
merged 5 commits into from
Jul 10, 2024
Merged

add post method to create new question #1451

merged 5 commits into from
Jul 10, 2024

Conversation

jreidinger
Copy link
Contributor

Problem

http interface currently does not have a way to create question with it. But it is needed to e.g. ask questions from autoyast converter script.

Solution

Add it and together also remove password from question as it should not be preset.

Copy link
Contributor

@imobachgs imobachgs left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In general it looks OK. Perhaps we should plan to refactor the questions a bit so the D-Bus service and the HTTP API are just that... APIs. In the network area, we use message passing and I think for questions we should do something similar (and integrate the D-Bus and the HTTP services into a single service).

But that's out of scope.

let id_matcher = Regex::new(r"/(?<id>\d+)$").unwrap();
let Some(id_cap) = id_matcher.captures(path.as_str()) else {
panic!("Id not in path")
}; // TODO: better error if path does not contain id
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this code crash the server?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeap, it terminates...but it should never happen as new question if method succeed should always return id as part of path

@jreidinger jreidinger marked this pull request as ready for review July 10, 2024 10:02
Copy link
Contributor

@imobachgs imobachgs left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just a typo. Otherwise, LGTM.

rust/package/agama.changes Outdated Show resolved Hide resolved
Co-authored-by: Imobach González Sosa <igonzalezsosa@suse.com>
@jreidinger jreidinger merged commit 8fb914b into master Jul 10, 2024
1 check passed
@jreidinger jreidinger deleted the ask_question_http branch July 10, 2024 10:18
@imobachgs imobachgs mentioned this pull request Sep 20, 2024
imobachgs added a commit that referenced this pull request Sep 20, 2024
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.

2 participants