[uyuni-devel] Looking for a way to automate the first organization creation

Hello Uyuni team! I'm currently writing a Chef cookbook for automating Uyuni test deployments. After installing Uyuni, the first organization still needs to be created using the web page. I understand that there is an automation tool spacecmd, but this seems not to work if no organization or admin user exist: # spacecmd org_create Spacewalk Username: Spacewalk Password: ERROR: Invalid credentials I figured out that entering no username/password does not work (also not via the .spacecmd/config file) - so therefore the error message seems legit. My question is now: how can I automate this? I cannot used the web page in an automated manner. Is there an option for the /root/setup_env.sh file? Thanks a lot in advance - also keep up the good work! Best wishes, Christian Stankowic

I think, currently there is no way. This has been removed in 2015. See https://www.redhat.com/archives/spacewalk-devel/2015-December/msg00000.html. Currently, I could only think of manual SQL to first create the user and then, create the org. Good luck. Robert
Gesendet: Dienstag, 13. November 2018 um 23:30 Uhr Von: "Stankowic, Christian" <Christian.Stankowic@sva.de> An: "uyuni-devel@opensuse.org" <uyuni-devel@opensuse.org> Betreff: [uyuni-devel] Looking for a way to automate the first organization creation
Hello Uyuni team!
I'm currently writing a Chef cookbook for automating Uyuni test deployments. After installing Uyuni, the first organization still needs to be created using the web page.
I understand that there is an automation tool spacecmd, but this seems not to work if no organization or admin user exist:
# spacecmd org_create Spacewalk Username: Spacewalk Password: ERROR: Invalid credentials
I figured out that entering no username/password does not work (also not via the .spacecmd/config file) - so therefore the error message seems legit.
My question is now: how can I automate this? I cannot used the web page in an automated manner. Is there an option for the /root/setup_env.sh file?
Thanks a lot in advance - also keep up the good work!
Best wishes, Christian Stankowic
-- To unsubscribe, e-mail: uyuni-devel+unsubscribe@opensuse.org To contact the owner, e-mail: uyuni-devel+owner@opensuse.org

Oh...this one might help https://www.redhat.com/archives/spacewalk-list/2016-February/msg00094.html Robert
Gesendet: Mittwoch, 14. November 2018 um 00:28 Uhr Von: "Robert Paschedag" <robert.paschedag@web.de> An: "Stankowic, Christian" <Christian.Stankowic@sva.de> Cc: "uyuni-devel@opensuse.org" <uyuni-devel@opensuse.org> Betreff: Aw: [uyuni-devel] Looking for a way to automate the first organization creation
I think, currently there is no way. This has been removed in 2015. See https://www.redhat.com/archives/spacewalk-devel/2015-December/msg00000.html.
Currently, I could only think of manual SQL to first create the user and then, create the org.
Good luck.
Robert
Gesendet: Dienstag, 13. November 2018 um 23:30 Uhr Von: "Stankowic, Christian" <Christian.Stankowic@sva.de> An: "uyuni-devel@opensuse.org" <uyuni-devel@opensuse.org> Betreff: [uyuni-devel] Looking for a way to automate the first organization creation
Hello Uyuni team!
I'm currently writing a Chef cookbook for automating Uyuni test deployments. After installing Uyuni, the first organization still needs to be created using the web page.
I understand that there is an automation tool spacecmd, but this seems not to work if no organization or admin user exist:
# spacecmd org_create Spacewalk Username: Spacewalk Password: ERROR: Invalid credentials
I figured out that entering no username/password does not work (also not via the .spacecmd/config file) - so therefore the error message seems legit.
My question is now: how can I automate this? I cannot used the web page in an automated manner. Is there an option for the /root/setup_env.sh file?
Thanks a lot in advance - also keep up the good work!
Best wishes, Christian Stankowic
-- To unsubscribe, e-mail: uyuni-devel+unsubscribe@opensuse.org To contact the owner, e-mail: uyuni-devel+owner@opensuse.org
-- To unsubscribe, e-mail: uyuni-devel+unsubscribe@opensuse.org To contact the owner, e-mail: uyuni-devel+owner@opensuse.org

Hello Robert, thanks for the fast feedback. As a workaround, I implemented the following script: csrf="$(curl --insecure https://localhost/rhn/newlogin/CreateFirstUser.do | grep csrf | grep -o 'value=.*' | tr -d 'a-zA-Z">=')" curl --insecure -d "csrf_token=$csrf&submitted=true&orgName=demoOrg&login=admin&desiredpassword=Mimimi01&desiredpasswordConfirm=Mimimi01&email=info@pinkepank.io&firstNames=Paula&lastName=Pinkepank" -X POST https://localhost/rhn/newlogin/CreateFirstUser.do It simply extracts the csrf_value and does a simple POST via curl. It's bloody ugly, but works. ¯\_(ツ)_/¯ Best wishes, Christian. -----Ursprüngliche Nachricht----- Von: Robert Paschedag <robert.paschedag@web.de> Gesendet: Mittwoch, 14. November 2018 00:29 An: Stankowic, Christian <Christian.Stankowic@sva.de> Cc: uyuni-devel@opensuse.org Betreff: Aw: [uyuni-devel] Looking for a way to automate the first organization creation I think, currently there is no way. This has been removed in 2015. See https://www.redhat.com/archives/spacewalk-devel/2015-December/msg00000.html. Currently, I could only think of manual SQL to first create the user and then, create the org. Good luck. Robert
Gesendet: Dienstag, 13. November 2018 um 23:30 Uhr Von: "Stankowic, Christian" <Christian.Stankowic@sva.de> An: "uyuni-devel@opensuse.org" <uyuni-devel@opensuse.org> Betreff: [uyuni-devel] Looking for a way to automate the first organization creation
Hello Uyuni team!
I'm currently writing a Chef cookbook for automating Uyuni test deployments. After installing Uyuni, the first organization still needs to be created using the web page.
I understand that there is an automation tool spacecmd, but this seems not to work if no organization or admin user exist:
# spacecmd org_create Spacewalk Username: Spacewalk Password: ERROR: Invalid credentials
I figured out that entering no username/password does not work (also not via the .spacecmd/config file) - so therefore the error message seems legit.
My question is now: how can I automate this? I cannot used the web page in an automated manner. Is there an option for the /root/setup_env.sh file?
Thanks a lot in advance - also keep up the good work!
Best wishes, Christian Stankowic

Hi Christian and Robert. AFAIK, /root/setup_env.sh will not allow you to specify data for the first org and user. But you can use curl to fill in the form with a call like this one: curl -k -X POST -d "submitted=true&orgName=MYORGNAME&login=MYADMINUSER&desiredpassword=MYADMINPASSWORD&desiredpasswordConfirm=MYADMINPASSWORD&email=MYADMINEMAIL&firstNames=MYADMINFIRSTNAME&lastName=MYADMINLASTNAME" https://UYUNISERVERHOSTNAME/rhn/newlogin/CreateFirstUser.do Just replace the stuff in caps with the data you want for your first organization and user, and UYUNISERVERHOSTNAME with the hostname/IP for the server. Needless to say, the call could change a little if the webUI changes at some point, but this was working when I prepared the workshop for Uyuni at the openSUSE Conference 2018, and I am not aware we changed this part of the WebUI. BTW: Since the last week we already have uyuni-users@opensuse.org [1] available for user related discussion. I am adding this to CC so we can have record of this thread there. Best regards. [1] You can subscribe at https://lists.opensuse.org/uyuni-users/ On miércoles, 14 de noviembre de 2018 0:28:32 (CET) Robert Paschedag wrote:
I think, currently there is no way. This has been removed in 2015. See https://www.redhat.com/archives/spacewalk-devel/2015-December/msg00000.html .
Currently, I could only think of manual SQL to first create the user and then, create the org.
Good luck.
Robert
Gesendet: Dienstag, 13. November 2018 um 23:30 Uhr Von: "Stankowic, Christian" <Christian.Stankowic@sva.de> An: "uyuni-devel@opensuse.org" <uyuni-devel@opensuse.org> Betreff: [uyuni-devel] Looking for a way to automate the first organization creation
Hello Uyuni team!
I'm currently writing a Chef cookbook for automating Uyuni test deployments. After installing Uyuni, the first organization still needs to be created using the web page.
I understand that there is an automation tool spacecmd, but this seems not to work if no organization or admin user exist:
# spacecmd org_create Spacewalk Username: Spacewalk Password: ERROR: Invalid credentials
I figured out that entering no username/password does not work (also not via the .spacecmd/config file) - so therefore the error message seems legit.
My question is now: how can I automate this? I cannot used the web page in an automated manner. Is there an option for the /root/setup_env.sh file?
Thanks a lot in advance - also keep up the good work!
Best wishes, Christian Stankowic
-- Julio González Gil <jgonzalez@suse.com> Release Engineer SUSE Linux GmbH, Maxfeldstr. 5, D-90409 Nürnberg Tel: +49-911-74053-0; Fax: +49-911-7417755; https://www.suse.com/ SUSE Linux GmbH, GF: Felix Imendörffer, Jane Smithard, Graham Norton, HRB 21284 (AG Nürnberg)

Hello Julio, thanks for the feedback and the hint about the uyuni-users mailing list! I also created an issue on GitHub[1], IMHO this would be a great feature enhancement. [1]: https://github.com/uyuni-project/uyuni/issues/296 Best regards, Christian. -----Ursprüngliche Nachricht----- Von: Julio González Gil <jgonzalez@suse.com> Gesendet: Mittwoch, 14. November 2018 00:51 An: uyuni-devel@opensuse.org Cc: Robert Paschedag <robert.paschedag@web.de>; Stankowic, Christian <Christian.Stankowic@sva.de>; uyuni-users@opensuse.org Betreff: Re: Aw: [uyuni-devel] Looking for a way to automate the first organization creation Hi Christian and Robert. AFAIK, /root/setup_env.sh will not allow you to specify data for the first org and user. But you can use curl to fill in the form with a call like this one: curl -k -X POST -d "submitted=true&orgName=MYORGNAME&login=MYADMINUSER&desiredpassword=MYADMINPASSWORD&desiredpasswordConfirm=MYADMINPASSWORD&email=MYADMINEMAIL&firstNames=MYADMINFIRSTNAME&lastName=MYADMINLASTNAME" https://UYUNISERVERHOSTNAME/rhn/newlogin/CreateFirstUser.do Just replace the stuff in caps with the data you want for your first organization and user, and UYUNISERVERHOSTNAME with the hostname/IP for the server. Needless to say, the call could change a little if the webUI changes at some point, but this was working when I prepared the workshop for Uyuni at the openSUSE Conference 2018, and I am not aware we changed this part of the WebUI. BTW: Since the last week we already have uyuni-users@opensuse.org [1] available for user related discussion. I am adding this to CC so we can have record of this thread there. Best regards. [1] You can subscribe at https://lists.opensuse.org/uyuni-users/ On miércoles, 14 de noviembre de 2018 0:28:32 (CET) Robert Paschedag wrote:
I think, currently there is no way. This has been removed in 2015. See https://www.redhat.com/archives/spacewalk-devel/2015-December/msg00000 .html .
Currently, I could only think of manual SQL to first create the user and then, create the org.
Good luck.
Robert
Gesendet: Dienstag, 13. November 2018 um 23:30 Uhr Von: "Stankowic, Christian" <Christian.Stankowic@sva.de> An: "uyuni-devel@opensuse.org" <uyuni-devel@opensuse.org> Betreff: [uyuni-devel] Looking for a way to automate the first organization creation
Hello Uyuni team!
I'm currently writing a Chef cookbook for automating Uyuni test deployments. After installing Uyuni, the first organization still needs to be created using the web page.
I understand that there is an automation tool spacecmd, but this seems not to work if no organization or admin user exist:
# spacecmd org_create Spacewalk Username: Spacewalk Password: ERROR: Invalid credentials
I figured out that entering no username/password does not work (also not via the .spacecmd/config file) - so therefore the error message seems legit.
My question is now: how can I automate this? I cannot used the web page in an automated manner. Is there an option for the /root/setup_env.sh file?
Thanks a lot in advance - also keep up the good work!
Best wishes, Christian Stankowic
-- Julio González Gil <jgonzalez@suse.com> Release Engineer SUSE Linux GmbH, Maxfeldstr. 5, D-90409 Nürnberg Tel: +49-911-74053-0; Fax: +49-911-7417755; https://www.suse.com/ SUSE Linux GmbH, GF: Felix Imendörffer, Jane Smithard, Graham Norton, HRB 21284 (AG Nürnberg)

On 11/13/2018 11:30 PM, Stankowic, Christian wrote:
My question is now: how can I automate this? I cannot used the web page in an automated manner.
In sumaform[1], a tool to deploy test SUSE Manager and Uyuni environments with servers, clients, proxies, etc. we use Salt for all the setup - I would say that a lot of use cases are covered including repository synchronization, registration, activation keys, Inter-Server Sync, monitoring and so on. States to set up SUSE Manager/Uyuni Servers are here: https://github.com/moio/sumaform/tree/master/salt/suse_manager_server Creation of the first user is here: https://github.com/moio/sumaform/blob/master/salt/suse_manager_server/initia... If ever a less-brutal way is implemented this file will change accordingly! Hope this helps! [1] https://github.com/moio/sumaform Regards, -- Silvio Moioli SUSE Manager Development Team -- To unsubscribe, e-mail: uyuni-devel+unsubscribe@opensuse.org To contact the owner, e-mail: uyuni-devel+owner@opensuse.org

On 11/14/18 7:11 AM, Silvio Moioli wrote:
Creation of the first user is here:
https://github.com/moio/sumaform/blob/master/salt/suse_manager_server/initia...
While this solves the problem at hand, I'd like to see this implemented on the API/CLI level. Anybody opening a respective issue on github please ? ;-) Klaus -- To unsubscribe, e-mail: uyuni-devel+unsubscribe@opensuse.org To contact the owner, e-mail: uyuni-devel+owner@opensuse.org
participants (5)
-
Julio González Gil
-
Klaus Kämpf
-
Robert Paschedag
-
Silvio Moioli
-
Stankowic, Christian