glance-replicator commands fail due to incorrect regex check

Bug #1216247 reported by Rohit Karajgi
20
This bug affects 4 people
Affects Status Importance Assigned to Milestone
Glance
Fix Released
Undecided
Brian Cline

Bug Description

When I pass correct parameters to the glance-replicator tool I get the following output:

ERROR: Bad format of the given arguments.
rohit@precise-dev-102:~/devstack$ glance-replicator compare 10.2.3.1:9292 10.2.3.2:9292
replication_compare compare <fromserver:port> <toserver:port>

    Compare the contents of fromserver with those of toserver.

    fromserver:port: the location of the master glance instance.
    toserver:port: the location of the slave glance instance.

ERROR: Bad format of the given arguments.

This is due to an incorrect regular expression used int he code to match the input parameters.
The same regex is used by all the replicator functions to verify the parameters:
https://github.com/openstack/glance/blob/master/glance/cmd/replicator.py#L58

SERVER_PORT_REGEX = '\w+:\w+'

The character class \w = [a-zA-Z0-9_]. So if we pass an IP Address or an FQDN having characters outside the set, this check will fail.

The regex should be corrected for glance-replicator to work correctly.

Tags: ntt
Rohit Karajgi (rohitk)
Changed in glance:
assignee: nobody → Rohit Karajgi (rohitkarajgi)
Revision history for this message
Matteo Panella (mpanella) wrote :

A saner regexp would be r'[-a-zA-Z0-9.]+:\d+'

Brian Cline (briancline)
Changed in glance:
status: New → Confirmed
assignee: Rohit Karajgi (rohitk) → Brian Cline (briancline)
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to glance (master)

Fix proposed to branch: master
Review: https://review.openstack.org/59559

Changed in glance:
status: Confirmed → In Progress
Revision history for this message
Matt Fischer (mfisch) wrote :

Unmarking in-progress since this is abandoned. Can someone please set the priority on this?

Changed in glance:
status: In Progress → Confirmed
assignee: Brian Cline (briancline) → nobody
Revision history for this message
Brian Cline (briancline) wrote :

Whoops, the abandoned state of the gerrit patchset slipped under my radar. I've got a working patchset for this that's being rebased against current master, will push it to the existing gerrit review today.

Changed in glance:
assignee: nobody → Brian Cline (briancline)
status: Confirmed → In Progress
Revision history for this message
Matt Fischer (mfisch) wrote :

Brian,

Do you have a new patchset available?

Revision history for this message
Brian Cline (briancline) wrote :

https://review.openstack.org/59559 has been updated with a revised patchset.

Revision history for this message
Brian Cline (briancline) wrote :

Matt, patchset is at the above link - let me know if there's anything I can do to help move this along.

Revision history for this message
Openstack Gerrit (openstack-gerrit) wrote : Fix merged to glance (master)

Reviewed: https://review.openstack.org/59559
Committed: https://git.openstack.org/cgit/openstack/glance/commit/?id=ba1f41d89d38286f769cfdf40b337fe5c7dad578
Submitter: Jenkins
Branch: master

commit ba1f41d89d38286f769cfdf40b337fe5c7dad578
Author: Brian Cline <email address hidden>
Date: Fri Apr 11 03:27:42 2014 -0500

    Fixes "bad format" in replicator for valid hosts

    Due to a bad regex, the glance-replicator tool rejects any source or
    target host:port combination that contains a period. As a result, only
    hostnames without periods can be used.

    This fix expands the host/port checks to:
      - allow periods in hostnames
      - allow and verify IPv6 addr/port pairs (i.e., [fe80::f00d:face]:1234)
      - allow and verify IPv4 addr/port pairs (i.e., 172.17.17.2:1234)
      - sanity-check port numbers

    This also includes extensive tests for each component of the parsing,
    and adds network_utils to openstack-common.conf.

    Change-Id: I94fdd7a57a4cb0aa5d79f66d68be159d1f1266d1
    Closes-Bug: #1216247

Changed in glance:
status: In Progress → Fix Committed
Thierry Carrez (ttx)
Changed in glance:
milestone: none → juno-1
status: Fix Committed → Fix Released
Thierry Carrez (ttx)
Changed in glance:
milestone: juno-1 → 2014.2
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.