← Back to team overview

yahoo-eng-team team mailing list archive

[Bug 1853470] Re: parse_timestamp_from_date requires GNU coreutils' date

 

Looks like this was fixed way back in
https://github.com/canonical/cloud-
init/commit/a8dcad9ac62bb1d2a4f7489960395bad6cac9382 .

It now lives at https://github.com/canonical/cloud-
init/blob/main/tests/unittests/analyze/test_dump.py

** Changed in: cloud-init
       Status: Triaged => Fix Released

-- 
You received this bug notification because you are a member of Yahoo!
Engineering Team, which is subscribed to cloud-init.
https://bugs.launchpad.net/bugs/1853470

Title:
  parse_timestamp_from_date requires GNU coreutils' date

Status in cloud-init:
  Fix Released

Bug description:
  running tests on FreeBSD, here's the output from
  "test_parse_unexpected_timestamp_format_with_date_command"

  
  ======================================================================
  ERROR: test_dump.TestParseTimestamp.test_parse_unexpected_timestamp_format_with_date_command
  ----------------------------------------------------------------------
  Traceback (most recent call last):
    File "/usr/home/freebsd/src/cloud-init/cloudinit/analyze/tests/test_dump.py", line 57, in test_parse_unexpected_timestamp_format_with_date_command
      float(dt.strftime('%s.%f')), parse_timestamp(new_stamp))
    File "/usr/home/freebsd/src/cloud-init/cloudinit/analyze/dump.py", line 48, in parse_timestamp
      timestamp = parse_timestamp_from_date(timestampstr)
    File "/usr/home/freebsd/src/cloud-init/cloudinit/analyze/dump.py", line 54, in parse_timestamp_from_date
      out, _ = util.subp(['date', '+%s.%3N', '-d', timestampstr])
    File "/usr/home/freebsd/src/cloud-init/cloudinit/tests/helpers.py", line 182, in _fake_subp
      return _real_subp(*args, **kwargs)
    File "/usr/home/freebsd/src/cloud-init/cloudinit/util.py", line 2079, in subp
      cmd=args)
  cloudinit.util.ProcessExecutionError: Unexpected error while running command.
  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[+|-]val[ymwdHMS]]
                      [-I[date | hours | minutes | seconds]]
                      [-f fmt date | [[[[[cc]yy]mm]dd]HH]MM[.ss]] [+format]
  -------------------- >> begin captured logging << --------------------
  cloudinit.util: DEBUG: Running command ['date', '+%s.%3N', '-d', '17:15 08/08'] with allowed return codes [0] (shell=False, capture=True)
  --------------------- >> end captured logging << ---------------------

  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.

To manage notifications about this bug go to:
https://bugs.launchpad.net/cloud-init/+bug/1853470/+subscriptions



References