SSH keys technique pre-hook need to be done just before the first directive of that technique
When ssh keys is deployed after new user creation, the ssh key task result in error.
I've created 2 directives in a Rule, "01 Create users" and "02 Deploy SSH keys". The "02 Deploy Ssh keys" directive fail with error 'user not exist' (previously created with Directive 01) but work when rudder launch again the Rule.
User is correctly created before ssh key deployment.
Output of rules:
2019-03-06 16:28:18 result_error 01. Test common rules 02. Deploy common SSH keys Flush SSH file user3 The user user3 does not exists on this system 2019-03-06 16:28:17 result_error 01. Test common rules 02. Deploy common SSH keys SSH key user3 The user user3 does NOT exist on this machine, not adding SSH key 2019-03-06 16:28:17 result_na 01. Test common rules 01. Create common users Home directory user3 The user user3 doesn't need to have its home directory checked 2019-03-06 16:28:17 result_repaired 01. Test common rules 01. Create common users Password user3 The user user3 ( Without any defined full name ) password was repaired 2019-03-06 16:28:17 result_repaired 01. Test common rules 01. Create common users Users user3 The user user3 ( Without any defined full name ) has been added to the system
I've created 2 differents rules with 1 directive on each. User creation in first rule, ssh key in second rule and behaviour is same.
Updated by François ARMAND over 4 years ago
- Subject changed from SSH key deploy error after user creation to SSH key deploy error after user creation on the same agent run
- Severity set to Minor - inconvenience | misleading | easy workaround
- User visibility set to Getting started - demo | first install | Technique editor and level 1 Techniques
- Priority changed from 0 to 50
Thanks for reporting.
I'm setting severity as minor as, AFAIU, it's self healing. Please let me know if I undersetimated it.
Would you mind telling us the version of Rudder (server, agent on node) and the technique version used? It will be easier to reproduce and correct. Thanks !
Updated by Nicolas CHARLES over 4 years ago
- Target version set to 4.3.11
This is because the management of SSH keys has a pre-hook run at the start of the agent, to get relevant information about users and paths - and so the user doesn't exist yet.
Happens in 4.3 and later, with separated techniques.
A possible solutino would be to be less eager in the eecution of pre-hook, running it only right before the first instance of the technique rather than at the very start of the agent run (and same for posthook, being after the last instance of the technique rather at the very end)
What do you think of it Francois ?
Updated by François ARMAND almost 4 years ago
- Subject changed from SSH key deploy error after user creation on the same agent run to SSH keys technique pre-hook need to be done just before the first directive of that technique
- Priority changed from 46 to 45
Nicolas: I think it's a good and what need to be done, but it seems non trivial.