ifconfig output parsing should be removed entirely from all charms

Bug #852311 reported by Patrick Hetu
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
nova-cloud-controller (Juju Charms Collection)
Fix Released
Medium
Adam Gandelman
rabbitmq-server (Juju Charms Collection)
Fix Released
Medium
Unassigned
swift-proxy (Juju Charms Collection)
Fix Released
Medium
Unassigned
swift-storage (Juju Charms Collection)
Fix Released
Medium
Unassigned

Bug Description

In charm like mediawiki, munin, mysql, postgresql, rabbitmq-server the IP address is grab with this command:

relation-set ip=`ifconfig | grep 'inet addr:'| grep -v '127.0.0.1' | cut -d: -f2 | awk '{ print $1}'|head -n 1`

It would be safer to force the C locale with the LANG=C prefix

Revision history for this message
Clint Byrum (clint-fewbar) wrote : Re: [Bug 852311] [NEW] non-english locale prevent good ifconfig output parsing

Excerpts from Patrick Hetu's message of Sat Sep 17 01:42:11 UTC 2011:
> Public bug reported:
>
> In charm like mediawiki, munin, mysql, postgresql, rabbitmq-server the
> IP address is grab with this command:
>
> relation-set ip=`ifconfig | grep 'inet addr:'| grep -v '127.0.0.1' |
> cut -d: -f2 | awk '{ print $1}'|head -n 1`
>
> It would be safer to force the C locale with the LANG=C prefix

Patrick, thanks for the bug report. Agreed that this whole set of code
is entirely too inflexible for long term use.

In fact, we're planning to get rid of that type of interaction entirely,
in favor of having the hostname embedded in the relations all the
time. The IP works for single-zone/region/cloud setups, but eventually
we'll want to be able to relate things across clouds, so doing things
like this inside charms will make said charms impossible to use for
that purpose.

Changed in charm:
status: New → Confirmed
importance: Undecided → Medium
Revision history for this message
Clint Byrum (clint-fewbar) wrote : Re: non-english locale prevent good ifconfig output parsing

Assigining to the individual charms that still carry this old paradigm. I'm exempting the 'munin' relations since we'll be dropping those as soon as colocated charms arrives.

affects: charm → rabbitmq-server (juju Charms Collection)
Revision history for this message
Clint Byrum (clint-fewbar) wrote :

Should always use 'unit-get private-address' instead.

Changed in nova-cloud-controller (juju Charms Collection):
status: New → Triaged
Changed in swift-proxy (juju Charms Collection):
status: New → Triaged
Changed in swift-storage (juju Charms Collection):
status: New → Triaged
Changed in nova-cloud-controller (juju Charms Collection):
importance: Undecided → Medium
Changed in swift-proxy (juju Charms Collection):
importance: Undecided → Medium
Changed in swift-storage (juju Charms Collection):
importance: Undecided → Medium
Changed in nova-cloud-controller (juju Charms Collection):
assignee: nobody → Adam Gandelman (gandelman-a)
summary: - non-english locale prevent good ifconfig output parsing
+ ifconfig output parsing should be removed entirely from all charms
Changed in nova-cloud-controller (juju Charms Collection):
status: Triaged → Fix Released
Changed in rabbitmq-server (juju Charms Collection):
status: Confirmed → Fix Released
Changed in swift-proxy (juju Charms Collection):
status: Triaged → Fix Released
Changed in swift-storage (juju Charms Collection):
status: Triaged → Fix Released
Revision history for this message
Clint Byrum (clint-fewbar) wrote :

Nice work Adam, thanks!

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.