parse_timestamp_from_date requires GNU coreutils' date
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
cloud-init |
Fix Released
|
Undecided
|
Unassigned |
Bug Description
running tests on FreeBSD, here's the output from "test_parse_
=======
ERROR: test_dump.
-------
Traceback (most recent call last):
File "/usr/home/
float(
File "/usr/home/
timestamp = parse_timestamp
File "/usr/home/
out, _ = util.subp(['date', '+%s.%3N', '-d', timestampstr])
File "/usr/home/
return _real_subp(*args, **kwargs)
File "/usr/home/
cmd=args)
cloudinit.
Command: ['date', '+%s.%3N', '-d', '17:15 08/08']
Exit code: 1
Reason: -
Stdout:
Stderr: date: illegal time format
usage: date [-jnRu] [-d dst] [-r seconds|file] [-t west] [-v[+|-
-------
cloudinit.util: DEBUG: Running command ['date', '+%s.%3N', '-d', '17:15 08/08'] with allowed return codes [0] (shell=False, capture=True)
-------
BSD date cannot parse arbitrary input, it will only parse input based on an input format.
Additionally, the `-d` flag *sets* the date on BSD.
I think the right fix on this is to drop the 'date' usage entirely.
Just support a reasonable set of formats and blow up with a good error that says what it tried to parse.