maas-deployer fails on unknown locale

Bug #1493765 reported by Jonathan Davies
30
This bug affects 5 people
Affects Status Importance Assigned to Milestone
maas-deployer
Confirmed
Medium
Edward Hope-Morley

Bug Description

maas-deployer fails when it doesn't know about my locale:

$ ./cli.py -c ~/maas-automated-deployment/deployment.yaml --force
2015-09-09 09:20:21,514 INFO Deleting domain 'juju-test' before define since force=True
2015-09-09 09:20:21,549 INFO Deleting volume 'juju-test.img' before create since force=True
2015-09-09 09:20:22,800 WARNING No MAAS cluster nodes provided
2015-09-09 09:20:22,845 INFO Deleting domain 'maas-test' before create since force=True
2015-09-09 09:20:22,890 INFO Downloading https://cloud-images.ubuntu.com/trusty/current/trusty-server-cloudimg-amd64-disk1.img
2015-09-09 09:20:50,308 INFO Deleting volume 'maas-test-root.img' before create since force=True
2015-09-09 09:20:58,331 INFO Seed volume 'maas-test-seed.img' already exists
2015-09-09 09:20:58,331 INFO Deleting volume 'maas-test-seed.img' before create since force=True
2015-09-09 09:20:59,651 INFO ip_address was not specified in maas section of deployment yaml file.
Enter the IP address for the MAAS controller: aa.bb.cc.dd
2015-09-09 09:21:20,742 INFO Waiting for cloud-init to complete - this usually takes several minutes
2015-09-09 09:25:20,069 INFO done.
bash: warning: setlocale: LC_ALL: cannot change locale (en_GB.UTF-8)
Traceback (most recent call last):
  File "/usr/lib/python2.7/runpy.py", line 162, in _run_module_as_main
    "__main__", fname, loader, pkg_name)
  File "/usr/lib/python2.7/runpy.py", line 72, in _run_code
    exec code in run_globals
  File "/usr/lib/python2.7/dist-packages/maascli/__main__.py", line 20, in <module>
    main()
  File "/usr/lib/python2.7/dist-packages/maascli/__init__.py", line 29, in main
    locale.setlocale(locale.LC_ALL, "")
  File "/usr/lib/python2.7/locale.py", line 579, in setlocale
    return _setlocale(category, locale)
locale.Error: unsupported locale setting

Traceback (most recent call last):
  File "./cli.py", line 99, in <module>
    main()
  File "./cli.py", line 88, in main
    engine.deploy(target)
  File "/usr/lib/python2.7/dist-packages/maas_deployer/vmaas/engine.py", line 72, in deploy
    ssh_user=maas_config['user'])
  File "/usr/lib/python2.7/dist-packages/maas_deployer/vmaas/maasclient/__init__.py", line 29, in __init__
    self.driver = self._get_driver(api_url, api_key, **kwargs)
  File "/usr/lib/python2.7/dist-packages/maas_deployer/vmaas/maasclient/__init__.py", line 33, in _get_driver
    return SSHDriver(api_url, api_key, ssh_user=kwargs['ssh_user'])
  File "/usr/lib/python2.7/dist-packages/maas_deployer/vmaas/maasclient/clidriver.py", line 321, in __init__
    self._login(api_url, api_key)
  File "/usr/lib/python2.7/dist-packages/maas_deployer/vmaas/maasclient/clidriver.py", line 330, in _login
    execc(cmd)
  File "/usr/lib/python2.7/dist-packages/maas_deployer/vmaas/util.py", line 89, in execc
    output=stderr)
subprocess.CalledProcessError: Command 'ssh -i /home/test/.ssh/id_maas -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -o LogLevel=quiet <email address hidden> maas login maas http://10.230.123.101/MAAS/api/1.0 ...' returned non-zero exit status 1

Related branches

Revision history for this message
Edward Hope-Morley (hopem) wrote :

Sound like we can fix this with by setting env LC_ALL=C. The ssh connection will use whatever is set on the client side so this should cover all bases.

Changed in maas-deployer:
milestone: none → 0.0.3
importance: Undecided → Medium
status: New → In Progress
assignee: nobody → Edward Hope-Morley (hopem)
Changed in maas-deployer:
status: In Progress → Fix Committed
Changed in maas-deployer:
status: Fix Committed → Fix Released
Revision history for this message
Jonathan Davies (jpds) wrote :

Just tried /next and got the same error again.

Changed in maas-deployer:
status: Fix Released → Confirmed
status: Confirmed → Fix Released
Revision history for this message
Jonathan Davies (jpds) wrote :

Apparently, there's a 'maas-deployer' package on this system.

Revision history for this message
Jonathan Davies (jpds) wrote :

Nope, still have this bug:

2015-09-15 13:09:17,233 INFO Waiting for cloud-init to complete - this usually takes several minutes
2015-09-15 13:12:58,114 INFO done.
2015-09-15 13:13:00,146 ERROR bash: warning: setlocale: LC_ALL: cannot change locale (en_GB.UTF-8)
Traceback (most recent call last):
  File "/usr/lib/python2.7/runpy.py", line 162, in _run_module_as_main
    "__main__", fname, loader, pkg_name)
  File "/usr/lib/python2.7/runpy.py", line 72, in _run_code
    exec code in run_globals
  File "/usr/lib/python2.7/dist-packages/maascli/__main__.py", line 20, in <module>
    main()
  File "/usr/lib/python2.7/dist-packages/maascli/__init__.py", line 29, in main
    locale.setlocale(locale.LC_ALL, "")
  File "/usr/lib/python2.7/locale.py", line 579, in setlocale
    return _setlocale(category, locale)
locale.Error: unsupported locale setting

bash: warning: setlocale: LC_ALL: cannot change locale (en_GB.UTF-8)
Traceback (most recent call last):
  File "/usr/lib/python2.7/runpy.py", line 162, in _run_module_as_main
    "__main__", fname, loader, pkg_name)
  File "/usr/lib/python2.7/runpy.py", line 72, in _run_code
    exec code in run_globals
  File "/usr/lib/python2.7/dist-packages/maascli/__main__.py", line 20, in <module>
    main()
  File "/usr/lib/python2.7/dist-packages/maascli/__init__.py", line 29, in main
    locale.setlocale(locale.LC_ALL, "")
  File "/usr/lib/python2.7/locale.py", line 579, in setlocale
    return _setlocale(category, locale)
locale.Error: unsupported locale setting

Traceback (most recent call last):
  File "./maas_deployer/cli.py", line 100, in <module>
    main()
  File "./maas_deployer/cli.py", line 89, in main
    engine.deploy(target)
  File "./maas_deployer/vmaas/engine.py", line 67, in deploy
    ssh_user=maas_config['user'])
  File "./maas_deployer/vmaas/maasclient/__init__.py", line 29, in __init__
    self.driver = self._get_driver(api_url, api_key, **kwargs)
  File "./maas_deployer/vmaas/maasclient/__init__.py", line 33, in _get_driver
    return SSHDriver(api_url, api_key, ssh_user=kwargs['ssh_user'])
  File "./maas_deployer/vmaas/maasclient/clidriver.py", line 330, in __init__
    self._login(api_url, api_key)
  File "./maas_deployer/vmaas/maasclient/clidriver.py", line 347, in _login
    execc(cmd, stdin=self.cmd_stdin)
  File "./maas_deployer/vmaas/util.py", line 111, in execc
    output=stderr)
subprocess.CalledProcessError: Command 'ssh -i /home/jpds/.ssh/id_maas -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -o LogLevel=quiet <email address hidden> maas login maas http://aa.bb.cc.dd/MAAS/api/1.0 <snip>' returned non-zero exit status 1

Changed in maas-deployer:
status: Fix Released → Confirmed
Revision history for this message
Edward Hope-Morley (hopem) wrote :

Seems we forgot to set LC_ALL=C logging into Maas.

Changed in maas-deployer:
milestone: 0.0.3 → 0.0.4
Changed in maas-deployer:
milestone: 0.0.4 → none
Revision history for this message
Ray Wang (raywang) wrote :

I think set "C" instead of "" could also work,

e.g.

locale.setlocale(locale.LC_ALL, "C")

Revision history for this message
Ray Wang (raywang) wrote :

Sorry
locale.setlocale(locale.LC_ALL, "C") doesn't help, please ignore my last comment

Revision history for this message
Ray Wang (raywang) wrote :

So the problem is:

I guess masa-deployer will detect the timezone, and set the locale to corresponding locale. For example, I'm in CST timezone, in MAAS VM, the locales are set to 'zh_CN.UTF-8', HOWEVER, the 'language-pack-sh-hans' is not installed, which results in this error.

I bet the workaround for now could be either

1. set the locale to 'en_US.UTF-8', or 'C'

or

2. install the related package to the locale

Revision history for this message
Ray Wang (raywang) wrote :

I think this bug can be set to critical, as the installation process is stopped due to this one.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Duplicates of this bug

Other bug subscribers

Remote bug watches

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