Merge pull request #2658 from cgwalters/live-no-restart

live: Don't output "services restart" for pure package additions
This commit is contained in:
Jonathan Lebon 2021-03-12 09:47:45 -05:00 committed by GitHub
commit 46f556f437
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 11 additions and 6 deletions

View File

@ -52,12 +52,12 @@ fn get_args_variant(sysroot: &ostree::Sysroot, opts: &Opts) -> Result<glib::Vari
} }
pub(crate) fn applylive_entrypoint(args: &Vec<String>) -> Result<()> { pub(crate) fn applylive_entrypoint(args: &Vec<String>) -> Result<()> {
let opts = Opts::from_iter(args.iter()); let opts = &Opts::from_iter(args.iter());
let client = &mut crate::client::ClientConnection::new()?; let client = &mut crate::client::ClientConnection::new()?;
let sysroot = &ostree::Sysroot::new_default(); let sysroot = &ostree::Sysroot::new_default();
sysroot.load(gio::NONE_CANCELLABLE)?; sysroot.load(gio::NONE_CANCELLABLE)?;
let args = get_args_variant(sysroot, &opts)?; let args = get_args_variant(sysroot, opts)?;
let params = crate::variant_utils::new_variant_tuple(&[args]); let params = crate::variant_utils::new_variant_tuple(&[args]);
let reply = &client.get_os_ex_proxy().call_sync( let reply = &client.get_os_ex_proxy().call_sync(
@ -97,8 +97,12 @@ fn finish(sysroot: &ostree::Sysroot) -> Result<()> {
}; };
pkgdiff.print(); pkgdiff.print();
crate::ffi::output_message( if pkgdiff.n_removed() == 0 && pkgdiff.n_modified() == 0 {
"Successfully updated running filesystem tree; some services may need to be restarted.", crate::ffi::output_message("Successfully updated running filesystem tree.");
); } else {
crate::ffi::output_message(
"Successfully updated running filesystem tree; some services may need to be restarted.",
);
}
Ok(()) Ok(())
} }

View File

@ -96,7 +96,8 @@ rm -rf /etc/testpkg-etc \
echo myconfig > /etc/testpkg-etc-other.conf echo myconfig > /etc/testpkg-etc-other.conf
grep myconfig /etc/testpkg-etc-other.conf grep myconfig /etc/testpkg-etc-other.conf
rpm-ostree install -A testpkg-etc testdaemon rpm-ostree install -A testpkg-etc testdaemon | tee out.txt
assert_file_has_content_literal out.txt 'Successfully updated running filesystem tree.'
rpm -q bar test{pkg-etc,daemon} > rpmq.txt rpm -q bar test{pkg-etc,daemon} > rpmq.txt
assert_file_has_content rpmq.txt bar-1.0-1 test{pkg-etc,daemon}-1.0-1 assert_file_has_content rpmq.txt bar-1.0-1 test{pkg-etc,daemon}-1.0-1
cat /etc/testpkg-etc.conf > testpkg-etc.conf cat /etc/testpkg-etc.conf > testpkg-etc.conf