(o: &mut String, report: &Report)
| 152 | } |
| 153 | |
| 154 | fn render_integrations(o: &mut String, report: &Report) { |
| 155 | section(o, "Agent integrations (installed packages)"); |
| 156 | let integrations = &report.integrations; |
| 157 | let root = match (&integrations.root, &integrations.root_error) { |
| 158 | (Some(root), _) if integrations.root_overridden => { |
| 159 | format!("{root} (set by ATOMIC_INTEGRATIONS_HOME)") |
| 160 | } |
| 161 | (Some(root), _) => root.clone(), |
| 162 | (None, Some(error)) => format!("unknown — {error}"), |
| 163 | (None, None) => "unknown".to_string(), |
| 164 | }; |
| 165 | field(o, "Receipts", &root); |
| 166 | |
| 167 | let mut not_installed = Vec::new(); |
| 168 | for package in &integrations.packages { |
| 169 | let name = format!("{} ({})", package.display_name, package.agent); |
| 170 | match &package.state { |
| 171 | IntegrationState::Installed(installed) => { |
| 172 | line(o, &format!(" {name}")); |
| 173 | field(o, " Version", &installed.version); |
| 174 | field( |
| 175 | o, |
| 176 | " Installed", |
| 177 | &format!( |
| 178 | "{} with atomic {}", |
| 179 | installed.installed_at, installed.installed_with |
| 180 | ), |
| 181 | ); |
| 182 | let last_fired = match &installed.last_fired { |
| 183 | HookActivity::Observed { at } => format!("{at} (current repository)"), |
| 184 | HookActivity::NotObserved => "not observed in this repository".to_string(), |
| 185 | HookActivity::Unavailable { reason } => format!("unknown — {reason}"), |
| 186 | }; |
| 187 | field(o, " Last fired", &last_fired); |
| 188 | field( |
| 189 | o, |
| 190 | " Source", |
| 191 | &format!("{} ({})", installed.source, installed.source_kind), |
| 192 | ); |
| 193 | field(o, " Files", &file_counts(&installed.files)); |
| 194 | } |
| 195 | IntegrationState::Unreadable { reason } => { |
| 196 | line(o, &format!(" {name}")); |
| 197 | field(o, " Version", &format!("unknown — {reason}")); |
| 198 | } |
| 199 | IntegrationState::NotInstalled => not_installed.push(package.agent.as_str()), |
| 200 | } |
| 201 | } |
| 202 | if !not_installed.is_empty() { |
| 203 | field(o, "Not installed", ¬_installed.join(", ")); |
| 204 | } |
| 205 | blank(o); |
| 206 | } |
| 207 | |
| 208 | fn file_counts(files: &FileCounts) -> String { |
| 209 | let mut parts = vec![format!("{} recorded", files.recorded)]; |
no test coverage detected