Closed dil-ddsouza closed 4 years ago
the tenable-jira commandline calls tenable_jira.cli:cli
. Please let us know what you did if you get it running successfully so we can document it for others.
Thanks Steve,
Can you please guide me as to how to run that directly? As in run the cli directly please? sorry if this is a stupid question to ask, I am only an amateur when it comes to programming.
The function in question is here: https://github.com/tenable/integration-jira-cloud/blob/master/tenable_jira/cli.py#L59
To run it, you would need to do something like this:
from tenable_jira.cli import cli
import arrow
since = arrow.now().shift(days=-1).timestamp
with open('config.yaml') as config:
cli(config, since)
The configfile param expects the file-like object of the configfile. The observiced_since param expects the unix timestamp (epoch) as an integer.
Thanks Steve,
I tried doing that, but received the following errors: [14/05/2020 17:22:00] Usage: worker.py [OPTIONS] [CONFIGFILE] [14/05/2020 17:22:00] Try 'worker.py --help' for help. [14/05/2020 17:22:00] Error: Invalid value for '[CONFIGFILE]': Could not open file: tenable: [14/05/2020 17:22:00] : No such file or directory
Where would I need to place the config.yaml file? Do you reckon I should have it in the same directory as the script or within the tenable-jira module directory please?
you'd likely have to have the config in the same path as the script you write.
I tried that too but to no avail.
Also, when I use the the since as you directed me, it throws up an int object error:
Traceback (most recent call last):
File "init.py", line 18, in
Here is the code too, i had to remove 'Since' so that I could test just running with config: import datetime import logging import os import requests from requests.auth import HTTPBasicAuth import json import objectpath from tenable.io import TenableIO from tenable_jira.cli import cli import arrow
since = arrow.now().shift(days=-1).timestamp print(since) with open('config.yaml') as config: cli(config)
and the error that it throws up is the same, even tho the config file is in the same dir: Usage: init.py [OPTIONS] [CONFIGFILE] Try 'init.py --help' for help.
Error: Invalid value for '[CONFIGFILE]': Could not open file: tenable: : No such file or directory
seems like its a click thing. it wasn't intended to be run this way.
You may want to look into the CliRunner in click...
https://click.palletsprojects.com/en/7.x/testing/#input-streams
Thanks Steve, I'll read up on it
I'll keep this issue open. If your successful, please report back what you did. We're working on building up the wiki with step-by-step guides.
Hey Steve,
We are trying to create an Azure function app in order to run the integration script. This will save us from having a whole machine/instance running the integration.
So wanted to know what happens when the following is called upon: tenable-jira config.yaml
As in what script does it call upon? Since function app won't allow us to execute the above command at the OS level. So for example I can't do this: os.system('tenable-jira config.yaml')
Instead maybe we could directly run what the command 'tenable-jira config.yaml' calls upon.
If you have a better way of doing it or any advise, that would be extremely helpful.