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

Added network-wait support #3981

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions src/app/rpmostree-pkg-builtins.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ static gboolean opt_uninstall_all;
static gboolean opt_unchanged_exit_77;
static gboolean opt_lock_finalization;
static gboolean opt_force_replacefiles;
static guint opt_network_wait;

static GOptionEntry option_entries[]
= { { "os", 0, 0, G_OPTION_ARG_STRING, &opt_osname, "Operate on provided OSNAME", "OSNAME" },
Expand Down Expand Up @@ -83,6 +84,8 @@ static GOptionEntry install_option_entry[]
"Apply changes to both pending deployment and running filesystem tree", NULL },
{ "force-replacefiles", 0, 0, G_OPTION_ARG_NONE, &opt_force_replacefiles,
"Allow package to replace files from other packages", NULL },
{ "network-wait", 'N', 0, G_OPTION_ARG_INT, &opt_network_wait,
"Wait to reach into remote repository till network setup", "seconds" },
{ NULL } };

static gboolean
Expand Down Expand Up @@ -125,6 +128,8 @@ pkg_change (RpmOstreeCommandInvocation *invocation, RPMOSTreeSysroot *sysroot_pr
g_variant_dict_insert (&dict, "lock-finalization", "b", opt_lock_finalization);
if (opt_apply_live)
g_variant_dict_insert (&dict, "apply-live", "b", opt_apply_live);
if (opt_network_wait)
g_variant_dict_insert (&dict, "network-wait", "u", opt_network_wait);
g_autoptr (GVariant) options = g_variant_ref_sink (g_variant_dict_end (&dict));

gboolean met_local_pkg = FALSE;
Expand Down
10 changes: 10 additions & 0 deletions src/daemon/rpmostree-sysroot-upgrader.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ struct RpmOstreeSysrootUpgrader
char *command_line;
char *agent;
char *sd_unit;
guint network_wait_timeout_secs;

OstreeDeployment *cfg_merge_deployment;
OstreeDeployment *origin_merge_deployment;
Expand Down Expand Up @@ -905,6 +906,12 @@ prepare_context_for_assembly (RpmOstreeSysrootUpgrader *self, const char *tmproo
return TRUE;
}

void
rpmostree_sysroot_upgrader_set_network_wait (RpmOstreeSysrootUpgrader *self, guint network_wait_sec)
{
self->network_wait_timeout_secs = network_wait_sec;
}

/* Initialize libdnf context from our configuration */
static gboolean
prep_local_assembly (RpmOstreeSysrootUpgrader *self, GCancellable *cancellable, GError **error)
Expand Down Expand Up @@ -942,6 +949,9 @@ prep_local_assembly (RpmOstreeSysrootUpgrader *self, GCancellable *cancellable,
error))
return FALSE;

dnf_context_set_network_timeout_seconds (rpmostree_context_get_dnf (self->ctx),
self->network_wait_timeout_secs);

if (rpmostree_origin_has_any_packages (self->computed_origin))
{
if (!rpmostree_context_prepare (self->ctx, cancellable, error))
Expand Down
3 changes: 3 additions & 0 deletions src/daemon/rpmostree-sysroot-upgrader.h
Original file line number Diff line number Diff line change
Expand Up @@ -121,4 +121,7 @@ gboolean rpmostree_sysroot_upgrader_deploy (RpmOstreeSysrootUpgrader *self,
GCancellable *cancellable, GError **error);

void rpmostree_sysroot_upgrader_set_kargs (RpmOstreeSysrootUpgrader *self, char **kernel_args);

void rpmostree_sysroot_upgrader_set_network_wait (RpmOstreeSysrootUpgrader *self,
guint network_wait_sec);
G_END_DECLS
6 changes: 6 additions & 0 deletions src/daemon/rpmostreed-transaction-types.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -1557,6 +1557,12 @@ deploy_transaction_execute (RpmostreedTransaction *transaction, GCancellable *ca
return TRUE;
}

guint network_wait_sec;
if (g_variant_dict_lookup (self->options, "network-wait", "u", &network_wait_sec))
{
rpmostree_sysroot_upgrader_set_network_wait (upgrader, network_wait_sec);
}

RpmOstreeSysrootUpgraderLayeringType layering_type;
gboolean layering_changed = FALSE;
if (!rpmostree_sysroot_upgrader_prep_layering (upgrader, &layering_type, &layering_changed,
Expand Down