mirror of
https://github.com/kellyjonbrazil/jc.git
synced 2025-07-17 01:32:37 +02:00
crontab bugfix: inserting header row was clobbering the first data row
This commit is contained in:
@ -8,6 +8,7 @@ jc changelog
|
|||||||
- Add crontab file parser with user support
|
- Add crontab file parser with user support
|
||||||
- Add __version__ variable to parser modules
|
- Add __version__ variable to parser modules
|
||||||
- Updated history parser to output "line" as an integer
|
- Updated history parser to output "line" as an integer
|
||||||
|
- Bugfix in crontab file parser: header insertion was clobbering first row
|
||||||
- Just-in-time loading of parser modules instead of loading all at start
|
- Just-in-time loading of parser modules instead of loading all at start
|
||||||
|
|
||||||
20191217 v1.6.1
|
20191217 v1.6.1
|
||||||
|
@ -132,7 +132,7 @@ import jc.parsers.universal
|
|||||||
|
|
||||||
|
|
||||||
class info():
|
class info():
|
||||||
version = '1.0'
|
version = '1.1'
|
||||||
description = 'crontab file parser'
|
description = 'crontab file parser'
|
||||||
author = 'Kelly Brazil'
|
author = 'Kelly Brazil'
|
||||||
author_email = 'kellyjonbrazil@gmail.com'
|
author_email = 'kellyjonbrazil@gmail.com'
|
||||||
@ -252,7 +252,7 @@ def parse(data, raw=False, quiet=False):
|
|||||||
'command': cmd})
|
'command': cmd})
|
||||||
|
|
||||||
# Add header row for parsing
|
# Add header row for parsing
|
||||||
cleandata[0] = 'minute hour day_of_month month day_of_week command'
|
cleandata[:0] = ['minute hour day_of_month month day_of_week command']
|
||||||
|
|
||||||
if len(cleandata) > 1:
|
if len(cleandata) > 1:
|
||||||
cron_list = jc.parsers.universal.simple_table_parse(cleandata)
|
cron_list = jc.parsers.universal.simple_table_parse(cleandata)
|
||||||
|
@ -254,7 +254,7 @@ def parse(data, raw=False, quiet=False):
|
|||||||
'command': cmd})
|
'command': cmd})
|
||||||
|
|
||||||
# Add header row for parsing
|
# Add header row for parsing
|
||||||
cleandata[0] = 'minute hour day_of_month month day_of_week user command'
|
cleandata[:0] = ['minute hour day_of_month month day_of_week user command']
|
||||||
|
|
||||||
if len(cleandata) > 1:
|
if len(cleandata) > 1:
|
||||||
cron_list = jc.parsers.universal.simple_table_parse(cleandata)
|
cron_list = jc.parsers.universal.simple_table_parse(cleandata)
|
||||||
|
5
tests/fixtures/centos-7.7/crontab2.out
vendored
Normal file
5
tests/fixtures/centos-7.7/crontab2.out
vendored
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
# Run the hourly jobs
|
||||||
|
SHELL=/bin/bash
|
||||||
|
PATH=/sbin:/bin:/usr/sbin:/usr/bin
|
||||||
|
MAILTO=root
|
||||||
|
01 * * * * root run-parts /etc/cron.hourly
|
Reference in New Issue
Block a user