From 852d753b4ccb97e01a995a11f714eb39d19596d4 Mon Sep 17 00:00:00 2001 From: Takashi Kajinami Date: Tue, 30 Mar 2021 15:47:01 +0900 Subject: [PATCH] Remove the unused list_to_zookeeper_hash function The list_to_zookeeper_hash function is not used by any class, thus can be removed completely. Change-Id: I5a1253a30cfdd5c0f5517785d4464bcc525f8577 --- .../functions/list_to_zookeeper_hash.rb | 24 ------------------- spec/functions/list_to_zookeeper_hash_spec.rb | 15 ------------ 2 files changed, 39 deletions(-) delete mode 100644 lib/puppet/functions/list_to_zookeeper_hash.rb delete mode 100644 spec/functions/list_to_zookeeper_hash_spec.rb diff --git a/lib/puppet/functions/list_to_zookeeper_hash.rb b/lib/puppet/functions/list_to_zookeeper_hash.rb deleted file mode 100644 index f8d123215..000000000 --- a/lib/puppet/functions/list_to_zookeeper_hash.rb +++ /dev/null @@ -1,24 +0,0 @@ -# Custom function to convert a list of ips to a map -# like {'ip' => xxx.xxx.xxx.xxx }. This function is needed -# because a not-so-good design of the puppet-midonet module -# and we hope to deprecate it soon. - -Puppet::Functions.create_function(:list_to_zookeeper_hash) do - dispatch :list_to_zookeeper_hash do - param 'Variant[Array, String]', :zk_list - end - - def list_to_zookeeper_hash(zk_list) - if zk_list.class != Array - zk_list = [zk_list] - end - result = Array.new - zk_list.each do |zk_ip| - zk_map = Hash.new - zk_map['ip'] = zk_ip - zk_map['port'] = 2181 - result.push(zk_map) - end - return result - end -end diff --git a/spec/functions/list_to_zookeeper_hash_spec.rb b/spec/functions/list_to_zookeeper_hash_spec.rb deleted file mode 100644 index 15a7d9123..000000000 --- a/spec/functions/list_to_zookeeper_hash_spec.rb +++ /dev/null @@ -1,15 +0,0 @@ -require 'spec_helper' - -describe 'list_to_zookeeper_hash' do - it { - should run.with_params('127.0.0.1').and_return([ - { 'ip' => '127.0.0.1', 'port' => 2181 } - ]) - } - it { - should run.with_params(['127.0.0.1', '127.0.0.2']).and_return([ - { 'ip' => '127.0.0.1', 'port' => 2181 }, - { 'ip' => '127.0.0.2', 'port' => 2181 } - ]) - } -end