Project

General

Profile

Actions

Bug #1904

closed

Admin is not created in MySQL when there is a SQLite database

Added by Jasper Poppe over 11 years ago. Updated over 4 years ago.

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

Description

When Foreman is installed with the Debian packages the default database adapter is SQLite. When the SQLite database has been created and you change the adapter to mysql or mysql2 and run the '/usr/share/foreman/extras/dbmigrate' script the admin user will not be created.

It fails somehow even when running the 'RAILS_ENV=production rake permissions:reset' command. When you delete the SQLite database from the '/usr/share/foreman/db' directory the 'RAILS_ENV=production rake permissions:reset' works fine and the admin user will be created.

Actions #1

Updated by Jasper Poppe over 11 years ago

We start using nightly builds, probably I was wrong about the sqlite database. It seems to go wrong on the domain name I use: b.c.m.e FQDN: overlord001.b.c.m.e. When I change the domain name to e.g. gmail.com and delete the admin user entry the permission reset script works.

Actions #2

Updated by Ohad Levy over 11 years ago

  • Status changed from New to Resolved
Actions #3

Updated by Ohad Levy over 11 years ago

yes, foreman requires a domain name to be set to work correctly.

Actions #4

Updated by Jasper Poppe over 11 years ago

Sorry, maybe I was not clear enough. What I tried to say that Foreman doesn't accept b.c.m.e as a valid domain name. And I know quite some companies, including myself who are using short domain names for internal domains.

Actions #5

Updated by Jasper Poppe over 11 years ago

Jasper Poppe wrote:

Sorry, maybe I was not clear enough. What I tried to say that Foreman doesn't accept b.c.m.e as a valid domain name. And I know quite some companies, and also including myself who are using short domain names for internal domains.

Actions #6

Updated by Ohad Levy over 11 years ago

  • Status changed from Resolved to New

hmm... I can't seem to find any limitation on the domain name.... did you get a stack trace or errors in your logs?

Actions #7

Updated by Jasper Poppe over 11 years ago

The error you get when running the reset permissions task is 'mail is invalid'. It is pretty easy to reproduce, Just set the domain name to b.c.m.e and run the script. Or set it hardcoded in the reset permissions script like:
user = User.find_or_create_by_login(:login => "admin", :firstname => "Admin", :lastname => "User", :mail => "")

Clear the user table (important step) and run the reset permissions script:
root@overlord001:~/git/foreman# sudo mysql --defaults-extra-file=/etc/mysql/debian.cnf foreman -e 'DELETE FROM users'

root@overlord001:~/git/foreman# sudo RAILS_ENV=production rake permissions:reset
/root/git/foreman/vendor/ruby/1.8/gems/ruby_parser-2.3.1/lib/ruby_parser_extras.rb:10: warning: already initialized constant ENC_NONE
/root/git/foreman/vendor/ruby/1.8/gems/ruby_parser-2.3.1/lib/ruby_parser_extras.rb:11: warning: already initialized constant ENC_EUC
/root/git/foreman/vendor/ruby/1.8/gems/ruby_parser-2.3.1/lib/ruby_parser_extras.rb:12: warning: already initialized constant ENC_SJIS
/root/git/foreman/vendor/ruby/1.8/gems/ruby_parser-2.3.1/lib/ruby_parser_extras.rb:13: warning: already initialized constant ENC_UTF8
Mail is invalid

Actions #8

Updated by Ohad Levy over 11 years ago

  • Category deleted (Database)

I see... the email validation is failing.

I wonder if there is any reason why a domain name won't be one char.

Actions #9

Updated by Jasper Poppe over 11 years ago

Ohad Levy wrote:

I wonder if there is any reason why a domain name won't be one char.

There are currently no 1 character top level domains so it isn't valid as a public mail address (makes sense), but it is fine to have 1 character private domains.

Actions #10

Updated by Ohad Levy over 4 years ago

  • Description updated (diff)
  • Assignee deleted (Ohad Levy)
Actions #11

Updated by Tomer Brisker over 4 years ago

  • Status changed from New to Rejected

Foreman is dropping support for MySQL database - see https://community.theforeman.org/t/rfc-dropping-support-for-mysql/14185 for further details. Closing this issue.

Actions

Also available in: Atom PDF