direct_networks function is written in a very wrong way

Bug #1440028 reported by Aleksandr Didenko
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Fuel for OpenStack
Fix Committed
High
Aleksandr Didenko
6.1.x
Fix Committed
High
Aleksandr Didenko

Bug Description

deployment/puppet/osnailyfacter/lib/puppet/parser/functions/direct_networks.rb
this function directly operates with Hiera which is extremely bad approach. Besides that it breaks rspec tests badly. It should be rewritten to not call Hiera directly and work with a hash which is passed as parameter.

Tags: library
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to fuel-library (master)

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

Changed in fuel:
status: New → In Progress
Revision history for this message
Aleksandr Didenko (adidenko) wrote :

The fix I proposed passes rspec just fine, example:

cluster-haproxy/cluster-haproxy.pp
  on Ubuntu platforms
    behaves like puppet catalogue
      should compile into a catalogue without dependency cycles
      should delcare cluster::haproxy with other_networks set to 10.108.0.0/24 10.108.4.0/24 10.108.2.0/24 10.108.1.0/24
  on CentOS platforms
    behaves like puppet catalogue
      should compile into a catalogue without dependency cycles
      should delcare cluster::haproxy with other_networks set to 10.108.0.0/24 10.108.4.0/24 10.108.2.0/24 10.108.1.0/24

Revision history for this message
Aleksandr Didenko (adidenko) wrote :

Test on env:

cat > test.pp << EOF
\$network_scheme = hiera('network_scheme', {})
echo(direct_networks(\$network_scheme['endpoints']))
EOF

puppet apply test.pp

Result:
2015/04/03 12:26:39.127: (String) "10.109.0.0/24 10.109.4.0/24 10.109.2.0/24 10.109.1.0/24"
Notice: Compiled catalog for node-1.test.domain.local in environment production in 0.09 seconds
Notice: Finished catalog run in 1.01 seconds

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to fuel-library (master)

Reviewed: https://review.openstack.org/170443
Committed: https://git.openstack.org/cgit/stackforge/fuel-library/commit/?id=908e497c7e6c59964600c621234d0c87289108f9
Submitter: Jenkins
Branch: master

commit 908e497c7e6c59964600c621234d0c87289108f9
Author: Aleksandr Didenko <email address hidden>
Date: Fri Apr 3 14:51:55 2015 +0300

    Refactor direct_networks to not call Hiera directly

    This function simply forms a list of networks according to our
    network_scheme. We can pass $network_scheme['endpoints'] hash
    as a parameter to this function instead of calling Hiera directly
    from it.

    Change-Id: Ic940ee20f49ed8c741f5bda452f1007a914a0707
    Closes-bug: #1440028

Changed in fuel:
status: In Progress → Fix Committed
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.