Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a command line flag to accept all prompts to enable scripted execution #307

Closed
kennsippell opened this issue Mar 31, 2020 · 6 comments · Fixed by #343
Closed

Add a command line flag to accept all prompts to enable scripted execution #307

kennsippell opened this issue Mar 31, 2020 · 6 comments · Fixed by #343
Assignees
Labels
Type: Feature Add something new

Comments

@kennsippell
Copy link
Member

kennsippell commented Mar 31, 2020

Scripts that use medic-conf to automate deployments hang waiting on the following input:

We can't determine if you're going to overwrite someone else's changes or not. Would you like to proceed? [y/n]:

This experience is great when there is a user present but for automated scripts (travis, CI pipelines, etc) medic-conf should support an option to --force the deployment and --unattended exit with an error isntead of prompting the user.

One example is LG's CI pipeline. This experience is incompatible with their pipeline and will effectively block their upgrade to 3.8.1 since medic-conf 3.1 is required to work with that version of the core.

@kennsippell kennsippell added the Type: Bug Fix something that isn't working as intended label Mar 31, 2020
@newtewt
Copy link
Contributor

newtewt commented Jul 15, 2020

For AT: medic-conf has a --force argument now that bypasses user input. Test that using the normal user input works y, n, 1,2,3 options and test that passing --force makes medic-conf upload docs, forms, creates-users, move-contacts, overwrites changes without further prompting.

The branch is 307_force_arg in medic-conf. Details about executing medic-conf through local source is here.

@garethbowen garethbowen added Type: Feature Add something new and removed Type: Bug Fix something that isn't working as intended labels Jul 15, 2020
@garethbowen
Copy link
Member

This isn't a bug because the code is working as intended. Added to 3.11.0 and assigned to Nick because he's already working on it.

@garethbowen garethbowen changed the title medic-conf hangs in automated scripts pending user input Add a command line flag to accept all prompts to enable scripted execution Jul 15, 2020
@ngaruko
Copy link
Contributor

ngaruko commented Jul 21, 2020

Looks good with the y/n prompt. However, with the other prompt [1,2,3], there are instances where the prompt appears twice. In that case, only the first one is overridden by --force, the second prompt still appears and requires manual input. Did you wanna have a second look @newtewt ?

node ~/Medic/medic-dev/medic-conf/src/bin/medic-conf.js --local upload-app-forms --force
INFO Using local url from COUCH_URL environment variable: http://admin:****@localhost:5984/medic 
INFO Processing config in default. 
INFO Actions:
     - upload-app-forms 
INFO Starting action: upload-app-forms… 
INFO Preparing form for upload: death_report.xml… 
INFO No media directory found at /Users/bede/Medic/medic-dev/cht-core/config/default/forms/app/death_report-media for form /Users/bede/Medic/medic-dev/cht-core/config/default/forms/app/death_report.xml 
INFO Preparing form for upload: delivery.xml… 
INFO No media directory found at /Users/bede/Medic/medic-dev/cht-core/config/default/forms/app/delivery-media for form /Users/bede/Medic/medic-dev/cht-core/config/default/forms/app/delivery.xml 
INFO Preparing form for upload: pnc_danger_sign_follow_up_baby.xml… 
INFO No media directory found at /Users/bede/Medic/medic-dev/cht-core/config/default/forms/app/pnc_danger_sign_follow_up_baby-media for form /Users/bede/Medic/medic-dev/cht-core/config/default/forms/app/pnc_danger_sign_follow_up_baby.xml 
INFO Preparing form for upload: pnc_danger_sign_follow_up_mother.xml… 
INFO No media directory found at /Users/bede/Medic/medic-dev/cht-core/config/default/forms/app/pnc_danger_sign_follow_up_mother-media for form /Users/bede/Medic/medic-dev/cht-core/config/default/forms/app/pnc_danger_sign_follow_up_mother.xml 
INFO Preparing form for upload: pregnancy.xml… 
INFO No media directory found at /Users/bede/Medic/medic-dev/cht-core/config/default/forms/app/pregnancy-media for form /Users/bede/Medic/medic-dev/cht-core/config/default/forms/app/pregnancy.xml 
INFO Preparing form for upload: pregnancy_danger_sign.xml… 
INFO No media directory found at /Users/bede/Medic/medic-dev/cht-core/config/default/forms/app/pregnancy_danger_sign-media for form /Users/bede/Medic/medic-dev/cht-core/config/default/forms/app/pregnancy_danger_sign.xml 
INFO Preparing form for upload: pregnancy_danger_sign_follow_up.xml… 
INFO No media directory found at /Users/bede/Medic/medic-dev/cht-core/config/default/forms/app/pregnancy_danger_sign_follow_up-media for form /Users/bede/Medic/medic-dev/cht-core/config/default/forms/app/pregnancy_danger_sign_follow_up.xml 
INFO Preparing form for upload: pregnancy_facility_visit_reminder.xml… 
INFO No media directory found at /Users/bede/Medic/medic-dev/cht-core/config/default/forms/app/pregnancy_facility_visit_reminder-media for form /Users/bede/Medic/medic-dev/cht-core/config/default/forms/app/pregnancy_facility_visit_reminder.xml 
INFO Preparing form for upload: pregnancy_home_visit.xml… 
INFO No media directory found at /Users/bede/Medic/medic-dev/cht-core/config/default/forms/app/pregnancy_home_visit-media for form /Users/bede/Medic/medic-dev/cht-core/config/default/forms/app/pregnancy_home_visit.xml 
INFO Preparing form for upload: undo_death_report.xml… 
INFO No media directory found at /Users/bede/Medic/medic-dev/cht-core/config/default/forms/app/undo_death_report-media for form /Users/bede/Medic/medic-dev/cht-core/config/default/forms/app/undo_death_report.xml 
INFO Form /Users/bede/Medic/medic-dev/cht-core/config/default/forms/app/death_report.xml not uploaded, no changes 

[1] Overwrite the changes
[2] Abort so that you can update the configuration
[3] View diff

You are trying to modify a configuration that has been modified since your last upload. Do you want to? [1, 2, 3]: 

@newtewt
Copy link
Contributor

newtewt commented Jul 21, 2020

@ngaruko I'm struggling to reproduce this. Can you provide more detail about how your setup and what state your instance was in?

@ngaruko
Copy link
Contributor

ngaruko commented Jul 22, 2020

@newtewt Will put detail on that. Also was reported here with #113

@ngaruko
Copy link
Contributor

ngaruko commented Jul 22, 2020

Couldn't replicate. I guess we can close it off - assume I made a mistake and tested while still on master . Then we will catch it in automation, if it occurs!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: Feature Add something new
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants