We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Describe the bug When calling create_scan_schedule the code logic is adding 30 minutes based on the lines below in https://github.com/tenable/pyTenable/blob/master/tenable/io/scans.py (Lines: 300 and 301)
secs = timedelta(minutes=30).total_seconds() starttime = datetime.fromtimestamp(starttime.timestamp() + secs - starttime.timestamp() % secs)
I believe these lines should be:
secs = timedelta(minutes=30).total_seconds() starttime = datetime.fromtimestamp(starttime.timestamp() - starttime.timestamp() % secs)
Or if you want to simulate classic rounding:
secs = timedelta(minutes=30).total_seconds() secs_from_last_interval = starttime.timestamp() % secs if secs_from_last_interval < secs/2 starttime = datetime.fromtimestamp(starttime.timestamp() - starttime.timestamp() % secs) else: starttime = datetime.fromtimestamp(starttime.timestamp() + (secs - starttime.timestamp() % secs)
To Reproduce Steps to reproduce the behavior:
def create_scan_schedule(scan_schedule, tenable_connector): #Initializing Function Scope frequency = scan_schedule.get("frequency") starttime_string = scan_schedule.get("starttime") scan_schedule.setdefault('timezone', 'US/Eastern') if frequency and starttime_string: scan_schedule['starttime'] = datetime.strptime(starttime_string, '%Y-%m-%d %H:%M:%S') scan_schedule_object = tenable_connector.scans.create_scan_schedule(**scan_schedule) return scan_schedule_object else: return {}
with scan_schedule set to a dict:
{ "enabled": true, "frequency": "ONETIME", "interval": 1, "starttime": "2023-06-19 20:00:00" }
Expected behavior starttime should be set to the last 30 minutes not 30 minutes beyond.
The text was updated successfully, but these errors were encountered:
Just to confirm I am seeing a starttime of "2023-06-19 20:30:00" when I run your code.
Sorry, something went wrong.
No branches or pull requests
Describe the bug
When calling create_scan_schedule the code logic is adding 30 minutes based on the lines below in https://github.com/tenable/pyTenable/blob/master/tenable/io/scans.py (Lines: 300 and 301)
I believe these lines should be:
Or if you want to simulate classic rounding:
To Reproduce
Steps to reproduce the behavior:
with scan_schedule set to a dict:
Expected behavior
starttime should be set to the last 30 minutes not 30 minutes beyond.
The text was updated successfully, but these errors were encountered: