Taskotron init script PoC
Needs ReviewPublic

Authored by lbrabec on Aug 10 2016, 2:32 PM.

Details

Summary

Script that inits taskotron and testcloud after installation. This is PoC to open a discussion what else we'd like to see in init script.

Test Plan

run the script

Diff Detail

Lint
Lint Skipped
Unit
Unit Tests Skipped
lbrabec retitled this revision from to Taskotron init script PoC.Aug 10 2016, 2:32 PM
lbrabec updated this object.
lbrabec edited the test plan for this revision. (Show Details)
lbrabec added reviewers: kparal, jskladan, mkrizek.
lbrabec added a project: libtaskotron.

I thought that we were going to do this in python as part of the cli re-work, is this something different?

I imagined this would be written in Python. It could be easier for some tasks, especially if we're going to parse existing testcloud settings as suggested. Running simple command like options is not that difficult in Python, just subprocess.check_call(...). But I don't have strong objections against bash either, it's just that we'll have another executable around.

taskotron_init.sh
4–6

I wonder if we could do this idempotent? Always end up with same result, even if run several times, therefore no need to worry about overwriting something?

19

We could do something like

Your testcloud config includes these ssh keys at this moment:
XXX
Do you want to add any new ones? [y/n]

57

Let's check the current groups first, and skip if taskotron group is already present for the user. If not, let's ask whether to run the command or skip (maybe the user wants to run it him/herself).

60

I'd say is required.

In D966#18267, @kparal wrote:

I imagined this would be written in Python. It could be easier for some tasks, especially if we're going to parse existing testcloud settings as suggested. Running simple command like options is not that difficult in Python, just subprocess.check_call(...). But I don't have strong objections against bash either, it's just that we'll have another executable around.

Bash is my go for language for stuff like this and I'd prefer one subprocess.check_call(...) over more, but not having another executable around is probably better. Python then.

Parsing existing testcloud settings means parsing cloud-init configuration (or do I miss something?). Reading the cloud-config docs, it is in yaml, so no problem I guess.

lbrabec added inline comments.Aug 10 2016, 5:32 PM
taskotron_init.sh
4–6

Sure, idempotent init is probably better.

I was aiming on something like arc does when it is executed for the first time, it tells you to run arc install-certificate. I think it would be nice to have such behavior in runtask (or taskotron run).

In D966#18273, @lbrabec wrote:

Parsing existing testcloud settings means parsing cloud-init configuration (or do I miss something?).

I meant the file in ~/.config/testcloud/settings.py (in order to be able to append ssh keys and not overwrite the existing ones). But that was just an idea, we don't have to support this use case.

mkrizek resigned from this revision.Thu, Jul 13, 9:03 AM