-
Notifications
You must be signed in to change notification settings - Fork 43
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
feat: add AutoYaST error reporting #1476
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
…uestion is created
Co-authored-by: Martin Vidner <[email protected]>
rust/agama-cli/src/questions.rs
Outdated
@@ -71,11 +72,14 @@ async fn ask_question() -> Result<(), ServiceError> { | |||
let question = serde_json::from_reader(std::io::stdin())?; | |||
|
|||
let created_question = client.create_question(&question).await?; | |||
let answer = client.get_answer(created_question.generic.id).await?; | |||
let Some(id) = created_question.generic.id else { | |||
return Err(ServiceError::QuestionNotExist(0)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What does that '0' mean? It looks like the error is not exactly that the question does not exist.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To be honest this should not happen as it is assigned in that create_question from created question path. I am not sure if we should have something like Programatic error or something that for cases which should not happen and user cannot do naything with it
@@ -19,7 +19,8 @@ pub struct Question { | |||
#[derive(Clone, Serialize, Deserialize, utoipa::ToSchema)] | |||
#[serde(rename_all = "camelCase")] | |||
pub struct GenericQuestion { | |||
pub id: u32, | |||
/// id is optional as newly created questions does not have it assigned | |||
pub id: Option<u32>, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If we get rid of D-Bus in the future, we might consider using an uuid instead of dealing with an Option. But that's out of scope.
# rubocop:disable Lint/UnusedMethodArgument | ||
module Yast2 | ||
# :nodoc: | ||
class Popup |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can see some duplication.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yeah, I forget to remove it
def run | ||
# at first construct agama question to display. | ||
text = @label | ||
question = { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Asking the question seems like a repetitive process. It may not be needed by now, but we might consider having a helper method/class to do so.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
agreed.
Co-authored-by: Imobach González Sosa <[email protected]> Co-authored-by: David Díaz <[email protected]>
Commit fc249f8 introduces a few improvements to the tests:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please, take into account @dgdavid's comment about the test description and you can merge.
Co-authored-by: Imobach González Sosa <[email protected]> Co-authored-by: David Díaz <[email protected]>
There is some troubles with PRG cluster affecting also opensuse services. So tests are red due to failed to load testing container. Will merge even with it as previously it was green and change is just some text changes. |
Prepare for releasing Agama 10· * #1263 * #1330 * #1407 * #1408 * #1410 * #1411 * #1412 * #1416 * #1417 * #1419 * #1420 * #1421 * #1422 * #1423 * #1424 * #1425 * #1428 * #1429 * #1430 * #1431 * #1432 * #1433 * #1436 * #1437 * #1438 * #1439 * #1440 * #1441 * #1443 * #1444 * #1445 * #1449 * #1450 * #1451 * #1452 * #1453 * #1454 * #1455 * #1456 * #1457 * #1459 * #1460 * #1462 * #1464 * #1465 * #1466 * #1467 * #1468 * #1469 * #1470 * #1471 * #1472 * #1473 * #1475 * #1476 * #1477 * #1478 * #1479 * #1480 * #1481 * #1482 * #1483 * #1484 * #1485 * #1486 * #1487 * #1488 * #1489 * #1491 * #1492 * #1493 * #1494 * #1496 * #1497 * #1498 * #1499 * #1500 * #1501 * #1502 * #1503 * #1504 * #1505 * #1506 * #1507 * #1508 * #1510 * #1511 * #1512 * #1513 * #1514 * #1515 * #1516 * #1517 * #1518 * #1519 * #1520 * #1522 * #1523 * #1524 * #1525 * #1526 * #1527 * #1528 * #1529 * #1530 * #1531 * #1532 * #1533 * #1534 * #1535 * #1536 * #1537 * #1540 * #1541 * #1543 * #1544 * #1545 * #1546 * #1547 * #1548 * #1549 * #1550 * #1552 * #1553 * #1554 * #1555 * #1556 * #1557 * #1558 * #1559 * #1560 * #1562 * #1563 * #1565 * #1566 * #1567 * #1568 * #1569 * #1570 * #1571 * #1572 * #1573 * #1574 * #1575 * #1576 * #1577 * #1578 * #1579 * #1580 * #1581 * #1583 * #1584 * #1585 * #1586 * #1587 * #1588 * #1589 * #1590 * #1591 * #1592 * #1593 * #1596 * #1597 * #1598 * #1600 * #1602 * #1605 * #1606 * #1607 * #1608 * #1610 * #1611 * #1612 * #1613 * #1614 * #1619 * #1620 * #1621
Problem
Autoyast conversion script can try to open ui for reporting errors or ask questions.
Solution
Monkey patch it to use agama question mechanism. This change tries to cover the most common cases.
It also needs to implement generic Question with Password react component.
And last but not least during manual testing few issues are revealed and fixed. Also as part of change listing of all question was fixed to really show only unanswered ones and optimize it to use ObjectManager methods.
Testing
For testing CLI for asking this command is used:
agama questions ask < data.json
For testing autoyast questions it uses encrypted autoyast profile that ask for password and also report issue when password is wrong: