pcs: switch to ruby 2.3, minor fixes
[unleashed-userland.git] / components / cluster / pcs / patches / 0006-Replace-orderedhash.patch
blobc7605dbc055769d579da5bc93140ac04236906ab
1 Description: Replace orderedhash gem with active_support
2 Gem orderedhash <https://rubygems.org/gems/orderedhash/>
3 has several problems:
4 * not packaged in Debian (so not used by some other software)
5 * does not look maintained (last version 0.0.6 is from 2008)
6 * no license file included (just one mention of public domain
7 in a source file)
9 On the other hand, replacement active_support gem is rather
10 popular (albeit somewhat big) and does not experience any of
11 these problems.
12 Author: Valentin Vidic <Valentin.Vidic@CARNet.hr>
13 Last-Update: 2017-06-17
14 ---
15 This patch header follows DEP-3: http://dep.debian.net/deps/dep3/
16 --- a/pcsd/config.rb
17 +++ b/pcsd/config.rb
18 @@ -1,5 +1,5 @@
19 require 'json'
20 -require 'orderedhash'
21 +require 'active_support/ordered_hash'
23 require 'cluster.rb'
24 require 'permissions.rb'
25 @@ -124,15 +124,15 @@
26 end
28 def text()
29 - out_hash = OrderedHash.new
30 + out_hash = ActiveSupport::OrderedHash.new
31 out_hash['format_version'] = CURRENT_FORMAT
32 out_hash['data_version'] = @data_version
33 out_hash['clusters'] = []
34 - out_hash['permissions'] = OrderedHash.new
35 + out_hash['permissions'] = ActiveSupport::OrderedHash.new
36 out_hash['permissions']['local_cluster'] = []
38 @clusters.each { |c|
39 - c_hash = OrderedHash.new
40 + c_hash = ActiveSupport::OrderedHash.new
41 c_hash['name'] = c.name
42 c_hash['nodes'] = c.nodes.uniq.sort
43 out_hash['clusters'] << c_hash
44 @@ -226,10 +226,10 @@
45 end
47 def text()
48 - tokens_hash = OrderedHash.new
49 + tokens_hash = ActiveSupport::OrderedHash.new
50 @tokens.keys.sort.each { |key| tokens_hash[key] = @tokens[key] }
52 - out_hash = OrderedHash.new
53 + out_hash = ActiveSupport::OrderedHash.new
54 out_hash['format_version'] = CURRENT_FORMAT
55 out_hash['data_version'] = @data_version
56 out_hash['tokens'] = tokens_hash
57 --- a/pcsd/pcsd-cli.rb
58 +++ b/pcsd/pcsd-cli.rb
59 @@ -4,14 +4,14 @@
60 require 'etc'
61 require 'json'
62 require 'stringio'
63 -require 'orderedhash'
64 +require 'active_support/ordered_hash'
66 require 'bootstrap.rb'
67 require 'pcs.rb'
68 require 'auth.rb'
70 def cli_format_response(status, text=nil, data=nil)
71 - response = OrderedHash.new
72 + response = ActiveSupport::OrderedHash.new
73 response['status'] = status
74 response['text'] = text if text
75 response['data'] = data if data
76 --- a/pcsd/permissions.rb
77 +++ b/pcsd/permissions.rb
78 @@ -1,4 +1,4 @@
79 -require 'orderedhash'
80 +require 'active_support/ordered_hash'
82 module Permissions
84 @@ -104,7 +104,7 @@
85 end
87 def to_hash()
88 - perm_hash = OrderedHash.new
89 + perm_hash = ActiveSupport::OrderedHash.new
90 perm_hash['type'] = @type
91 perm_hash['name'] = @name
92 perm_hash['allow'] = @allow_list.uniq.sort
93 --- a/pcsd/Gemfile
94 +++ b/pcsd/Gemfile
95 @@ -16,4 +16,4 @@
96 gem 'json'
97 gem 'multi_json'
98 gem 'open4'
99 -gem 'orderedhash'
100 +gem 'activesupport'