Skip to content

Commit

Permalink
Merge branch 'master' into repository_retry
Browse files Browse the repository at this point in the history
  • Loading branch information
lslezak authored Jan 17, 2025
2 parents 7d1543f + db4e151 commit 4ca53aa
Show file tree
Hide file tree
Showing 27 changed files with 185 additions and 36 deletions.
9 changes: 9 additions & 0 deletions doc/answers_example.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"answers": [
{
"answer": "decrypt",
"class": "storage.luks_activation",
"password": "my_password"
}
]
}
3 changes: 0 additions & 3 deletions doc/answers_example.yaml

This file was deleted.

8 changes: 8 additions & 0 deletions live/src/agama-installer.changes
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
-------------------------------------------------------------------
Wed Jan 15 16:53:28 UTC 2025 - Eugenio Paolantonio <[email protected]>

- Drop patterns-yast-yast2_basis requirement
yast packages should be installed per package and not as
a whole pattern.
(gh#agama-project/agama#1893).

-------------------------------------------------------------------
Fri Jan 10 21:22:03 UTC 2025 - Imobach Gonzalez Sosa <[email protected]>

Expand Down
1 change: 0 additions & 1 deletion live/src/agama-installer.kiwi
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,6 @@
<package name="blog" arch="s390x" />
<package name="libblogger2" arch="s390x" />
<package name="xauth"/>
<package name="patterns-yast-yast2_basis"/>
<package name="MozillaFirefox"/>
<package name="libpwquality-tools"/>
<package name="NetworkManager"/>
Expand Down
5 changes: 5 additions & 0 deletions products.d/agama-products.changes
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
-------------------------------------------------------------------
Thu Jan 16 15:12:08 UTC 2025 - Josef Reidinger <[email protected]>

- Update also base product from SLES-SAP to SLES_SAP(bsc#1235956)

-------------------------------------------------------------------
Mon Jan 13 09:04:21 UTC 2025 - Imobach Gonzalez Sosa <[email protected]>

Expand Down
2 changes: 1 addition & 1 deletion products.d/sles_sap_160.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ software:
mandatory_packages:
- NetworkManager
optional_packages: null
base_product: SLES-SAP
base_product: SLES_SAP

security:
lsm: selinux
Expand Down
2 changes: 1 addition & 1 deletion rust/agama-cli/src/profile.rs
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ pub enum ProfileCommands {
/// installation. Unless there is a need to inject additional commands between processing
/// use this command instead of set of underlying commands.
Import {
/// Profile's URL. Supports the same schemas than te "download" command plus
/// Profile's URL. Supports the same schemas as the "download" command plus
/// AutoYaST specific ones. Supported files are json, jsonnet, sh for Agama profiles and ERB, XML, and rules/classes directories
/// for AutoYaST support.
url: String,
Expand Down
1 change: 1 addition & 0 deletions rust/agama-server/src/web.rs
Original file line number Diff line number Diff line change
Expand Up @@ -224,6 +224,7 @@ async fn run_events_monitor(dbus: zbus::Connection, events: EventsSender) -> Res
tokio::pin!(stream);
let e = events.clone();
while let Some((_, event)) = stream.next().await {
tracing::info!("event: {:?}", &event);
_ = e.send(event);
}
Ok(())
Expand Down
5 changes: 4 additions & 1 deletion rust/agama-server/src/web/ws.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,10 @@ async fn handle_socket(mut socket: WebSocket, events: EventsSender) {
let mut rx = events.subscribe();
while let Ok(msg) = rx.recv().await {
if let Ok(json) = serde_json::to_string(&msg) {
_ = socket.send(Message::Text(json)).await;
if socket.send(Message::Text(json)).await.is_err() {
tracing::info!("ws: client disconnected");
return;
}
}
}
}
12 changes: 12 additions & 0 deletions rust/package/agama.changes
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,18 @@ Fri Jan 17 15:50:15 UTC 2025 - Ladislav Slezák <[email protected]>
for reading the currently configured repositories,
related to (gh#agama-project/agama#1894)

-------------------------------------------------------------------
Thu Jan 16 13:10:54 UTC 2025 - Imobach Gonzalez Sosa <[email protected]>

- Stop the WebSocket handler when the client is disconnected
(gh#agama-project/agama#1909).
- Log the events.

-------------------------------------------------------------------
Thu Jan 16 09:32:00 UTC 2025 - Martin Vidner <[email protected]>

- Fix typo in `agama profile import --help` (bsc#1235827)

-------------------------------------------------------------------
Fri Jan 10 21:22:01 UTC 2025 - Imobach Gonzalez Sosa <[email protected]>

Expand Down
18 changes: 16 additions & 2 deletions service/Gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,13 +1,17 @@
PATH
remote: .
specs:
agama-yast (11)
agama-yast (11.devel4)
cfa (~> 1.0.2)
cfa_grub2 (~> 2.0.0)
cheetah (~> 1.0.0)
csv (~> 3.3)
eventmachine (~> 1.2.7)
fast_gettext (~> 2.3.0)
logger (~> 1.6)
nokogiri (~> 1.15)
ostruct (~> 0.6.1)
prime (~> 0.1.3)
rexml (~> 3.2)
ruby-dbus (>= 0.23.1, < 1.0)

Expand All @@ -22,14 +26,23 @@ GEM
cfa (~> 1.0)
cheetah (1.0.0)
abstract_method (~> 1.2)
csv (3.3.2)
diff-lcs (1.5.1)
docile (1.4.1)
eventmachine (1.2.7)
fast_gettext (2.3.0)
nokogiri (1.16.7-x86_64-linux)
forwardable (1.3.3)
logger (1.6.5)
mini_portile2 (2.8.8)
nokogiri (1.16.7)
mini_portile2 (~> 2.8.2)
racc (~> 1.4)
ostruct (0.6.1)
packaging_rake_tasks (1.5.4)
rake
prime (0.1.3)
forwardable
singleton
racc (1.8.1)
rake (13.0.6)
rexml (3.2.9)
Expand Down Expand Up @@ -57,6 +70,7 @@ GEM
simplecov-html (0.12.3)
simplecov-lcov (0.8.0)
simplecov_json_formatter (0.1.4)
singleton (0.3.0)
strscan (3.1.0)
yard (0.9.36)

Expand Down
4 changes: 4 additions & 0 deletions service/agama-yast.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -59,4 +59,8 @@ Gem::Specification.new do |spec|
spec.add_dependency "nokogiri", "~> 1.15"
spec.add_dependency "rexml", "~> 3.2"
spec.add_dependency "ruby-dbus", ">= 0.23.1", "< 1.0"
spec.add_dependency "csv", "~> 3.3"
spec.add_dependency "prime", "~> 0.1.3"
spec.add_dependency "logger", "~> 1.6"
spec.add_dependency "ostruct", "~> 0.6.1"
end
4 changes: 3 additions & 1 deletion service/lib/agama/software/proposal.rb
Original file line number Diff line number Diff line change
Expand Up @@ -86,8 +86,10 @@ def set_resolvables(unique_id, type, resolvables, optional: false)
# @return [Boolean]
def calculate
initialize_target
select_base_product
@proposal = Yast::Packages.Proposal(force_reset = true, reinit = false, _simple = true)
# select the base product after running the Packages.Proposal, the force_reset = true
# option would reset the selection and a random product would be selected by the solver
select_base_product
solve_dependencies

valid?
Expand Down
11 changes: 11 additions & 0 deletions service/package/rubygem-agama-yast.changes
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,17 @@ Fri Jan 17 15:47:39 UTC 2025 - Ladislav Slezák <[email protected]>
- The software service provides DBus API for reading the currently
configured repositories, related to (gh#agama-project/agama#1894)

-------------------------------------------------------------------
Thu Jan 16 17:30:03 UTC 2025 - Ladislav Slezák <[email protected]>

- Correctly select the base product to install (bsc#1235931)

-------------------------------------------------------------------
Wed Jan 15 14:26:11 UTC 2025 - José Iván López González <[email protected]>

- Add missing gems to the gemspec file
(gh#agama-project/agama#1899).

-------------------------------------------------------------------
Fri Jan 10 21:22:00 UTC 2025 - Imobach Gonzalez Sosa <[email protected]>

Expand Down
12 changes: 12 additions & 0 deletions web/package/agama-web-ui.changes
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,18 @@ Fri Jan 17 15:51:15 UTC 2025 - Ladislav Slezák <[email protected]>
again if some repository failed to load
(gh#agama-project/agama#1894)

-------------------------------------------------------------------
Thu Jan 16 13:11:06 UTC 2025 - Imobach Gonzalez Sosa <[email protected]>

- Display error messages during package installation
(gh#agama-project/agama#1909).

-------------------------------------------------------------------
Mon Jan 13 11:11:49 UTC 2025 - David Diaz <[email protected]>

- Do not allow changing selected product after registering one
(related to gh#agama-project/agama#1891).

-------------------------------------------------------------------
Fri Jan 10 21:22:02 UTC 2025 - Imobach Gonzalez Sosa <[email protected]>

Expand Down
15 changes: 10 additions & 5 deletions web/src/client/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,10 @@
* find current contact information at www.suse.com.
*/

import { WSClient } from "./ws";
import { WSClient, EventHandlerFn, ErrorHandlerFn } from "./ws";

type VoidFn = () => void;
type BooleanFn = () => boolean;
type EventHandlerFn = (event) => void;

export type InstallerClient = {
/** Whether the client is connected. */
Expand All @@ -37,10 +36,15 @@ export type InstallerClient = {
*/
onConnect: (handler: VoidFn) => VoidFn;
/**
* Registers a handler to run when connection is lost. It returns a function
* Registers a handler to run when connection is closed. It returns a function
* for deregistering the handler.
*/
onDisconnect: (handler: VoidFn) => VoidFn;
onClose: (handler: VoidFn) => VoidFn;
/**
* Registers a handler to run when there is an error. It returns a function
* for deregistering the handler.
*/
onError: (handler: ErrorHandlerFn) => VoidFn;
/**
* Registers a handler to run on events. It returns a function for
* deregistering the handler.
Expand All @@ -66,7 +70,8 @@ const createClient = (url: URL): InstallerClient => {
isConnected,
isRecoverable,
onConnect: (handler: VoidFn) => ws.onOpen(handler),
onDisconnect: (handler: VoidFn) => ws.onClose(handler),
onClose: (handler: VoidFn) => ws.onClose(handler),
onError: (handler: ErrorHandlerFn) => ws.onError(handler),
onEvent: (handler: EventHandlerFn) => ws.onEvent(handler),
};
};
Expand Down
19 changes: 10 additions & 9 deletions web/src/client/ws.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@

type RemoveFn = () => void;
type BaseHandlerFn = () => void;
type EventHandlerFn = (event) => void;
export type EventHandlerFn = (event) => void;
export type ErrorHandlerFn = (error: object) => void;

/**
* Enum for the WebSocket states.
Expand Down Expand Up @@ -53,7 +54,7 @@ class WSClient {
handlers: {
open: Array<BaseHandlerFn>;
close: Array<BaseHandlerFn>;
error: Array<BaseHandlerFn>;
error: Array<ErrorHandlerFn>;
events: Array<EventHandlerFn>;
};

Expand Down Expand Up @@ -109,14 +110,14 @@ class WSClient {
};

client.onclose = () => {
console.log(`WebSocket closed`);
console.log("WebSocket closed");
this.dispatchCloseEvent();
this.timeout = setTimeout(() => this.connect(this.reconnectAttempts + 1), ATTEMPT_INTERVAL);
};

client.onerror = (e) => {
console.error("WebSocket error:", e);
this.dispatchErrorEvent();
client.onerror = (error) => {
console.error("WebSocket error:", error);
this.dispatchErrorEvent(error);
};

return client;
Expand Down Expand Up @@ -179,7 +180,7 @@ class WSClient {
*
* The handler is executed when an error is reported by the socket.
*/
onError(func: BaseHandlerFn): RemoveFn {
onError(func: ErrorHandlerFn): RemoveFn {
this.handlers.error.push(func);

return () => {
Expand Down Expand Up @@ -214,8 +215,8 @@ class WSClient {
*
* Dispatchs an error event by running all its handlers.
*/
dispatchErrorEvent() {
this.handlers.error.forEach((f) => f());
dispatchErrorEvent(error) {
this.handlers.error.forEach((f) => f(error));
}

/**
Expand Down
16 changes: 15 additions & 1 deletion web/src/components/core/ChangeProductLink.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,9 @@ import React from "react";
import { screen } from "@testing-library/react";
import { installerRender } from "~/test-utils";
import { PRODUCT as PATHS } from "~/routes/paths";
import { Product } from "~/types/software";
import { Product, RegistrationInfo } from "~/types/software";
import ChangeProductLink from "./ChangeProductLink";
import { useRegistration } from "~/queries/software";

const tumbleweed: Product = {
id: "Tumbleweed",
Expand All @@ -43,9 +44,11 @@ const microos: Product = {
};

let mockUseProduct: { products: Product[]; selectedProduct?: Product };
let registrationInfoMock: RegistrationInfo;

jest.mock("~/queries/software", () => ({
useProduct: () => mockUseProduct,
useRegistration: (): ReturnType<typeof useRegistration> => registrationInfoMock,
}));

describe("ChangeProductLink", () => {
Expand All @@ -59,6 +62,17 @@ describe("ChangeProductLink", () => {
const link = screen.getByRole("link", { name: "Change product" });
expect(link).toHaveAttribute("href", PATHS.changeProduct);
});

describe("but a product is registered", () => {
beforeEach(() => {
registrationInfoMock = { key: "INTERNAL-USE-ONLY-1234-5678", email: "" };
});

it("renders nothing", () => {
const { container } = installerRender(<ChangeProductLink />);
expect(container).toBeEmptyDOMElement();
});
});
});

describe("when there is only one product available", () => {
Expand Down
5 changes: 4 additions & 1 deletion web/src/components/core/ChangeProductLink.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,17 +22,20 @@

import React from "react";
import { Link, LinkProps } from "react-router-dom";
import { useProduct } from "~/queries/software";
import { useProduct, useRegistration } from "~/queries/software";
import { PRODUCT as PATHS } from "~/routes/paths";
import { _ } from "~/i18n";
import { isEmpty } from "~/utils";

/**
* Link for navigating to the selection product.
*/
export default function ChangeProductLink({ children, ...props }: Omit<LinkProps, "to">) {
const { products } = useProduct();
const registration = useRegistration();

if (products.length <= 1) return null;
if (!isEmpty(registration?.key)) return null;

return (
<Link to={PATHS.changeProduct} {...props}>
Expand Down
Loading

0 comments on commit 4ca53aa

Please sign in to comment.