salopensource / sal-scripts

Apache License 2.0
23 stars 31 forks source link

Support different date formats than US #63

Closed jby closed 4 years ago

jby commented 4 years ago

Describe the bug sal-submit complains about unrecognized date format when using something else than US date format

To Reproduce Use a different timezone than any US-timezone Try to manuallly submit data to sal, using sal-submit

Expected behavior Return of prompt, data populated in sal server.

Server (please complete the following information):

Client (please complete the following information):

Additional context Output from sal-submit command:

sudo /usr/local/sal/bin/sal-submit -v                                                                                           2019-11-01 19:49:37,065 INFO sal-submit Version: 3.0.0
2019-11-01 19:49:38,175 INFO Processing checkin modules...
Traceback (most recent call last):
  File "/usr/local/sal/checkin_modules/apple_sus_checkin.py", line 188, in <module>
    main()
  File "/usr/local/sal/checkin_modules/apple_sus_checkin.py", line 19, in main
    sus_report = get_sus_install_report()
  File "/usr/local/sal/checkin_modules/apple_sus_checkin.py", line 93, in get_sus_install_report
    installed = datetime.datetime.strptime(line[-1], '%m/%d/%Y, %H:%M:%S')
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/_strptime.py", line 332, in _strptime
    (data_string, format))
ValueError: time data '2019-10-30, 18:43:41' does not match format '%m/%d/%Y, %H:%M:%S'
2019-11-01 19:49:39,913 INFO Processing plugins...
2019-11-01 19:49:43,822 INFO Processing inventory...
2019-11-01 19:49:44,321 INFO Inventory is out of date; submitting...
2019-11-01 19:49:45,773 INFO Processing catalogs...
2019-11-01 19:49:45,903 INFO Processing profiles...
2019-11-01 19:49:46,219 INFO Checkin complete.

If possible, please replicate the issue while Sal is in debug mode. N/A

scripts version:

package-id: com.github.salopensource.sal_scripts
version: 3.0.0
jby commented 4 years ago

I'm still getting this...

sudo /usr/local/sal/bin/sal-submit
Traceback (most recent call last):
  File "/usr/local/sal/checkin_modules/apple_sus_checkin.py", line 188, in <module>
    main()
  File "/usr/local/sal/checkin_modules/apple_sus_checkin.py", line 19, in main
    sus_report = get_sus_install_report()
  File "/usr/local/sal/checkin_modules/apple_sus_checkin.py", line 93, in get_sus_install_report
    installed = datetime.datetime.strptime(line[-1], '%m/%d/%Y, %H:%M:%S')
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/_strptime.py", line 332, in _strptime
    (data_string, format))
ValueError: time data '2020-02-22, 02:41:46' does not match format '%m/%d/%Y, %H:%M:%S'
sheagcraig commented 4 years ago

@jby Please ensure you're trying with the current tip; this has been handled: https://github.com/salopensource/sal-scripts/blob/master/payload/usr/local/sal/checkin_modules/apple_sus_checkin.py#L75

and

https://github.com/salopensource/sal-scripts/blob/master/payload/usr/local/sal/checkin_modules/apple_sus_checkin.py#L100

sheagcraig commented 4 years ago

As mentioned above, this is handled by new releases.