Project

General

Profile

Actions

Bug #4675

closed

"Email address is invalid" error when TLD contains digits

Added by Jorick Astrego over 10 years ago. Updated over 3 years ago.

Status:
Closed
Priority:
Normal
Assignee:
-
Category:
DB migrations
Target version:
-
Difficulty:
Triaged:
No
Fixed in Releases:
Found in Releases:

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

Actions #1

Updated by Dominic Cleal over 10 years ago

  • 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.

Actions #2

Updated by Jorick Astrego over 10 years ago

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

Actions #3

Updated by Dominic Cleal over 10 years ago

Can you try the DB reset? It might be the configuration when the DB was seeded was incorrect, but is now fixed.

Actions #4

Updated by Jorick Astrego over 10 years ago

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]

Actions #5

Updated by Dominic Cleal over 10 years ago

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.

Actions #6

Updated by Jorick Astrego over 10 years ago

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?

Actions #7

Updated by Dominic Cleal over 10 years ago

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.

Actions #8

Updated by Jorick Astrego over 10 years ago

id | name | value | description | category | settings_type | default | created_at | updated_at
----+---------------+-------+-----------------------------------------+------------------+---------------+------------------------+----------------------------+----------------------------
14 | administrator | | The default administrator email address | Setting::General | string | --- | 2014-03-17 15:05:56.464209 | 2014-03-17 15:05:56.464209

Actions #9

Updated by Dominic Cleal over 10 years ago

  • 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: "

Then re-run the migrate, seed and installer commands.

Actions #10

Updated by Jorick Astrego over 10 years ago

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.

Actions #11

Updated by Leos Stejskal over 3 years ago

  • 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.

Actions

Also available in: Atom PDF