ComputeCanada / puppet-magic_castle

Puppet Environment repo for Magic Castle - https://github.com/ComputeCanada/magic_castle
MIT License
13 stars 21 forks source link

Fix quota exec command #381

Closed etiennedub closed 1 month ago

etiennedub commented 1 month ago

There were two issues with the previous exec command:

  1. The path was wrong
  2. The exec was never executed because of the refreshonly=true

@cmd-ntrf To avoid executing the command at every execution, I create a file with the quota state. I haven't found a better way to verify the current quota but I'm open to a better alternative.

etiennedub commented 1 month ago

@cmd-ntrf I can use this unless instead that compare the user input with the limit currently set: unless => "test \"$(numfmt --from=iec --to-unit=Ki $(echo ${quota} | tr '[:lower:]' '[:upper:]'))\" -eq \"$(xfs_quota -x -c 'report -N' /mnt/${volume_tag}/${volume_name} | grep root | awk '{print \$4}')\"",

But, it doesn't work in 2 scenarios:

  1. If the last Ki is uneven, xfs round it to some even value. (e.i. 233k become 236 in the report)
  2. If the user value is under 1Ki, xfs return 0 in the report (e.i. 150 become 0 in the report)

Those are definitively edges cases and I don't know if we want to support those cases. @cmd-ntrf Any preference between this command and the file creation?