Skip to content

Commit

Permalink
Merge pull request #20 from MikroElektronika/nikolalukicMe-patch-1
Browse files Browse the repository at this point in the history
Update index.py
  • Loading branch information
StrahinjaJacimovic authored Aug 23, 2024
2 parents d57f84e + 6a06b64 commit 2fdab76
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion scripts/index.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ def index_release_to_elasticsearch(es : Elasticsearch, index_name, release_detai
for asset in release_details[0].get('assets', []):
doc = None
name_without_extension = os.path.splitext(os.path.basename(asset['name']))[0]
package_id = name_without_extension
if 'mikrosdk' == name_without_extension:
doc = {
'name': name_without_extension,
Expand Down Expand Up @@ -122,6 +123,7 @@ def index_release_to_elasticsearch(es : Elasticsearch, index_name, release_detai
}
elif 'images' == name_without_extension:
package_changed = True
package_id = name_without_extension + '_sdk'
if len(metadata_content) > 1:
package_changed = metadata_content[0]['images']['hash'] != metadata_content[1]['images']['hash']
doc = {
Expand All @@ -138,7 +140,7 @@ def index_release_to_elasticsearch(es : Elasticsearch, index_name, release_detai

# Index the document
if doc:
resp = es.index(index=index_name, doc_type='necto_package', id=name_without_extension, body=doc)
resp = es.index(index=index_name, doc_type='necto_package', id=package_id, body=doc)
print(f"{resp["result"]} {resp['_id']}")

if __name__ == '__main__':
Expand Down

0 comments on commit 2fdab76

Please sign in to comment.