-
Notifications
You must be signed in to change notification settings - Fork 37
EX-1850 - Implement Report query and deletion #2304
Conversation
Implement Report query and deletion in graphql Signed-off-by: johnsonw <wjohnson@whamcloud.com>
…ndpoints to view and remove reports under /var/spool/iml/report. Signed-off-by: johnsonw <wjohnson@whamcloud.com>
Signed-off-by: johnsonw <wjohnson@whamcloud.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewed 2 of 2 files at r4.
Reviewable status: all files reviewed, 2 unresolved discussions (waiting on @johnsonw)
Integration tests passed here: https://build.whamcloud.com/view/IML/job/manager-for-lustre/2489/ |
Also, I've updated the query to return both the filesize and modified time. The data returned now looks like this:
|
The CodeQL failure is unrelated and I see it in other patches as well. |
Does this now print the whole file path or just the name? |
It's printing the whole file path. I thought it might be useful to show the whole path in case they weren't aware of the report being under /var/spool/iml. However, we could always print a note above indicating where the file lives and then just show the filename. What are your thoughts? |
Probably just the filename. The reports can be downloaded at |
Sure, makes sense. I will update it to be the filename only. |
…te path. Signed-off-by: johnsonw <wjohnson@whamcloud.com>
let path = tokio::fs::canonicalize(report_base.join(filename)).await?; | ||
|
||
if !path.starts_with(report_base) { | ||
return Err(FieldError::new("Invalid path", Value::null())); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit:
return Err(FieldError::new("Invalid path", Value::null())); | |
return Err(FieldError::new("Invalid filename", Value::null())); |
.await? | ||
.into_iter() | ||
.map(|filename| { | ||
fs::canonicalize(get_report_path().join(filename.clone())) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could call let report_dir = get_report_path()
just once at the beginning?
/// List completed Stratagem reports that currently reside on the manager node. | ||
/// Note: All report names must be valid unicode. | ||
async fn stratagem_reports(_context: &Context) -> juniper::FieldResult<Vec<StratagemReport>> { | ||
let paths = tokio::fs::read_dir(get_report_path()).await?; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit:
let paths = tokio::fs::read_dir(get_report_path()).await?; | |
let paths = fs::read_dir(get_report_path()).await?; |
.await? | ||
.into_iter() | ||
.map(|filename| { | ||
fs::canonicalize(get_report_path().join(filename.clone())) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is clone() needed?
Implement Report query and deletion in graphql
Signed-off-by: johnsonw wjohnson@whamcloud.com
This change is