between-meals icon indicating copy to clipboard operation
between-meals copied to clipboard

knife lib improvements

Open vpushkar opened this issue 2 years ago • 5 comments

Checking for databag, role, or cookbook presence before knife delete. Use case: two or more remote grocery-delivery working on the same set of Chef servers. 'knife role/data bag/cookbook delete' fails if object is missing on a server.

vpushkar avatar Sep 07 '21 20:09 vpushkar

I'm not sure I understand. Two GD's should never be running against the same org on the same server. The entire system assumes that is not the case. This will be the least of the problems if you introduce such race conditions.

jaymzh avatar Sep 07 '21 22:09 jaymzh

Hi @vpushkar!

Thank you for your pull request and welcome to our community.

Action Required

In order to merge any pull request (code, docs, etc.), we require contributors to sign our Contributor License Agreement, and we don't seem to have one on file for you.

Process

In order for us to review and merge your suggested changes, please sign at https://code.facebook.com/cla. If you are contributing on behalf of someone else (eg your employer), the individual CLA may not be sufficient and your employer may need to sign the corporate CLA.

Once the CLA is signed, our tooling will perform checks and validations. Afterwards, the pull request will be tagged with CLA signed. The tagging process may take up to 1 hour after signing. Please give it that time before contacting us about it.

If you have received this in error or have any questions, please contact us at [email protected]. Thanks!

facebook-github-bot avatar Sep 07 '21 22:09 facebook-github-bot

I'm not sure I understand. Two GD's should never be running against the same org on the same server. The entire system assumes that is not the case. This will be the least of the problems if you introduce such race conditions.

So, for now we have a single repo for chef data and two independent servers with grocery-delivery. This servers runs grocery-delivery in a different time (let's say once a hour with 30 minutes delta). We don't see any issues with uploading/updating data, but delete could fail if object deleted already (i.e. one GD job deleted it earlier).

vpushkar avatar Sep 07 '21 22:09 vpushkar

GD is designed to be run on every chef server so that each chef server can keep itself up-to-date.

What you describe can lead to all sorts of weird issues where uploads could happen at the same time, one GD could get hung up and a delete could happen after an upload when it's supposed to happen before.

This is definitely an anti-pattern. I'd say this PR is papering over your real issue. If anything I'd say we should catch it and then exit(1) with an error that something has gone terribly wrong and the state file should probably be nuked and everything started again.

jaymzh avatar Sep 07 '21 23:09 jaymzh

Thank you for signing our Contributor License Agreement. We can now accept your code for this (and any) Facebook open source project. Thanks!

facebook-github-bot avatar Sep 07 '21 23:09 facebook-github-bot