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

[rust] improvements in agama logs store #1762

Open
wants to merge 9 commits into
base: master
Choose a base branch
from

Conversation

mchf
Copy link
Contributor

@mchf mchf commented Nov 14, 2024

Problem

  • some information were missed in the result

Solution

  • added journal output for (new) agama-web-server
  • collected package versions (either .packages.root or "rpm -qa")
  • minor improvements - do not include empty files (when command produces no output) into the resulting archive; do not mask errors reported by the backend (either authentication required)
  • added service running busctl monitor on agama's bus in the background and collectin errors in dbus.log, the log file is then put into the resulting archive

Testing

  • Tested manually

@coveralls
Copy link

coveralls commented Nov 14, 2024

Pull Request Test Coverage Report for Build 11998061439

Details

  • 0 of 21 (0.0%) changed or added relevant lines in 3 files are covered.
  • 1 unchanged line in 1 file lost coverage.
  • Overall coverage decreased (-0.03%) to 71.314%

Changes Missing Coverage Covered Lines Changed/Added Lines %
rust/agama-cli/src/logs.rs 0 1 0.0%
rust/agama-lib/src/base_http_client.rs 0 6 0.0%
rust/agama-lib/src/logs.rs 0 14 0.0%
Files with Coverage Reduction New Missed Lines %
rust/agama-lib/src/base_http_client.rs 1 53.85%
Totals Coverage Status
Change from base Build 11887235390: -0.03%
Covered Lines: 16922
Relevant Lines: 23729

💛 - Coveralls

@mchf mchf marked this pull request as ready for review November 24, 2024 17:14
Copy link
Contributor

@imobachgs imobachgs left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looking much better now. Thanks!

service/share/agama-dbus-monitor.service Show resolved Hide resolved
@@ -143,7 +145,22 @@ impl LogItem for LogPath {
let options = CopyOptions::new();
// fs_extra's own Error doesn't implement From trait so ? operator is unusable
match copy_items(&[self.src_path.as_str()], dst_path, &options) {
Ok(_p) => Ok(()),
Ok(_p) => {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One match and three nested "ifs" look too much to me :-) What about something like:

copy_items(&[self.src_path.as_str()], dst_path, &options)
    .map_err(|_e| io::Error::new(io::ErrorKind::Other, "Copying of a file failed"))?;

if let Some(file_name) = dst_file.file_name().and_then(|fname| fname.to_str()) {
    if file_name.starts_with(".") {
        let name = file_name.trim_start_matches(".");
        let _ = fs::rename(dst_file.clone(), dst_file.with_file_name(name));
    }
}

Ok(())

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you're suppressing my creativity ;-)

I'll look into it ...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants