Bug 1255629 - Undercloud install fails due to "Duplicate declaration: Mysql_database"
Undercloud install fails due to "Duplicate declaration: Mysql_database"
Status: CLOSED NOTABUG
Product: Red Hat OpenStack
Classification: Red Hat
Component: instack-undercloud (Show other bugs)
7.0 (Kilo)
All Linux
medium Severity medium
: y2
: 7.0 (Kilo)
Assigned To: Emilien Macchi
yeylon@redhat.com
: Unconfirmed, ZStream
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2015-08-21 04:34 EDT by Jaison Raju
Modified: 2017-04-12 09:40 EDT (History)
10 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2015-10-08 09:56:21 EDT
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)
install logs (200.43 KB, text/plain)
2015-08-21 04:34 EDT, Jaison Raju
no flags Details

  None (edit)
Description Jaison Raju 2015-08-21 04:34:45 EDT
Created attachment 1065480 [details]
install logs

Description of problem:
'openstack undercloud install' fails with following error .
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
ESC[1;31mWarning: Variable access via 'notification_email_to' is deprecated. Use '@notification_email_to' instead. template[/etc/puppet/modules/keepalived/templates/global_config.erb]:3
   (at /etc/puppet/modules/keepalived/templates/global_config.erb:3:in `block in result')ESC[0m
ESC[1;31mWarning: notify is a metaparam; this value will inherit to all contained resources in the keepalived::instance definitionESC[0m
ESC[1;31mError: Duplicate declaration: Mysql_database[172.16.23.2] is already declared in file /etc/puppet/modules/openstacklib/manifests/db/mysql.pp:57; cannot redeclare at /etc/puppet/modules/openstacklib/manifests/db/mysql.pp:57 on node rhospd7.sdiad.comESC[0m
ESC[1;31mError: Duplicate declaration: Mysql_database[172.16.23.2] is already declared in file /etc/puppet/modules/openstacklib/manifests/db/mysql.pp:57; cannot redeclare at /etc/puppet/modules/openstacklib/manifests/db/mysql.pp:57 on node rhospd7.sdiad.comESC[0m
+ rc=1
+ set -e
+ echo 'puppet apply exited with exit code 1'
puppet apply exited with exit code 1
+ '[' 1 '!=' 2 -a 1 '!=' 0 ']'
+ exit 1
[2015-08-20 15:45:46,536] (os-refresh-config) [ERROR] during configure phase. [Command '['dib-run-parts', '/usr/libexec/os-refresh-config/configure.d']' returned non-zero exit status 1]

[2015-08-20 15:45:46,536] (os-refresh-config) [ERROR] Aborting...
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/usr/lib/python2.7/site-packages/instack_undercloud/undercloud.py", line 526, in install
    _run_orc(instack_env)
  File "/usr/lib/python2.7/site-packages/instack_undercloud/undercloud.py", line 461, in _run_orc
    _run_live_command(args, instack_env, 'os-refresh-config')
  File "/usr/lib/python2.7/site-packages/instack_undercloud/undercloud.py", line 297, in _run_live_command
    raise RuntimeError('%s failed. See log for details.', name)
RuntimeError: ('%s failed. See log for details.', 'os-refresh-config')
ESC]0;stack@rhospd7:~^G[stack@rhospd7 ~]$ exit
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

Version-Release number of selected component (if applicable):
instack-0.0.7-1.el7ost.noarch                               Wed Aug 19 14:02:49 2015
instack-undercloud-2.1.2-23.el7ost.noarch                   Wed Aug 19 14:02:53 2015
openstack-tripleo-0.0.7-0.1.1664e566.el7ost.noarch          Wed Aug 19 14:02:38 2015
openstack-tripleo-common-0.0.1.dev6-1.git49b57eb.el7ost.noarch Wed Aug 19 14:02:47 2015
openstack-tripleo-heat-templates-0.8.6-46.el7ost.noarch     Wed Aug 19 14:02:32 2015
openstack-tripleo-image-elements-0.9.6-6.el7ost.noarch      Wed Aug 19 14:02:51 2015
openstack-tripleo-puppet-elements-0.0.1-4.el7ost.noarch     Wed Aug 19 14:02:33 2015
openstack-puppet-modules-2015.1.8-8.el7ost.noarch           Thu Aug 20 14:15:16 2015
openstack-tripleo-puppet-elements-0.0.1-4.el7ost.noarch     Wed Aug 19 14:02:33 2015


How reproducible:
No

Steps to Reproduce:
1.
2.
3.

Actual results:
'openstack undercloud install' fails due to "Duplicate declaration: Mysql_database[172.16.23.2] is already declared in file /etc/puppet/modules/openstacklib/manifests/db/mysql.pp:57; cannot redeclare at /etc/puppet/modules/openstacklib/manifests/db/mysql.pp:57 on node rhospd7.sdiad.comESC[0m"

Expected results:
undercloud install succeeds .

Additional info:
PFA install log .
Comment 4 Emilien Macchi 2015-08-26 12:39:34 EDT
Mysql_database[172.16.23.2] should not happen, but it should be Mysql_database[keystone] or Mysql_database[database-name]. Definitely not an IP.

It's maybe a parameter issue here? Can you share your configuration?
Comment 6 Dave Maley 2015-09-02 17:07:43 EDT
Emilien - Anything of interest from the undercloud config provided?  If not what should our next steps be here?  Thanks!
Comment 7 Emilien Macchi 2015-09-08 09:46:48 EDT
So looking at what's happening here:

you're having this issue:
Mysql_database[172.16.23.2] is already declared in file /etc/puppet/modules/openstacklib/manifests/db/mysql.pp:57; cannot redeclare at /etc/puppet/modules/openstacklib/manifests/db/mysql.pp:57 on node (...)

It happens in Puppet when you have duplicated resources that is declared in the manifest. But here, the problem is also the resource name. It should not be an IP address but a database name (for example, 'keystone').

The code that manages Databases is here:
https://github.com/rdo-management/instack-undercloud/blob/33683f86c5fe256db794e18b6dc5f9bc6cbaf61f/elements/puppet-stack-config/puppet-stack-config.pp#L31-L89

It looks like one of 'dbname' parameters is wrong, and set to an IP.
'dbname' is taken from "::db::database_connection" or "::database_connection" in the Hiera environment.

So my only assumption here is an wrong parameter in our hieradata / yaml configuration for undercloud. Please provide it and we will continue to debug it.
Comment 8 James Slagle 2015-09-08 09:48:00 EDT
the hieradata file we need to see is at /etc/puppet/hieradata/puppet-stack-config.yaml on the undercloud. can you please attach that here?
Comment 9 Emilien Macchi 2015-09-28 09:25:19 EDT
Jaison, we would be happy to help. Could you provide James's request?

Thanks
Comment 11 not real 2016-07-12 10:10:03 EDT
I ran into this as well and found out what causes it.

TL;DR;: don't use the characters @:/? in your passwords (e.g. from undercloud.conf).

The puppet code splits the mysql connection string at the characters @:/?

Then it makes assumptions about user, password, dbname and so on at certain indices of the resulting array.

Now, if you used a password in the undercloud.conf which contains one of these split characters mentioned above, the assumptions of the puppet script fail and it all goes haywire.

Someone should add a validation to tell the user he chose an invalid password.
Comment 12 Alan Pevec 2016-07-12 18:34:12 EDT
comment 11 is a good sugestion, is there tripleo upstream LP bug to add such validation?

Note You need to log in before you can comment on or make changes to this bug.