# Checking User Existence Rake

**URL:** <https://meta.discourse.org/t/checking-user-existence-rake/311065>\
**Category:** Development\
**Created:** [June 7, 2024, 12:07am UTC](https://meta.discourse.org/t/checking-user-existence-rake/311065 "2024-06-07T00:07:26Z")\
**Posts on this page:** 1\
**Showing post:** 3

<div class="post-metadata">

**Author:** ![codethulu](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/codethulu/32/419120_2.png) [@codethulu](https://meta.discourse.org/u/codethulu)\
**Post date:** [June 10, 2024, 10:51am UTC](https://meta.discourse.org/t/checking-user-existence-rake/311065/3 "2024-06-10T10:51:00Z")

</div>

I’m not quite sure I understand, sorry.

We want to create some actions that a user could utilise when deploying discourse with the charm. One of these is to create a user account.

Since this behaviour is covered by a rake task, behaviour is isolated from the operator code, which can only execute the rake task, and [input through `stdin`](https://github.com/canonical/discourse-k8s-operator/blob/main/src/charm.py#L714).

If a user already exists, the rake task will ask some additional prompts, [asking if the password should be overwritten](https://github.com/discourse/discourse/blob/main/lib/tasks/admin.rake#L52). This means that the `stdin` will no longer be sufficient.

We have patched the `users:exists` rake task that has now been submitted as a PR to address this: we can check if the user exists already, and then adjust the `stdin` as appropriate.

---

_[View the full topic](https://meta.discourse.org/t/checking-user-existence-rake/311065)._
