In bootstrap mode /usr/bin/provision depends on locale

Bug #1440086 reported by Gleb
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Fuel for OpenStack
Fix Released
High
Kamil Sambor

Bug Description

{
    "build_id": "2014-12-26_14-25-46",
    "ostf_sha": "a9afb68710d809570460c29d6c3293219d3624d4",
    "build_number": "58",
    "auth_required": true,
    "api": "1.0",
    "nailgun_sha": "5f91157daa6798ff522ca9f6d34e7e135f150a90",
    "production": "docker",
    "fuelmain_sha": "81d38d6f2903b5a8b4bee79ca45a54b76c1361b8",
    "astute_sha": "16b252d93be6aaa73030b8100cf8c5ca6a970a91",
    "feature_groups": [
        "mirantis",
        "experimental"
    ],
    "release": "6.0",
    "release_versions": {
        "2014.2-6.0": {
            "VERSION": {
                "build_id": "2014-12-26_14-25-46",
                "ostf_sha": "a9afb68710d809570460c29d6c3293219d3624d4",
                "build_number": "58",
                "api": "1.0",
                "nailgun_sha": "5f91157daa6798ff522ca9f6d34e7e135f150a90",
                "production": "docker",
                "fuelmain_sha": "81d38d6f2903b5a8b4bee79ca45a54b76c1361b8",
                "astute_sha": "16b252d93be6aaa73030b8100cf8c5ca6a970a91",
                "feature_groups": [
                    "mirantis"
                ],
                "release": "6.0",
                "fuellib_sha": "fde8ba5e11a1acaf819d402c645c731af450aff0"
            }
        }
    },
    "fuellib_sha": "fde8ba5e11a1acaf819d402c645c731af450aff0"
}

/usr/bin/provision failed because of locale en_US.UTF-8

2015-04-03 14:06:41.678 11311 DEBUG fuel_agent.utils.utils [-] Trying to execute command: lvdisplay -C --noheading --units m --options lv_name,lv_size,vg_name,lv_uuid --separator ;
2015-04-03 14:06:41.686 11311 CRITICAL fuel-agent [-] ValueError: invalid literal for float(): 51200,00
2015-04-03 14:06:41.686 11311 TRACE fuel-agent Traceback (most recent call last):
2015-04-03 14:06:41.686 11311 TRACE fuel-agent File "/usr/bin/provision", line 10, in <module>
2015-04-03 14:06:41.686 11311 TRACE fuel-agent sys.exit(provision())
2015-04-03 14:06:41.686 11311 TRACE fuel-agent File "/usr/lib/python2.6/site-packages/fuel_agent/cmd/agent.py", line 37, in provision
2015-04-03 14:06:41.686 11311 TRACE fuel-agent main(['do_provisioning'])
2015-04-03 14:06:41.686 11311 TRACE fuel-agent File "/usr/lib/python2.6/site-packages/fuel_agent/cmd/agent.py", line 67, in main
2015-04-03 14:06:41.686 11311 TRACE fuel-agent getattr(mgr, action)()
2015-04-03 14:06:41.686 11311 TRACE fuel-agent File "/usr/lib/python2.6/site-packages/fuel_agent/manager.py", line 318, in do_provisioning
2015-04-03 14:06:41.686 11311 TRACE fuel-agent self.do_partitioning()
2015-04-03 14:06:41.686 11311 TRACE fuel-agent File "/usr/lib/python2.6/site-packages/fuel_agent/manager.py", line 78, in do_partitioning
2015-04-03 14:06:41.686 11311 TRACE fuel-agent lu.lvremove_all()
2015-04-03 14:06:41.686 11311 TRACE fuel-agent File "/usr/lib/python2.6/site-packages/fuel_agent/utils/lvm_utils.py", line 227, in lvremove_all
2015-04-03 14:06:41.686 11311 TRACE fuel-agent for lv in lvdisplay():
2015-04-03 14:06:41.686 11311 TRACE fuel-agent File "/usr/lib/python2.6/site-packages/fuel_agent/utils/lvm_utils.py", line 176, in lvdisplay
2015-04-03 14:06:41.686 11311 TRACE fuel-agent return lvdisplay_parse(output)
2015-04-03 14:06:41.686 11311 TRACE fuel-agent File "/usr/lib/python2.6/site-packages/fuel_agent/utils/lvm_utils.py", line 188, in lvdisplay_parse
2015-04-03 14:06:41.686 11311 TRACE fuel-agent 'size': utils.parse_unit(lv_params[1], 'm'),
2015-04-03 14:06:41.686 11311 TRACE fuel-agent File "/usr/lib/python2.6/site-packages/fuel_agent/utils/utils.py", line 91, in parse_unit
2015-04-03 14:06:41.686 11311 TRACE fuel-agent flt = locale.atof(s.split(unit)[0])
2015-04-03 14:06:41.686 11311 TRACE fuel-agent File "/usr/lib64/python2.6/locale.py", line 292, in atof
2015-04-03 14:06:41.686 11311 TRACE fuel-agent return func(string)
2015-04-03 14:06:41.686 11311 TRACE fuel-agent ValueError: invalid literal for float(): 51200,00
2015-04-03 14:06:41.686 11311 TRACE fuel-agent

lvdisplay use commas instead of dots in locale en_US.UTF-8

[root@bootstrap ~]# lvdisplay -C --noheading --units m --options lv_name,lv_size,vg_name,lv_uuid --separator ';'
  root;1874344,00m;os;KMqeuS-BkvU-DuHK-PXw7-c0MZ-Hh4a-UoqqCh
  swap;32768,00m;os;l3DehF-Kudi-MlPK-VxEN-YuJQ-IFvW-lSg472

root@bootstrap ~]# export LC_ALL=C

[root@bootstrap ~]# lvdisplay -C --noheading --units m --options lv_name,lv_size,vg_name,lv_uuid --separator ';'
  root;1874344.00m;os;KMqeuS-BkvU-DuHK-PXw7-c0MZ-Hh4a-UoqqCh
  swap;32768.00m;os;l3DehF-Kudi-MlPK-VxEN-YuJQ-IFvW-lSg472

Changed in fuel:
importance: Undecided → High
assignee: nobody → Fuel provisioning team (fuel-provisioning)
Changed in fuel:
status: New → Confirmed
milestone: none → 6.1
tags: added: feature-image-based
Dmitry Pyzhov (dpyzhov)
Changed in fuel:
milestone: 6.1 → 7.0
milestone: 7.0 → 6.1
assignee: Fuel provisioning team (fuel-provisioning) → Vladimir Kozhukalov (kozhukalov)
Revision history for this message
Alexander Gordeev (a-gordeev) wrote :

I'd rather add something like

os.environ['LC_ALL'] = os.environ['LANG'] = os.environ['LANGUAGE'] = 'C'

right into utils.execute()

The reason is simple, there are few places where fuel-agent hardly relies on stdout/stderr messages and expects specific strings in those messages.

Bug is not only about fractial delimiter, but about locale.

Log messages could be localized, but the output of cli utils which fuel-agent executes shouldn't be localized at all.

So I think there's no reason to enforce locale enviroment variables for the whole fuel-agent execution at astute side.

Revision history for this message
Dmitry Pyzhov (dpyzhov) wrote :

we will try to include this Medium bug in 6.1

Changed in fuel:
importance: High → Medium
Revision history for this message
Nastya Urlapova (aurlapova) wrote :

Try it as High.

Changed in fuel:
importance: Medium → High
Kamil Sambor (ksambor)
Changed in fuel:
assignee: Vladimir Kozhukalov (kozhukalov) → Kamil Sambor (ksambor)
Kamil Sambor (ksambor)
Changed in fuel:
status: Confirmed → In Progress
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to fuel-web (master)

Reviewed: https://review.openstack.org/180897
Committed: https://git.openstack.org/cgit/stackforge/fuel-web/commit/?id=7f4ca1bd35a6efdbd302687034722429e81da133
Submitter: Jenkins
Branch: master

commit 7f4ca1bd35a6efdbd302687034722429e81da133
Author: Kamil Sambor <email address hidden>
Date: Thu May 7 09:31:43 2015 +0200

    Add language to env during executing command

    Change-Id: I8db9741b2e5636736cc8cc3844d78f4a4802c8c5
    Closes-Bug: #1440086

Changed in fuel:
status: In Progress → Fix Committed
Revision history for this message
Maksym Strukov (unbelll) wrote :

Verified as fixed in 6.1-469

Changed in fuel:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.