Skip to content

RT_System user not created on an initial installation of new instance #2

@hesco

Description

@hesco

I am wondering if I am missing anything here. A recursive grep on the modules/rt/ path found no mention of the RT_System user. This is how I am deploying a new installation of RT:

class ymd_rt {

  class { 'apache': }
  class { 'apache::mod::fcgid': }
  class { 'rt': dbtype => 'postgres', apt_backports => true }

  $psql = '/usr/bin/psql'
  $schema = '/usr/share/request-tracker4/etc/schema.Pg'
  $db_engine = hiera( 'ymd_rt::db_engine' )
  $db_host = hiera( 'ymd_rt::db_host' )
  $db_port = hiera( 'ymd_rt::db_port' )
  $db_name = hiera( 'ymd_rt::db_name' )
  $db_user = hiera( 'ymd_rt::db_user' )
  $db_pw = hiera( 'ymd_rt::db_pw' )
  $web_path = hiera( 'ymd_rt::web_path' )
  $rt_name = hiera( 'ymd_rt::rt_name' )
  $organization = hiera( 'ymd_rt::organization' )
  $web_baseurl = hiera( 'ymd_rt::web_baseurl' )
  $correspond_address = hiera( 'ymd_rt::correspond_address' )
  $comment_address = hiera( 'ymd_rt::comment_address' )

  file { '/etc/request-tracker4/RT_SiteConfig.pm.configured':
    content => template('ymd_rt/etc/request-tracker4/RT_SiteConfig.pm.erb'),
    notify  => Service['rt'],
  }

  file { '/etc/request-tracker4/.pgpass':
    content => "$db_host:$db_port:$db_name:$db_user:$db_pw",
    mode    => '0600',
    owner   => 'root',
    group   => 'root',
  }

  exec { 'deploy_RT_SiteConfig.pm':
    command => '/bin/cp /etc/request-tracker4/RT_SiteConfig.pm.configured /etc/request-tracker4/RT_SiteConfig.pm',
    require => File['/etc/request-tracker4/RT_SiteConfig.pm.configured'],
  }

  exec { 'enable_rt_in_apache.conf':
    command => "/bin/echo 'Include /etc/request-tracker4/apache2-fcgid.conf' >> /etc/apache2/apache2.conf",
    unless  => "/bin/grep -q '^Include /etc/request-tracker4/apache2-fcgid.conf$' /etc/apache2/apache2.conf",
    require => [ File['/etc/request-tracker4/RT_SiteConfig.pm'],
               # Exec['configure_RT_SiteConfig'],
                 File['/etc/apache2/apache2.conf'] ],
    notify  => [ Service['rt'] ],
  }

  $sample_sql = "SELECT * FROM users WHERE id = 0;"
  exec { 'deploy_db_schema':
    environment => 'PGPASSFILE=/etc/request-tracker4/.pgpass',
    command     => "$psql -U $db_user -h $db_host -d $db_name -f $schema",
    unless      => "$psql -U $db_user -h $db_host -d $db_name -c $sample_sql",
    require     => File['/etc/request-tracker4/.pgpass'],
  }

  exec { 'disable_default_apache_site':
    path    => '/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin',
    command => 'for site in `/bin/ls /etc/apache2/sites-enabled/` ; do /usr/sbin/a2dissite $site ; done && /usr/sbin/service apache2 reload',
    unless  => '/usr/bin/test `/bin/ls /etc/apache2/sites-enabled/ | /usr/bin/wc -l` -eq 0',
  }

  service { 'rt':
     ensure => 'running',
       name => 'request-tracker4',
    require => [ Exec['enable_rt_in_apache.conf'],
                 Exec['disable_default_apache_site'] ],
  }

}

The code in the RT::Handle->CheckIntegrity() method which throws this error looks like this:

    require RT::CurrentUser;
    my $test_user = RT::CurrentUser->new;
    $test_user->Load('RT_System');
    unless ( $test_user->id ) {
        return (0, 'no system user', "Couldn't find RT_System user in the DB '". $self->DSN ."'");
    }

Investigating a working installation, I see:

ymd_rt=# SELECT id, name, password, comments, realname, 
creator, created, lastupdatedby, lastupdated 
FROM users WHERE name LIKE '%RT_System%'; 

-[ RECORD 1 ]-+---------------------------------------------------------------------------------------
id            | 1
name          | RT_System
password      | *NO-PASSWORD*
comments      | Do not delete or modify this user. It is integral to RT's internal database structures
realname      | The RT System itself
creator       | 1
created       | 2009-06-14 18:32:56
lastupdatedby | 1
lastupdated   | 2009-06-14 18:32:56

ymd_rt=#

Below are the errors I see in the apache error.log.

[Sat Oct 31 17:28:05.428020 2015] [autoindex:error] [pid 15223:tid 140318097164032] [client 127.0.0.1:34240] AH01276: Cannot serve directory /var/www/: No matching Direc
toryIndex (index.html,index.html.var,index.cgi,index.pl,index.php,index.xhtml) found, and server-generated directory index forbidden by Options directive  
[16528] [Sat Oct 31 22:28:14 2015] [warning]: Use of uninitialized value in concatenation (.) or string at /usr/share/request-tracker4/lib/RT/Handle.pm line 240. (/usr/s
hare/request-tracker4/lib/RT/Handle.pm:239)  

RT couldn't connect to the database where tickets are stored.  
If this is a new installation of RT, you should visit the URL below
to configure RT and initialize your database.

If this is an existing RT installation, this may indicate a database
connectivity problem.

The error RT got back when trying to connect to your database was:

Couldn't find RT_System user in the DB ''

[16528] [Sat Oct 31 22:28:14 2015] [warning]: Use of uninitialized value in concatenation (.) or string at /usr/share/request-tracker4/lib/RT/Handle.pm line 240. (/usr/s
hare/request-tracker4/lib/RT/Handle.pm:239)
HTTP::Server::PSGI: Accepting connections at http://0:8080/

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions