bandshell 0.0.10 → 0.0.11

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env ruby
2
2
 
3
- require 'concerto_client/netconfig'
3
+ require 'bandshell/netconfig'
4
4
 
5
- ConcertoConfig::configure_system_network
5
+ Bandshell::configure_system_network
6
6
 
@@ -13,13 +13,13 @@ class ConcertoConfigServer < Sinatra::Base
13
13
  # push these over to netconfig.rb?
14
14
  # Our list of available physical-layer connection methods...
15
15
  CONNECTION_METHODS = [
16
- ConcertoConfig::WiredConnection,
17
- ConcertoConfig::WirelessConnection
16
+ Bandshell::WiredConnection,
17
+ Bandshell::WirelessConnection
18
18
  ]
19
19
  # ... and available layer-3 addressing methods.
20
20
  ADDRESSING_METHODS = [
21
- ConcertoConfig::DHCPAddressing,
22
- ConcertoConfig::StaticAddressing
21
+ Bandshell::DHCPAddressing,
22
+ Bandshell::StaticAddressing
23
23
  ]
24
24
 
25
25
  # Hosts we allow to access configuration without authenticating.
@@ -60,7 +60,7 @@ class ConcertoConfigServer < Sinatra::Base
60
60
  # password to be considered authorized.
61
61
  def authorized?
62
62
  ip = IPAddress.parse(request.env['REMOTE_ADDR'])
63
- password = ConcertoConfig::ConfigStore.read_config(
63
+ password = Bandshell::ConfigStore.read_config(
64
64
  'password', 'default'
65
65
  )
66
66
  if LOCALHOSTS.include? ip
@@ -75,13 +75,13 @@ class ConcertoConfigServer < Sinatra::Base
75
75
 
76
76
  # Get our base URL from wherever it may be stored.
77
77
  def concerto_url
78
- ConcertoConfig::ConfigStore.read_config('concerto_url', '')
78
+ Bandshell::ConfigStore.read_config('concerto_url', '')
79
79
  end
80
80
 
81
81
  # Try to figure out what our current IPv4 address is
82
82
  # and return it as a string.
83
83
  def my_ip
84
- iface = ConcertoConfig.configured_interface
84
+ iface = Bandshell.configured_interface
85
85
  if iface
86
86
  iface.ip
87
87
  else
@@ -92,7 +92,7 @@ class ConcertoConfigServer < Sinatra::Base
92
92
  # Check if we have something resembling a network connection.
93
93
  # This means we found a usable interface and it has an IPv4 address.
94
94
  def network_ok
95
- iface = ConcertoConfig.configured_interface
95
+ iface = Bandshell.configured_interface
96
96
  if iface
97
97
  if iface.ip != "0.0.0.0"
98
98
  true
@@ -174,7 +174,7 @@ class ConcertoConfigServer < Sinatra::Base
174
174
  url = params[:url]
175
175
  if validate_url(url)
176
176
  # save to the configuration store
177
- ConcertoConfig::ConfigStore.write_config('concerto_url', url)
177
+ Bandshell::ConfigStore.write_config('concerto_url', url)
178
178
 
179
179
  # root will now redirect to the proper concerto_url
180
180
  redirect '/screen'
@@ -200,7 +200,7 @@ class ConcertoConfigServer < Sinatra::Base
200
200
  # is not implemented. This is also how we get away with just having
201
201
  # one instance each of the config classes that are currently selected.
202
202
  begin
203
- cm, am = ConcertoConfig.read_network_config
203
+ cm, am = Bandshell.read_network_config
204
204
  rescue Errno::ENOENT
205
205
  cm = nil
206
206
  am = nil
@@ -275,17 +275,17 @@ class ConcertoConfigServer < Sinatra::Base
275
275
  do_assign(amargs, am)
276
276
 
277
277
  # Save the configuration file.
278
- ConcertoConfig.write_network_config(cm, am)
278
+ Bandshell.write_network_config(cm, am)
279
279
 
280
280
  # Reload network configuration.
281
281
  STDERR.puts "Trying to bring down the interface"
282
- if ConcertoConfig.configured_interface
283
- ConcertoConfig.configured_interface.ifdown
282
+ if Bandshell.configured_interface
283
+ Bandshell.configured_interface.ifdown
284
284
  end
285
285
  STDERR.puts "Rewriting configuration files"
286
- ConcertoConfig::configure_system_network
286
+ Bandshell::configure_system_network
287
287
  STDERR.puts "Bringing interface back up"
288
- ConcertoConfig.configured_interface.ifup
288
+ Bandshell.configured_interface.ifup
289
289
 
290
290
  # Back to the network form.
291
291
  redirect '/netconfig' # as a get request
@@ -304,7 +304,7 @@ class ConcertoConfigServer < Sinatra::Base
304
304
  redirect '/password'
305
305
  end
306
306
 
307
- ConcertoConfig::ConfigStore.write_config('password', params[:newpass])
307
+ Bandshell::ConfigStore.write_config('password', params[:newpass])
308
308
  redirect '/setup'
309
309
  end
310
310
 
@@ -19,7 +19,7 @@
19
19
  %option{:value=>""}="Auto Select"
20
20
  / list out available interfaces and their MAC addresses
21
21
  / preselect one if there was one chosen in config
22
- - ConcertoConfig::WiredConnection.interfaces.each do |iface|
22
+ - Bandshell::WiredConnection.interfaces.each do |iface|
23
23
  %option{:value=>iface.name, :selected=>value_from(connection_method, :interface_name)==iface.name}="#{iface.name} - #{iface.mac}"
24
24
  #WirelessConnection
25
25
  %h3="Wireless Connection Settings (no encryption)"
@@ -28,7 +28,7 @@
28
28
  %select#interface_name{:name=>"WirelessConnection/interface_name"}
29
29
  %option{:value=>""}="Auto Select"
30
30
  / same as above but with the wireless interfaces
31
- - ConcertoConfig::WirelessConnection.interfaces.each do |iface|
31
+ - Bandshell::WirelessConnection.interfaces.each do |iface|
32
32
  %option{:value=>iface.name, :selected=>value_from(connection_method, :interface_name) == iface.name}="#{iface.name} - #{iface.mac}"
33
33
  %p
34
34
  %label{:for=>"WirelessConnection_ssid"}="SSID"
@@ -27,7 +27,7 @@ class Module
27
27
  end
28
28
  end
29
29
 
30
- module ConcertoConfig
30
+ module Bandshell
31
31
  # The Debian interfaces configuration file we are going to write out.
32
32
  INTERFACES_FILE='/etc/network/interfaces'
33
33
 
@@ -459,8 +459,8 @@ module ConcertoConfig
459
459
  }
460
460
  end
461
461
 
462
- connection_method_class = ConcertoConfig.const_get(args['connection_method'])
463
- addressing_method_class = ConcertoConfig.const_get(args['addressing_method'])
462
+ connection_method_class = Bandshell.const_get(args['connection_method'])
463
+ addressing_method_class = Bandshell.const_get(args['addressing_method'])
464
464
 
465
465
  connection_method = connection_method_class.new(
466
466
  args['connection_method_args']
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bandshell
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.10
4
+ version: 0.0.11
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: