hive-runner 2.1.2 → 2.1.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (4) hide show
  1. checksums.yaml +4 -4
  2. data/lib/hive.rb +1 -6
  3. data/lib/macaddr.rb +103 -0
  4. metadata +3 -16
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: dd0c2fca702b7f737a3219facc7ec6b76fdc7f96
4
- data.tar.gz: 5ff8b54a89014cb4b75f2b6c415bbb0330b825c7
3
+ metadata.gz: 55e51a2e63a369604683a34ee74662fa61d40be6
4
+ data.tar.gz: c84a6365d382d09fd5b65455ab2e9ad1edd30f5d
5
5
  SHA512:
6
- metadata.gz: a69c0768dfa7deb80fe97d9c63f7021a789564c89cbc01514bc9cdeef12ea45d69f069b509014c20de82b2b0d913928264871b3c7852a128e602f037de365b61
7
- data.tar.gz: b57388c0378668580f1d8b31bc4e11fd99a9ca31049591c6645a4e83c7cb4bda2644ab924052cb98fa741afc7f948cb100745859d030583736232a2416f95fee
6
+ metadata.gz: 34826fc6647770fc07e2c1a5d54c87a6da1ced54dba570d0ba8ff446b6232e1005b9aa44efb6c50aa9b5b8d4b8345dd0f2b7c8b81b3319d041c848015d64c1e4
7
+ data.tar.gz: a76541f4f0b1d922c13e941875b53281fad16ef30f19458455ad3c8ad0a56fdb159bd495f684c2455917ab8b29bdc7c267bcd702749f3ea146c20417152cbea8
data/lib/hive.rb CHANGED
@@ -68,7 +68,7 @@ module Hive
68
68
  hostname: Hive.hostname,
69
69
  version: Gem::Specification.find_by_name('hive-runner').version.to_s,
70
70
  runner_plugins: Hash[Gem::Specification.all.select{ |g| g.name =~ /hive-runner-/ }.map { |p| [p.name, p.version.to_s] }],
71
- macs: [Hive.mac_address],
71
+ macs: Mac.addrs,
72
72
  ips: [Hive.ip_address],
73
73
  brand: Hive.config.brand? ? Hive.config.brand : 'BBC',
74
74
  model: Hive.config.model? ? Hive.config.model : 'Hive',
@@ -101,11 +101,6 @@ module Hive
101
101
  ip.ip_address
102
102
  end
103
103
 
104
- # Get the MAC address of the Hive
105
- def self.mac_address
106
- Mac.addr
107
- end
108
-
109
104
  # Get the hostname of the Hive
110
105
  def self.hostname
111
106
  Socket.gethostname.split('.').first
data/lib/macaddr.rb ADDED
@@ -0,0 +1,103 @@
1
+ # Copied on 26 May 2016 directly from https://github.com/tsilen/macaddr, which
2
+ # is a fork of the official source of the Gem at
3
+ # https://github.com/ahoward/macaddr but with a fix to get a full list of all
4
+ # MAC addresses.
5
+ # License is given as "same as ruby's" (sic).
6
+
7
+ ##
8
+ # Cross platform MAC address determination.
9
+ #
10
+ # To return the first MAC address on the system:
11
+ #
12
+ # Mac.address
13
+ #
14
+ # To return an array of all MAC addresses:
15
+ #
16
+ # Mac.addresses
17
+
18
+ begin
19
+ require 'rubygems'
20
+ rescue LoadError
21
+ nil
22
+ end
23
+
24
+ require 'socket'
25
+
26
+ module Mac
27
+ VERSION = '1.7.1'
28
+
29
+ def Mac.version
30
+ ::Mac::VERSION
31
+ end
32
+
33
+ def Mac.dependencies
34
+ {
35
+ }
36
+ end
37
+
38
+ def Mac.description
39
+ 'cross platform mac address determination for ruby'
40
+ end
41
+
42
+
43
+ class << self
44
+
45
+ ##
46
+ # Accessor for the system's first MAC address, requires a call to #address
47
+ # first
48
+
49
+ attr_accessor "mac_address"
50
+
51
+ ##
52
+ # Discovers and returns the system's MAC addresses. Returns the first
53
+ # MAC address, and includes an accessor #list for the remaining addresses:
54
+ #
55
+ # Mac.addr # => first address
56
+ # Mac.addrs # => all addresses
57
+
58
+ def address
59
+ @mac_address ||= addresses.first
60
+ end
61
+
62
+ def addresses
63
+ @mac_addresses ||= from_getifaddrs || []
64
+ end
65
+
66
+ link = Socket::PF_LINK if Socket.const_defined? :PF_LINK
67
+ packet = Socket::PF_PACKET if Socket.const_defined? :PF_PACKET
68
+ INTERFACE_PACKET_FAMILY = link || packet # :nodoc:
69
+
70
+ ##
71
+ # Shorter aliases for #address and #addresses
72
+
73
+ alias_method "addr", "address"
74
+ alias_method "addrs", "addresses"
75
+
76
+ private
77
+
78
+ def from_getifaddrs
79
+ return unless Socket.respond_to? :getifaddrs
80
+
81
+ interfaces = Socket.getifaddrs.select do |addr|
82
+ addr.addr && addr.addr.pfamily == INTERFACE_PACKET_FAMILY
83
+ end
84
+
85
+ if Socket.const_defined? :PF_LINK then
86
+ interfaces.map do |addr|
87
+ addr.addr.getnameinfo
88
+ end.flatten.select do |m|
89
+ !m.empty?
90
+ end
91
+ elsif Socket.const_defined? :PF_PACKET then
92
+ interfaces.map do |addr|
93
+ addr.addr.inspect_sockaddr[/hwaddr=([\h:]+)/, 1]
94
+ end.select do |mac_addr|
95
+ mac_addr != '00:00:00:00:00:00'
96
+ end
97
+ end
98
+ end
99
+
100
+ end
101
+ end
102
+
103
+ MacAddr = Macaddr = Mac
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: hive-runner
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.1.2
4
+ version: 2.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Joe Haig
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-05-17 00:00:00.000000000 Z
11
+ date: 2016-06-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: chamber
@@ -24,20 +24,6 @@ dependencies:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
26
  version: '2.7'
27
- - !ruby/object:Gem::Dependency
28
- name: macaddr
29
- requirement: !ruby/object:Gem::Requirement
30
- requirements:
31
- - - "~>"
32
- - !ruby/object:Gem::Version
33
- version: '1.7'
34
- type: :runtime
35
- prerelease: false
36
- version_requirements: !ruby/object:Gem::Requirement
37
- requirements:
38
- - - "~>"
39
- - !ruby/object:Gem::Version
40
- version: '1.7'
41
27
  - !ruby/object:Gem::Dependency
42
28
  name: activerecord
43
29
  requirement: !ruby/object:Gem::Requirement
@@ -276,6 +262,7 @@ files:
276
262
  - lib/hive/results.rb
277
263
  - lib/hive/worker.rb
278
264
  - lib/hive/worker/shell.rb
265
+ - lib/macaddr.rb
279
266
  - scripts/hive-script-helper.sh
280
267
  homepage: https://github.com/bbc/hive-runner
281
268
  licenses: