Skip to content

Commit

Permalink
daemon: Rework kargs transaction
Browse files Browse the repository at this point in the history
Make it use the `deploy()` function like the others instead of having a
separate function that sets kargs and then automatically deploys.

Prep for future patches.

Closes: #1825
Approved by: rfairley
  • Loading branch information
jlebon authored and rh-atomic-bot committed May 2, 2019
1 parent 4c2fab8 commit e0b0ff0
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 23 deletions.
22 changes: 6 additions & 16 deletions src/daemon/rpmostree-sysroot-upgrader.c
Original file line number Diff line number Diff line change
Expand Up @@ -1210,28 +1210,18 @@ rpmostree_sysroot_upgrader_import_pkgs (RpmOstreeSysrootUpgrader *self,
}

/**
* rpmostree_sysroot_upgrader_deploy_set_kargs:
* rpmostree_sysroot_upgrader_set_kargs:
* @self: Self
* @kernel_args: A list of strings representing kernel_arguments
* @cancellable: Cancellable
* @error: Error
*
* A wrapper function that collects the kernel arguments then call the rpmostree_sysroot_upgrader_deploy
* to write a pending deployment to the disk
*
* Returns: FALSE if rpmostree_sysroot_upgrader_deploy fails
*
* Set the active kargs to be used during deployment.
*/
gboolean
rpmostree_sysroot_upgrader_deploy_set_kargs (RpmOstreeSysrootUpgrader *self,
char **kernel_args,
GCancellable *cancellable,
GError **error)
void
rpmostree_sysroot_upgrader_set_kargs (RpmOstreeSysrootUpgrader *self,
char **kernel_args)
{
/* Set the attribute kargs directly, not sure whether or not to have a setter */
/* Because .. currently pretty much here is the only place that we set it */
g_clear_pointer (&self->kargs_strv, g_strfreev);
self->kargs_strv = g_strdupv (kernel_args);
return rpmostree_sysroot_upgrader_deploy (self, NULL, cancellable, error);
}

/**
Expand Down
8 changes: 3 additions & 5 deletions src/daemon/rpmostree-sysroot-upgrader.h
Original file line number Diff line number Diff line change
Expand Up @@ -132,9 +132,7 @@ rpmostree_sysroot_upgrader_deploy (RpmOstreeSysrootUpgrader *self,
GCancellable *cancellable,
GError **error);

gboolean
rpmostree_sysroot_upgrader_deploy_set_kargs (RpmOstreeSysrootUpgrader *self,
char **kernel_args,
GCancellable *cancellable,
GError **error);
void
rpmostree_sysroot_upgrader_set_kargs (RpmOstreeSysrootUpgrader *self,
char **kernel_args);
G_END_DECLS
5 changes: 3 additions & 2 deletions src/daemon/rpmostreed-transaction-types.c
Original file line number Diff line number Diff line change
Expand Up @@ -2422,8 +2422,9 @@ kernel_arg_transaction_execute (RpmostreedTransaction *transaction,

/* After all the arguments are processed earlier, we convert it to a string list*/
g_auto(GStrv) kargs_strv = _ostree_kernel_args_to_strv (kargs);
if (!rpmostree_sysroot_upgrader_deploy_set_kargs (upgrader, kargs_strv,
cancellable, error))
rpmostree_sysroot_upgrader_set_kargs (upgrader, kargs_strv);

if (!rpmostree_sysroot_upgrader_deploy (upgrader, NULL, cancellable, error))
return FALSE;

if (vardict_lookup_bool (self->options, "reboot", FALSE))
Expand Down

0 comments on commit e0b0ff0

Please sign in to comment.