Skip to content

Commit

Permalink
Refactor adjust function to log message when no adjustments are found
Browse files Browse the repository at this point in the history
  • Loading branch information
hamza-hadj-aissa committed Dec 30, 2023
1 parent 6dd62c8 commit 3db4cec
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions adjust.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,9 @@ def adjust(ansible_logger: Logger, db_logger: Logger, adjustments_ids: list[int]
.join(Host)\
.order_by(Adjustment.created_at.desc())\
.all()
print(rows)
print([row.id for row in rows])
if len(rows) == 0:
print("No adjustments to execute")
ansible_logger.get_logger().info(
"No adjustments to be executed at this time")
return
else:
adjustments = []
Expand Down Expand Up @@ -75,7 +74,6 @@ def adjust(ansible_logger: Logger, db_logger: Logger, adjustments_ids: list[int]
session.add(row)
# Commit the changes to the database
session.commit()
print(adjustments)
# Add the adjustments to the volume group dictionary
volume_group["logical_volumes"] = adjustments
# Execute the adjustments
Expand Down

0 comments on commit 3db4cec

Please sign in to comment.