-
Notifications
You must be signed in to change notification settings - Fork 116
Map download touchups #4185
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
Map download touchups #4185
Conversation
| # fits within 80 characters on terminal (at least in the current | ||
| # ansible version) in case users have small screens. | ||
| # * If the user mis-copies, it's less likely to do anything destructive. | ||
| log_file: "{{ item | hash('md5') }}.log" |
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.
| log_file: "{{ item | hash('md5') }}.log" | |
| log_file: "{{ item | hash('md5') | truncate(8, True, '') }}.log" |
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.
eh I guess it's fine either way
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.
I was thinking about it but I don't know the properties of md5sum, at which point you start to get collisions. I suppose it's quite unlikely, plus somewhat unlikely that two such files would be present in this directory at once.
| else: | ||
| size_disp = str(round(size / GiB, 2)) + ' GiB' | ||
| print(' (' + size_disp + ') To check progress, run: "tail {{ working_dir }}/{{ log_file }}"') | ||
| print('(' + size_disp + ') To check download progress see above.') |
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.
This seems worse. Yes, it's not good to print redundant information but in this case it's probably fine to do so.
The directionality aspect can also make this confusing: is it the previous line, previous screen? how far above?
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.
actually won't this print before the debug step anyway?
so it would actually be "see below" in which case I'd say just print the size and delete the extra text from this step
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.
actually won't this print before the debug step anyway?
In this step, this text is printed to stdout but not displayed to the screen (unless there's an error in this task). It's captured by download_file_details.
The next step is the debug which outputs the instruction.
The step after that is the download, where I stick download_file_details into the name, and the user finally sees it.
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.
My reason for removing this isn't that it's redundant. It's that it line wraps. I'm specifically trying to avoid them seeing it. I could try to word it to be more clear that it's immediately above.
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.
I get it now... it's appended into the name of the download task.
It would be more clear to just print the size here and then in line 95 do something like
- name: "Download {{ item }} ({{ download_file_size.stdout_lines.0 ~ ' - see download progress in previous step' | default('done')}})"
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.
ah that conflicts with the default('done') -- tricky
but does that ever get triggered anyway? because it will always have a size as long as the file is available remotely
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.
Right but if the file exists locally I don't want to take the time to query the meta4 file.
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.
(See where I exit the python script early)
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.
okay I'll stop nitpicking--the change you made makes sense
|
Since you're still getting Ansible lint errors anyway it might be worth trying the block level vars again... I still don't understand why something like this doesn't work: - block:
vars:
dest_path: "{{ dest_base_path }}/{{ item }}"
log_file: "{{ item | hash('md5') }}.log"
working_dir: "/library/downloads/maps"
- name: "Fetching file size for {{ iiab_map_host_url }}/{{ item }} via .meta4 file"
... |
Co-authored-by: Jacob Chapman <7908073+chapmanjacobd@users.noreply.github.com>
|
That doesn't parse, I tried it in a yaml parser. But in thinking about how to explain why, I think I figured out what the linter wanted from me. One sec... |
vars: has to go first to satisfy the linter, I think
chapmanjacobd
left a comment
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.
looks good once those lint errors go away
|
I should probably add, this is how it looks now: |
|
|
||
| - block: | ||
|
|
||
| - vars: |
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.
In the last PR it said to order it "vars, block, rescue" which was confusing until I realized that "block" was just another sibling and didn't need to come first.
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.
ah!
| msg: | ||
| - "" | ||
| - "" | ||
| - " To check download progress, run: " |
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.
I think I've tried this before but multiline debug messages don't work right?
msg: |
like
this
kinda annoying that doesn't work
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.
Yeah, it string escapes the newlines
|
@holta I'm ready as well to merge. Waiting to confirm that linting is happy. |
Fixes bug:
For map data downloading in ansible, I was concerned that the "to view progress" line did a line wrap in the ansible task name.
Also the log didn't have a starting timestamp.
Description of changes proposed in this pull request:
Smoke-tested on which OS or OS's:
RasPi OS Trixie
Mention a team member @username e.g. to help with code review:
@chapmanjacobd