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

account creation with invalid account name fails without clear error message #5

Open
tpraxl opened this issue Mar 5, 2023 · 1 comment

Comments

@tpraxl
Copy link
Contributor

tpraxl commented Mar 5, 2023

See example playbook at branch test/underscore_in_account_name:

https://github.com/tpraxl/friesenkiwi-test-playbook/tree/test/underscore_in_account_name

Using an invalid account name fails with a hard to understand error.

I offer to discuss, how we can improve either validating or the error output in that case, because the account name constraints might not be known. As a fallback, I would suggest to include a link to account name constraints in the README guide.

What do you think?

ansible-playbook -i account-inventory hello-world-goodbye.yml                                                                                         

PLAY [Setup, query and delete again an Uberspace] ********************************************************************************************************************************************

TASK [uberspace_account : Check loginname availability] **************************************************************************************************************************************
ok: [my_example.uber.space -> localhost]

TASK [uberspace_account : Do registration] ***************************************************************************************************************************************************
skipping: [my_example.uber.space]

TASK [uberspace_account : Lookup session] ****************************************************************************************************************************************************
skipping: [my_example.uber.space]

TASK [uberspace_account : Get main dashboard page to check if session expired] ***************************************************************************************************************
fatal: [my_example.uber.space]: FAILED! => {"msg": "The task includes an option with an undefined variable. The error was: 'uberspace_cookie' is undefined\n\nThe error appears to be in '/home/thomas/.ansible/collections/ansible_collections/friesenkiwi/uberspace/roles/uberspace_account/tasks/main.yml': line 26, column 5, but may\nbe elsewhere in the file depending on the exact syntax problem.\n\nThe offending line appears to be:\n\n  block:\n  - name: Get main dashboard page to check if session expired\n    ^ here\n"}

TASK [uberspace_account : Re-login] **********************************************************************************************************************************************************
included: /home/thomas/.ansible/collections/ansible_collections/friesenkiwi/uberspace/roles/uberspace_account/tasks/login.yml for my_example.uber.space

TASK [uberspace_account : Get login form for CSRF token] *************************************************************************************************************************************
ok: [my_example.uber.space -> localhost]

TASK [uberspace_account : Login to get session] **********************************************************************************************************************************************
fatal: [my_example.uber.space -> localhost]: FAILED! => {"changed": false, "connection": "close", "content": "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">\n<html xmlns=\"http://www.w3.org/1999/xhtml\" xml:lang=\"de\" lang=\"de\">\n<head>\n<meta http-equiv=\"content-type\" content=\"text/html; charset=utf-8\" />\n<meta http-equiv=\"content-language\" content=\"deutsch, de\" />\n<meta http-equiv=\"expires\" content=\"0\" />\n<meta name=\"description\" content=\"Uberspace.de ist deine Plattform für den Betrieb von Websites und Mail. Wir bieten ungewöhnlich viele Möglichkeiten, engagierte Unterstützung durch erfahrene Linux-Admins - und du suchst dir selbst aus, wieviel du dafür zahlst.\" />\n<meta name=\"keywords\" content=\"uberspace, hosting, ...\" />\n<meta name=\"author\" content=\"www.webcontact.de\" />\n<meta name=\"language\" content=\"de\" />\n<meta name=\"robots\" content=\"index,follow\" />\n\n<link rel=\"stylesheet\" href=\"css\" media=\"screen\" type=\"text/css\" />\n\n\n<!--[if gte IE 5]>\n\t<style>@font-face {font-family:'Gnuolane';src:url('static/fonts/gnuolane_rg-webfont.eot');}</style>\n<![endif]-->\n\n<!--[if lt IE 7]>\n\t<script src=\"static/js/IE7.js\" type=\"text/javascript\"></script>\n<![endif]-->\n\n<script async defer data-website-id=\"5d16360c-906e-4435-9ac5-37123ca675d9\" src=\"https://analytics.uberspace.de/umami.js\"></script>\n\n<script type=\"text/javascript\" src=\"static/js/jquery-1.4.2.min.js\" charset=\"utf-8\"></script>\n<script src=\"static/js/AjaxRequest.js\" type=\"text/javascript\"></script>\n<script src=\"static/js/passwordmeter3.js\" type=\"text/javascript\"></script>\n\n\n\n\n\n\n<!-- contactbox -->\n<script type=\"text/javascript\">\n\n  function flashmessage (content) {\n    /* fill with new content, if given */\n    if (content) {\n      document.getElementById('flash').innerHTML = content;\n    }\n    /* show flash message and fade out fast when clicked */\n    $(\"#flash\").slideDown('fast').click(function(){ $(this).fadeOut('fast') });\n    /* fade out slowly after a timeout */\n    setTimeout(\"$('#flash').fadeOut(2000)\", document.getElementById('flash').innerHTML.length * 100);\n  }\n\n  jQuery(document).ready(function() {\n\n\n  });\n\n</script>\n\n<link rel=\"shortcut icon\" href=\"static/favicon.ico\" />\n<title>Tickets, please - Uberspace.de</title>\n\n</head>\n\n<body id=\"innen\">\n\n<div id=\"flash\" class=\"opacity90 \">\n</div>\n\n<div class=\"wrapper\">\n    <div class=\"header\">\n    \t<div class=\"wrapper960\">\n            <a href=\"https://uberspace.de/\" name=\"top\"><img src=\"static/img/logo-trans-2012.png\" width=\"295\" height=\"165\" alt=\"Uberspace - Hosting on Asteroids\" title=\"Uberspace - Hosting on Asteroids\" class=\"logo\" /></a>\n            \n                \n                \n            \n\n\n   \t</div><!-- .wrapper960 -->\n    </div><!-- .header -->\n    \n    <div class=\"greyarea\">\n    \t<div class=\"wrapper940\">\n            <div class=\"c300 intro fl\">\n                <h1><span>Tickets, please</span></h1>\n\n                \n\n                \n                <div class=\"anker\">\n\n</div>\n\n                \n\n            </div><!-- .c300 -->\n            \n\n<div class=\"c540 intro fl\">\n  <p>\n    Du bist bereits Ubernaut? Prima. Dann brauchst du nur deine Zugangsdaten oder deine OpenID anzugeben,\n    damit wir dich wiedererkennen.\n  </p>\n</div>\n\n\n\n\n            <p class=\"cb\"></p>\n\n\n\n        </div><!-- .wrapper940 -->\n    </div><!-- .greyarea -->\n    \n    <div class=\"content\">\n    \t<div class=\"wrapper940\">\n\n\n<div class=\"c300 fl\">\n  <h2>Zugang via Passwort</h2>\n  <p>\n    Wenn du deinen Zugang mit einem Passwort gesichert hast,\n    gib hier bitte deinen Accountnamen und das Passwort an.\n  </p>\n  <form action=\"/login\" method=\"post\">\n<input name=\"_csrf_token\" type=\"hidden\" value=\"[REDACTED]\" />\n<div>\n<label>Username</label>\n<input name=\"login\" type=\"text\" value=\"my_example\" maxlength=\"8\" title=\"Please enter your username / Bitte gib hier deinen Benutzernamen ein\" />\n</div>\n<div>\n<span>Please enter / Bitte ausfüllen</span>\n<label>Password</label>\n<input name=\"password\" type=\"password\" value=\"\" title=\"Please enter your password / Bitte gib hier dein Passwort ein\" />\n</div>\n<div>\n<input name=\"submit\" type=\"submit\" value=\"login\" />\n</div>\n</form>\n\n  <noscript><b>Achtung, bitte:</b> Die Nutzung des Dashboards setzt <em>zwingend Javascript</em> voraus!</noscript>\n</div>\n\n<div class=\"c300 fl\">\n  <h2>Zugang via OpenID</h2>\n  <p>\n    Wenn du in deinem Zugang eine OpenID hinterlegt hast,\n    gib hier einfach die entsprechende URL an.\n  </p>\n  <form method=\"post\" id=\"openid_form\" action=\"login/openid\">\n  <input type=\"hidden\" name=\"_csrf_token\" value=\"029554E2B91CAC19DC715AB34E21DEAD\" />\n  <input type=\"text\" id=\"openid_identifier\" name=\"openid_identifier\" placeholder=\"http://\" />\n  <input type=\"submit\" value=\"go\" />\n  </form>\n  <h2>Kein Zugang mehr?</h2>\n  <p>\n    Du hast dein Passwort vergessen, deine OpenID verlegt oder dein OpenID-Provider ist durchgebrannt? Kein Problem, das bekommen wir wieder hin:\n  </p>\n  <p>\n    <a href=\"login/pwrecoveryrequest\">Wiederherstellungs-Link anfordern</a>\n  </p>\n</div>\n\n            <div class=\"c220 fr kontaktbox\">\n\n                <h3>Noch Fragen?</h3>\n\n                <p><span class=\"vers mini85\">Schau in unser</span><br />\n                  <span class=\"maxi13\">\n                  <a href=\"https://manual.uberspace.de/\" target=\"_blank\"><strong>Handbuch</strong></a>\n                  </span>\n                </p>\n                <p><span class=\"vers mini85\">Schreib uns</span><br /><span class=\"maxi13\"><a href=\"mailto:[email protected]\"><strong>[email protected]</strong></a></span><br /><span class=\"vers mini85\"><a href=\"/static/uberspace.gpg.asc\" target=\"_blank\" title=\"Fingerprint: 30BE F274 C7F4 701F 376B  2248 B992 F4EA 2FE0 4419\">GnuPG-Key B992F4EA2FE04419</a><br /><small>Fingerprint: 30BE F274 C7F4 701F<br />376B  2248 B992 F4EA 2FE0 4419</small></span></p>\n                <p><span class=\"vers mini85\">Twittere mit uns</span><br /><span class=\"maxi13\"><a href=\"https://twitter.com/hallouberspace\" target=\"_blank\"><strong>twitter.com/hallouberspace</strong></a></span></p>\n\n<br />\n\n                <h3>Sag’s weiter</h3>\n\n                <p>\n                  \n                    Du bist happy bei uns? Erzähl es deinen Freundinnen, damit sie ebenso happy werden können!\n                  \n                </p>\n\n            </div><!-- .c220 -->\n\n\n\n\n\n            <p class=\"cb\"></p>\n        </div><!-- .wrapper940 -->\n    </div><!-- .content -->\n</div><!-- .wrapper -->\n\n</body>\n</html>\n", "content_length": "6401", "content_security_policy": "default-src 'self' 'unsafe-inline' https://analytics.uberspace.de; frame-ancestors 'none'", "content_type": "text/html; charset=utf-8", "cookies": {"uberspace_session": "[REDACTED]"}, "cookies_string": "uberspace_session=[REDACTED]", "date": "Sun, 05 Mar 2023 13:37:15 GMT", "elapsed": 0, "msg": "Status code was 200 and not [302]: OK (6401 bytes)", "redirected": false, "referrer_policy": "same-origin", "server": "nginx/1.20.1", "set_cookie": "uberspace_session=[REDACTED]; path=/; expires=Sun, 05-Mar-2023 14:37:15 GMT; secure; HttpOnly", "status": 200, "strict_transport_security": "max-age=31536000", "url": "https://dashboard.uberspace.de/login", "x_content_type_options": "nosniff", "x_frame_options": "DENY", "x_xss_protection": "1; mode=block"}

PLAY RECAP ***********************************************************************************************************************************************************************************
my_example.uber.space      : ok=3    changed=0    unreachable=0    failed=1    skipped=2    rescued=1    ignored=0
@friesenkiwi
Copy link
Owner

Oh, yes nice catch!

That definitely should be handled. Obviously the problem is in TASK [uberspace_account : Do registration] *** skipping: [my_example.uber.space]: it shouldn't skip but rather fail there with the error message from the server's response. Link to the readme would be a good addition.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants