Live data from Hacker News

Do-nothing scripting: the key to gradual automation

blog.danslimmon.com

51–60 of 126 posts

Re: Do-nothing scripting: the key to gradual automation

#51
post #25

Is anyone else bothered by how they were handling ssh keys in the example? The whole point of public keys is that the private key never has to leave the box it’s generated on. Once you go sharing them you might as well just use a random passphrase.

Yeah, at our company things are done in the reverse of that script: the user generates their SSH keys, and there's a process they use to register the public key with the rest of the system.

Re: Do-nothing scripting: the key to gradual automation

#52
post #43

Earlier quoted context omitted.

maybe he was a Java programmer? all joking aside, the reason he's doing classes seems to be an intention towards making a FooStep (and/or a BarStep) which could then maybe handle generic Foo stuff (authentication comes to mind) in the future?

"maybe"..."in the future" is the root of much object oriented evil

I don't think there is a correct answer, but I like that a developer has foresight.

Re: Do-nothing scripting: the key to gradual automation

#53
post #12

Seems basically to be a checklist. However, I don't think it's a good idea. Checklists are not bad, but they are to be executed by humans. I think trying to automate an existing human process directly is a mistake. Human processes often have features that only humans can do, such as pattern recognition or adapting to small difference. It's often easier to create a computerized (automated) process from scratch than to…

Well, the specific problem it addresses is: 1. We have a tedious manual checklist 2. We’d like it to be fully automated 3. How do we get there from here?? You’re correct to say that if the process had been fully automated from the start it may well have been implemented very differently. But those scripts are hard to write, and basically useless until they’re complete. Often the only practical way to do this stuff is…

You can do automation incrementally, but it's quite a different mindset to automate computer than to write a checklist for humans.

If you try to emulate a person with a checklist, then you will often find it is actually harder to automate, because the steps often rely on human adaptability and common sense.

Re: Do-nothing scripting: the key to gradual automation

#54

I get it, but this script looks a lot like a checklist to me. Seems like a checklist is a good place to start, no? If you want more "interest" during the process, make it a point to refine the documentation for your process (clarify a step here, split one command into two steps). Then you have a very clear spec by the time the process needs to be automated.

I think the value of using a script as your checklist is that the script can handle some of the book-keeping for you, including making it harder to lose track of where you are.

Re: Do-nothing scripting: the key to gradual automation

#55
post #39

I know this isn’t the point of the article but the code shown there is the archetypal case where writing classes is an anti-pattern, as argued in “Stop Writing Classes” [1]. All the classes in that code can — should! — be functions. There’s no downside, and it’s less code (and otherwise identical). [1] https://news.ycombinator.com/item?id=3717715

I dunno. it could be argued that in the "do nothing" form of the script it's silly. HOWEVER some of those steps could eventually require the encapsulation of lots of behavior and information. So, `CreateSSHKeypairStep` Could become a full-on class with lots of small methods in it that eventually get wrapped up in a `.call` method. It seems better to start with code that's prepped for the eventuality you know is coming. Setting yourself up for a good long term codebase.

Re: Do-nothing scripting: the key to gradual automation

#56
post #39

I know this isn’t the point of the article but the code shown there is the archetypal case where writing classes is an anti-pattern, as argued in “Stop Writing Classes” [1]. All the classes in that code can — should! — be functions. There’s no downside, and it’s less code (and otherwise identical). [1] https://news.ycombinator.com/item?id=3717715

I dunno. it could be argued that in the "do nothing" form of the script it's silly. HOWEVER some of those steps could eventually require the encapsulation of lots of behavior and information. So, `CreateSSHKeypairStep` Could become a full-on class with lots of small methods in it that eventually get wrapped up in a `.call` method. It seems better to start with code that's prepped for the eventuality you know is comin…

Seems like a violation of YAGNI, and converting a function to a class is fairly effortless

Re: Do-nothing scripting: the key to gradual automation

#57

I get it, but this script looks a lot like a checklist to me. Seems like a checklist is a good place to start, no? If you want more "interest" during the process, make it a point to refine the documentation for your process (clarify a step here, split one command into two steps). Then you have a very clear spec by the time the process needs to be automated.

I think the value of using a script as your checklist is that the script can handle some of the book-keeping for you, including making it harder to lose track of where you are.

It also documents the process, which is often lacking for these one-offs tasks.

Re: Do-nothing scripting: the key to gradual automation

#58
In situations where using full-blown configuration management has too much overhead I often do something like this by just copying the commands I run into a script to begin with. It allows me to easily generalize a sequence of actions into a do-nothing template and doubles as documentation.

I'm very much against documenting concrete steps in a wiki if it is something that can be scripted. Such documentation becomes something that you must maintain, and faulty documentation is worse than no documentation.

I think that wiki documentation should be used to summarize workflows and provide context, but if you're writing step-by-step instructions, often you can just write a script with exactly the same amount of effort.

Re: Do-nothing scripting: the key to gradual automation

#59
post #25

Is anyone else bothered by how they were handling ssh keys in the example? The whole point of public keys is that the private key never has to leave the box it’s generated on. Once you go sharing them you might as well just use a random passphrase.

Yes, very much so. In addition stop using RSA[0] and use ed25519 with `ssh-keygen -t ed25519` [0]: https://blog.trailofbits.com/2019/07/08/fuck-rsa/

Because Jenkins has its own ssh client, that wasn't supported as of last year with elliptic curve based keys and I had to re-launch a bunch of servers in production to downgrade back to RSA or DSA keys because they were basically the only key types that Jenkins supported. Really not sure why Jenkins had to go this far to re-invent a cryptographic wheel (besides the usual "support both Windows and Linux" angle).

Re: Do-nothing scripting: the key to gradual automation

#60
post #45

I'd go farther... you can have steps that literally "do nothing". They can be comments, or simple echo statements. They're placeholders to remember to write the code for that step later. This is particularly important when you need to deal with integration that isn't necessarily easy - handling auth credential safely, making sure it works in your pipeline, etc. But all this gets back to something I used to say a lot,…

But these steps already do nothing except say echo what should be done. How does that differ from your "literally do nothing" steps?
Post reply on HN