← Back to team overview

yahoo-eng-team team mailing list archive

[Bug 1853470] [NEW] parse_timestamp_from_date requires GNU coreutils' date

 

Public bug reported:

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.

** Affects: cloud-init
     Importance: Undecided
         Status: New


** Tags: freebsd

-- 
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:
  New

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


Follow ups