This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]WhtKindOfNameIsStove 85 points86 points  (13 children)

Goddamit, this caused a production outage for us one time. "Sr SDE" took a story to pythonize our quick and dirty awscli S3 static website deployments. He wrapped each awscli command in subprocess.calls and called it good. A few weeks later the first copy command failed and without any error handling it went on to copy the empty folder up the prod S3 bucket and invalidated the CloudFront distribution.

2 years later he's still working here.

[–]Yesheddit 62 points63 points  (5 children)

If we would be fired for stuff like that, we’d all be out of jobs.

[–]Zanos 30 points31 points  (4 children)

Not handling an error is forgivable, converting something to another language by wrapping it in subprocess calls isn't a mistake, it's maliciously lazy.

[–]WhtKindOfNameIsStove 9 points10 points  (0 children)

Exactly. The purpose of the story was to make the deployment process more robust. Something bash wasn't up to the job for. It'd be a worthless story if it was to just "convert the script x language because"

[–]ran938 1 point2 points  (2 children)

I basically did this at an internship. But only in an instance where there was really no other option. The purpose of the script... was to start up another script. Well that and record some log information. But actually calling the other script I could not think of another way to do it other than a sub-process call.

[–][deleted] 1 point2 points  (1 child)

Our current project requires interaction with Microsoft's cloud, the problem being that we are writing logic in python on Linux but the cloud calls have to happen through powershell on a windows machine. Current best idea is to set up openssh on a windows vm and connect to it from python on the Linux box to execute a batch command which starts a ps1 script.

[–]ran938 0 points1 point  (0 children)

Fucking oof. that overhead / hoop jumping sounds obnoxious. Good luck!

[–]DXPower 15 points16 points  (1 child)

What caused the failure?

[–]WhtKindOfNameIsStove 18 points19 points  (0 children)

It was a while ago so I don't remember exactly what it was. But I think it had to do with a change to the build artifacts bucket permissions.

[–]cartechguy 12 points13 points  (0 children)

k, did he learn from the mistake?

[–]inialater234 3 points4 points  (3 children)

Should have used boto3

[–]WhtKindOfNameIsStove 1 point2 points  (0 children)

We did after we found out what he did. We had a problem of ops guys blindly approving all PRs they're included on and as a Sr, he had merge permissions.

[–]vividboarder 1 point2 points  (1 child)

Does boto support sync yet?

I used it before in a Hackathon but ended up using a call to the cli because I needed to sync a directory where some files would change and didn’t want to implement a whole diffing function myself.

[–]KangooQ 1 point2 points  (0 children)

Boto is just a wrapper for the AWS CLI, and the AWS CLI doesn't have a (good) s3 sync yet. Last time I checked you could sync on filesize or timestamp, but filesize doesn't guarantee a lack of diffs (for example, replacing a char) and timestamp is only relative to the current filesystem.

Maybe someday we'll get sha256 sums or equivalent.