-
Notifications
You must be signed in to change notification settings - Fork 32
New issue
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
DocGenerator - Search UI integration #1691
DocGenerator - Search UI integration #1691
Conversation
docs/DocGenerator/DocGenerator.py
Outdated
@@ -221,6 +223,14 @@ def start_logging(folder, debug_level=logging.INFO): | |||
elif args.sanity: | |||
sanity = Sanity(Config(CONFIG_PATH)) | |||
sanity.run() | |||
elif args.index_name: | |||
indexData=IndexData(args.index_name, Config(CONFIG_PATH)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code style: Use white spaces around "="
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
docs/DocGenerator/DocGenerator.py
Outdated
indexData=IndexData(args.index_name, Config(CONFIG_PATH)) | ||
indexData.run() | ||
elif args.launch_app: | ||
indexData=IndexData(args.launch_app, Config(CONFIG_PATH)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ditto.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
docs/DocGenerator/lib/IndexData.py
Outdated
@@ -0,0 +1,81 @@ | |||
""" | |||
brief: Wazuh DocGenerator config parser. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Modify this brief with the description of the module.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
docs/DocGenerator/lib/IndexData.py
Outdated
brief: Recursively finds all the files that match with the regex provided. | ||
""" | ||
doc_files = [] | ||
r = re.compile(self.regex) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If the regex isn´t supposed to change, it is recommended to compile it in the init method, so if this method is used more than once, the regex wouldn´t be recompiled each time.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
docs/DocGenerator/lib/IndexData.py
Outdated
""" | ||
def __init__(self, index, config): | ||
self.conf = config | ||
self.path = self.conf.documentation_path |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this assignment required? It will be more clear to directly use self.conf.documentation_path
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
docs/DocGenerator/lib/IndexData.py
Outdated
|
||
def remove_index(self): | ||
""" | ||
brief: It Deletes an index. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ditto
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
docs/DocGenerator/lib/IndexData.py
Outdated
self.path = self.conf.documentation_path | ||
self.index = index | ||
self.regex = ".*json" | ||
self.files = self.get_files() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is required to conserve all the files in the class? We can only obtain them during read_files_content
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
docs/DocGenerator/lib/IndexData.py
Outdated
|
||
def run(self): | ||
""" | ||
brief: This calls all the methods of the Class. Finally, it uses the index name and the documents |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Rephrase this like: Collects all the documentation files and makes a request to the BULK API to index the new data.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
docs/DocGenerator/lib/IndexData.py
Outdated
self.read_files_content() | ||
if self.test_connection(): | ||
self.remove_index() | ||
print("Indexing data...\n") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can add this to the log output
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
docs/DocGenerator/lib/IndexData.py
Outdated
print("Indexing data...\n") | ||
helpers.bulk(self.es, self.output, index=self.index) | ||
out=json.dumps(self.es.cluster.health(wait_for_status='yellow', request_timeout=1), indent=4) | ||
print(out) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ditto.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
d6fc354
to
3e8f41e
Compare
3e8f41e
to
45c8911
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Description
As part of the epic #1600 it was required that:
ElasticSearch
.ElasticSearch
.The previous three first items were mostly covered in #1666 and continued in #1681.
Dod