Bug #4675
closed
"Email address is invalid" error when TLD contains digits
Added by Jorick Astrego over 11 years ago.
Updated about 4 years ago.
Description
I get the following error on install:
"Unable to create admin user: Email address is invalid"
But I cannot find where I have to specify the admin e-mail address.
/Stage[main]/Foreman::Database/Foreman::Rake[db:seed]/Exec[foreman-rake-db:seed]: Failed to call refresh: /usr/sbin/foreman-rake db:seed returned 1 instead of one of [0] at /usr/share/foreman-installer/modules/foreman/manifests/rake.pp:9
/Stage[main]/Foreman_proxy::Register/Foreman_smartproxy[xxxx.xxxxxx.xxxx]: Could not evaluate: 500 Internal Server Error
Installing Done [100%] [..........................................................................................................................................................]
Something went wrong! Check the log for ERROR-level output
The full log is at /var/log/foreman-installer/foreman-installer.log
[ WARN 2014-03-17 14:25:15 main] /Stage[main]/Foreman::Database/Foreman::Rake[db:migrate]/Exec[foreman-rake-db:migrate]: Triggered 'refresh' from 1 events
[DEBUG 2014-03-17 14:25:15 main] /Stage[main]/Foreman::Database/Foreman::Rake[db:migrate]/Exec[foreman-rake-db:migrate]: The container Foreman::Rake[db:migrate] will propagate my refresh event
[ INFO 2014-03-17 14:25:15 main] RESOURCE Foreman::Rake[db:migrate]
[DEBUG 2014-03-17 14:25:15 main] Foreman::Rake[db:migrate]: The container Class[Foreman::Database] will propagate my refresh event
[ INFO 2014-03-17 14:25:15 main] RESOURCE Foreman::Rake[db:seed]
[ INFO 2014-03-17 14:25:15 main] Foreman::Rake[db:seed]: Scheduling refresh of Exec[foreman-rake-db:seed]
[ INFO 2014-03-17 14:25:15 main] RESOURCE Exec[foreman-rake-db:seed]
[DEBUG 2014-03-17 14:25:15 main] Exec[foreman-rake-db:seed](provider=posix): Executing '/usr/sbin/foreman-rake db:seed'
[DEBUG 2014-03-17 14:25:15 main] Executing '/usr/sbin/foreman-rake db:seed'
[ WARN 2014-03-17 14:25:23 main] /Stage[main]/Foreman::Database/Foreman::Rake[db:seed]/Exec[foreman-rake-db:seed]/returns: rake aborted!
[ WARN 2014-03-17 14:25:23 main] /Stage[main]/Foreman::Database/Foreman::Rake[db:seed]/Exec[foreman-rake-db:seed]/returns: Unable to create admin user: Email address is invalid
[ WARN 2014-03-17 14:25:23 main] /Stage[main]/Foreman::Database/Foreman::Rake[db:seed]/Exec[foreman-rake-db:seed]/returns:
[ WARN 2014-03-17 14:25:23 main] /Stage[main]/Foreman::Database/Foreman::Rake[db:seed]/Exec[foreman-rake-db:seed]/returns: Tasks: TOP => db:seed
[ WARN 2014-03-17 14:25:23 main] /Stage[main]/Foreman::Database/Foreman::Rake[db:seed]/Exec[foreman-rake-db:seed]/returns: (See full trace by running task with --trace)
[ERROR 2014-03-17 14:25:23 main] /Stage[main]/Foreman::Database/Foreman::Rake[db:seed]/Exec[foreman-rake-db:seed]: Failed to call refresh: /usr/sbin/foreman-rake db:seed returned 1 instead of one of [0] at /usr/share/foreman-installer/modules/foreman/manifests/rake.pp:9
- Tracker changed from Bug to Support
- Status changed from New to Feedback
This usually indicates a missing FQDN and/or domain, since the default e-mail address uses the system domain.
Run "facter domain" and "facter fqdn" and ensure both have output, if not, check your system configuration (particularly the output of "hostname -f").
You'll probably need to stop Apache and then run "foreman-installer --reset-foreman-db" after fixing this.
All output looks ok:
[root@deploy ~]# facter domain
netbulae.dc01
[root@deploy ~]# facter fqdn
deploy.netbulae.dc01
[root@deploy ~]# hostname -f
deploy.netbulae.dc01
[root@deploy ~]# facter hostname
deploy
Can you try the DB reset? It might be the configuration when the DB was seeded was incorrect, but is now fixed.
I started from a fresh Centos 6.5 install (I had made a copy of the VM image before installing foreman) so there is nothing that changed.
I ran the DB reset for good measure but it fails also:
[ERROR 2014-03-17 16:06:03 main] /Stage[main]/Foreman_proxy::Register/Foreman_smartproxy[deploy.netbulae.dc01]: Could not evaluate: 500 Internal Server Error
[ INFO 2014-03-17 16:06:03 main] RESOURCE Foreman_smartproxy[deploy.netbulae.dc01]
Hm, maybe the reset didn't work as I expected. Try running these commands manually:
foreman-rake db:migrate
foreman-rake db:seed
If they give the same error about the e-mail address, we can dig into the DB I guess. If they appear to succeed, run the installer once more to complete the configuration.
foreman-rake db:seed
rake aborted!
Unable to create admin user: Email address is invalid
Tasks: TOP => db:seed
(See full trace by running task with --trace)
Any way to see what address the installer tries to use?
Try sudo -u foreman psql
and then run:
foreman=> select * from settings where name='administrator';
id | name | value | description | category | settings_type | defaul
t | created_at | updated_at
----+---------------+-------+-----------------------------------------+------------------+---------------+-------------
---------+----------------------------+----------------------------
1 | administrator | | The default administrator email address | Setting::General | string | --- root@exa
mple.com | 2014-03-17 13:33:28.533068 | 2014-03-17 13:33:28.533068
: ...
:
(1 row)
See inside the 'default' column there's an e-mail address set, which is initialised first when the database is empty from the domain as reported by Facter.
id | name | value | description | category | settings_type | default | created_at | updated_at
----+---------------+-------+-----------------------------------------+------------------+---------------+------------------------+----------------------------+----------------------------
14 | administrator | | The default administrator email address | Setting::General | string | --- root@netbulae.dc01 | 2014-03-17 15:05:56.464209 | 2014-03-17 15:05:56.464209
- Tracker changed from Support to Bug
- Project changed from Installer to Foreman
- Subject changed from Unable to create admin user: Email address is invalid to "Email address is invalid" error when TLD contains digits
- Category set to DB migrations
- Status changed from Feedback to New
- Priority changed from High to Normal
Ahh, I see. The message was actually (sort of) accurate!
E-mail addresses are validated by /\A([^
\s]+)((?:[-a-z0-9]+\.)*[a-z]{2,})\Z/i
which restricts the TLD of the domain to [a-z]
.
I would suggest putting a line in /etc/foreman/settings.yml that sets the e-mail address to something that it deems valid, e.g. ":administrator: root@example.com"
Then re-run the migrate, seed and installer commands.
Ah, now I see....
The workaround doesn't work however. The setting.yml appears to be replaced from template so I put it in /usr/share/foreman-installer/modules/foreman/templates/settings.yaml.erb and it gets set in settings.yml.
But the address still gets generated with the number TLD.
For now, I'll just change to using a TLD without numbers.
- Status changed from New to Closed
I'm closing the issue,
it have been here for some time and I wasn't able to reproduce it on the latest version.
If you think that the issue is still relevant feel free to reopen it.
Also available in: Atom
PDF