openc3 5.5.0 → 5.5.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -257,12 +257,15 @@ module OpenC3
257
257
  @log_raw = true
258
258
 
259
259
  when 'SECRET'
260
- parser.verify_num_parameters(3, 4, "#{keyword} <Secret Type: ENV or FILE> <Secret Name> <Environment Variable Name or File Path> <Option Name (Optional)>")
260
+ parser.verify_num_parameters(3, 5, "#{keyword} <Secret Type: ENV or FILE> <Secret Name> <Environment Variable Name or File Path> <Option Name (Optional)> <Secret Store Name (Optional)>")
261
261
  @secrets << parameters[0..2]
262
- if parameters[3]
262
+ if ConfigParser.handle_nil(parameters[3])
263
263
  # Option Name, Secret Name
264
264
  @secret_options << [parameters[3], parameters[1]]
265
265
  end
266
+ if ConfigParser.handle_nil(parameters[4])
267
+ @secrets[-1] << parameters[4]
268
+ end
266
269
 
267
270
  else
268
271
  raise ConfigParser::Error.new(parser, "Unknown keyword and parameters for Interface/Router: #{keyword} #{parameters.join(" ")}")
@@ -23,7 +23,6 @@
23
23
  require 'openc3/top_level'
24
24
  require 'openc3/models/model'
25
25
  require 'openc3/models/metric_model'
26
- require 'openc3/models/traefik_model'
27
26
  require 'openc3/utilities/bucket'
28
27
 
29
28
  module OpenC3
@@ -193,8 +192,12 @@ module OpenC3
193
192
  parser.verify_num_parameters(1, 1, "#{keyword} <Container Image Name>")
194
193
  @container = parameters[0]
195
194
  when 'SECRET'
196
- parser.verify_num_parameters(3, 3, "#{keyword} <Secret Type: ENV or FILE> <Secret Name> <Environment Variable Name or File Path>")
197
- @secrets << parameters.dup
195
+ parser.verify_num_parameters(3, 4, "#{keyword} <Secret Type: ENV or FILE> <Secret Name> <Environment Variable Name or File Path> <Secret Store Name (Optional)>")
196
+ if ConfigParser.handle_nil(parameters[3])
197
+ @secrets << parameters.dup
198
+ else
199
+ @secrets << parameters[0..2]
200
+ end
198
201
  when 'ROUTE_PREFIX'
199
202
  parser.verify_num_parameters(1, 1, "#{keyword} <Route Prefix>")
200
203
  @prefix = parameters[0]
@@ -225,7 +228,6 @@ module OpenC3
225
228
  end
226
229
  end
227
230
  unless validate_only
228
- TraefikModel.register_route(microservice_name: @name, port: @ports[0][0], prefix: @prefix) if @ports[0] and ports[0][0] and @prefix
229
231
  ConfigTopic.write({ kind: 'created', type: 'microservice', name: @name, plugin: @plugin }, scope: @scope)
230
232
  end
231
233
  end
@@ -235,7 +237,6 @@ module OpenC3
235
237
  @bucket.list_objects(bucket: ENV['OPENC3_CONFIG_BUCKET'], prefix: prefix).each do |object|
236
238
  @bucket.delete_object(bucket: ENV['OPENC3_CONFIG_BUCKET'], key: object.key)
237
239
  end
238
- TraefikModel.unregister_route(microservice_name: @name, port: @ports[0][0], prefix: @prefix) if @ports[0] and ports[0][0] and @prefix
239
240
  ConfigTopic.write({ kind: 'deleted', type: 'microservice', name: @name, plugin: @plugin }, scope: @scope)
240
241
  rescue Exception => error
241
242
  Logger.error("Error undeploying microservice model #{@name} in scope #{@scope} due to #{error}")
@@ -44,7 +44,7 @@ module OpenC3
44
44
  class PluginModel < Model
45
45
  PRIMARY_KEY = 'openc3_plugins'
46
46
  # Reserved VARIABLE names. See local_mode.rb: update_local_plugin()
47
- RESERVED_VARIABLE_NAMES = ['target_name', 'microservice_name']
47
+ RESERVED_VARIABLE_NAMES = ['target_name', 'microservice_name', 'scope']
48
48
 
49
49
  attr_accessor :variables
50
50
  attr_accessor :plugin_txt_lines
@@ -198,6 +198,8 @@ module OpenC3
198
198
  tf.close
199
199
  plugin_txt_path = tf.path
200
200
  variables = plugin_hash['variables']
201
+ variables ||= {}
202
+ variables['scope'] = scope
201
203
  if File.exist?(plugin_txt_path)
202
204
  parser = OpenC3::ConfigParser.new("https://openc3.com")
203
205
 
@@ -60,8 +60,8 @@ module OpenC3
60
60
  # Setup secrets for microservice
61
61
  secrets = microservice_config["secrets"]
62
62
  if secrets
63
- secrets.each do |type, secret_name, env_name_or_path|
64
- secret_value = @secrets.get(secret_name, scope: scope)
63
+ secrets.each do |type, secret_name, env_name_or_path, secret_store|
64
+ secret_value = @secrets.get(secret_name, secret_store: secret_store, scope: scope)
65
65
  if secret_value
66
66
  case type
67
67
  when 'ENV'
@@ -21,11 +21,11 @@ require 'openc3/utilities/secrets'
21
21
 
22
22
  module OpenC3
23
23
  class RedisSecrets < Secrets
24
- def keys(scope:)
24
+ def keys(secret_store: nil, scope:)
25
25
  SecretModel.names(scope: scope)
26
26
  end
27
27
 
28
- def get(key, scope:)
28
+ def get(key, secret_store: nil, scope:)
29
29
  data = SecretModel.get(name: key, scope: scope)
30
30
  if data
31
31
  return data['value']
@@ -34,11 +34,11 @@ module OpenC3
34
34
  end
35
35
  end
36
36
 
37
- def set(key, value, scope:)
37
+ def set(key, value, secret_store: nil, scope:)
38
38
  SecretModel.set( {name: key, value: value.to_s }, scope: scope)
39
39
  end
40
40
 
41
- def delete(key, scope:)
41
+ def delete(key, secret_store: nil, scope:)
42
42
  model = SecretModel.get_model(name: key, scope: scope)
43
43
  model.destroy if model
44
44
  end
@@ -31,24 +31,24 @@ module OpenC3
31
31
  klass.new
32
32
  end
33
33
 
34
- def keys(scope:)
34
+ def keys(secret_store: nil, scope:)
35
35
  raise NotImplementedError, "#{self.class} has not implemented method '#{__method__}'"
36
36
  end
37
37
 
38
- def get(key, scope:)
38
+ def get(key, secret_store: nil, scope:)
39
39
  return @local_secrets[key]
40
40
  end
41
41
 
42
- def set(key, value, scope:)
42
+ def set(key, value, secret_store: nil, scope:)
43
43
  raise NotImplementedError, "#{self.class} has not implemented method '#{__method__}'"
44
44
  end
45
45
 
46
- def delete(key, scope:)
46
+ def delete(key, secret_store: nil, scope:)
47
47
  raise NotImplementedError, "#{self.class} has not implemented method '#{__method__}'"
48
48
  end
49
49
 
50
50
  def setup(secrets)
51
- secrets.each do |type, key, data|
51
+ secrets.each do |type, key, data, secret_store|
52
52
  case type
53
53
  when 'ENV'
54
54
  @local_secrets[key] = ENV[data]
@@ -1,14 +1,14 @@
1
1
  # encoding: ascii-8bit
2
2
 
3
- OPENC3_VERSION = '5.5.0'
3
+ OPENC3_VERSION = '5.5.1'
4
4
  module OpenC3
5
5
  module Version
6
6
  MAJOR = '5'
7
7
  MINOR = '5'
8
- PATCH = '0'
8
+ PATCH = '1'
9
9
  OTHER = ''
10
- BUILD = '6e9e3efe6170bd7adca14b849620f03fb622338d'
10
+ BUILD = 'a1e84e1850e06f2c01726e03372e2872137b3852'
11
11
  end
12
- VERSION = '5.5.0'
13
- GEM_VERSION = '5.5.0'
12
+ VERSION = '5.5.1'
13
+ GEM_VERSION = '5.5.1'
14
14
  end
@@ -2,8 +2,7 @@ SCREEN AUTO AUTO 1.0
2
2
 
3
3
  TITLE "Status"
4
4
 
5
- VERTICALBOX
6
- SECTIONHEADER "Information"
5
+ VERTICALBOX "Information"
7
6
  LABELVALUE <%= target_name %> STATUS VALUE
8
7
  LABELVALUE <%= target_name %> STATUS BOOL
9
8
  END
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: openc3
3
3
  version: !ruby/object:Gem::Version
4
- version: 5.5.0
4
+ version: 5.5.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ryan Melton
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2023-02-23 00:00:00.000000000 Z
12
+ date: 2023-02-26 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: bundler
@@ -692,6 +692,8 @@ files:
692
692
  - bin/openc3cli
693
693
  - bin/rubysloc
694
694
  - data/config/_array_params.yaml
695
+ - data/config/_canvas_values.yaml
696
+ - data/config/_graph_params.yaml
695
697
  - data/config/_id_items.yaml
696
698
  - data/config/_id_params.yaml
697
699
  - data/config/_interfaces.yaml
@@ -700,6 +702,7 @@ files:
700
702
  - data/config/command.yaml
701
703
  - data/config/command_modifiers.yaml
702
704
  - data/config/command_telemetry.yaml
705
+ - data/config/graph_settings.yaml
703
706
  - data/config/interface_modifiers.yaml
704
707
  - data/config/item_modifiers.yaml
705
708
  - data/config/microservice.yaml
@@ -708,6 +711,7 @@ files:
708
711
  - data/config/plugins.yaml
709
712
  - data/config/protocols.yaml
710
713
  - data/config/screen.yaml
714
+ - data/config/settings.yaml
711
715
  - data/config/table_manager.yaml
712
716
  - data/config/table_parameter_modifiers.yaml
713
717
  - data/config/target.yaml
@@ -899,7 +903,6 @@ files:
899
903
  - lib/openc3/models/timeline_model.rb
900
904
  - lib/openc3/models/tool_config_model.rb
901
905
  - lib/openc3/models/tool_model.rb
902
- - lib/openc3/models/traefik_model.rb
903
906
  - lib/openc3/models/trigger_group_model.rb
904
907
  - lib/openc3/models/trigger_model.rb
905
908
  - lib/openc3/models/widget_model.rb
@@ -1,47 +0,0 @@
1
- # encoding: ascii-8bit
2
-
3
- # Copyright 2023 OpenC3, Inc.
4
- # All Rights Reserved.
5
- #
6
- # This program is free software; you can modify and/or redistribute it
7
- # under the terms of the GNU Affero General Public License
8
- # as published by the Free Software Foundation; version 3 with
9
- # attribution addendums as found in the LICENSE.txt
10
- #
11
- # This program is distributed in the hope that it will be useful,
12
- # but WITHOUT ANY WARRANTY; without even the implied warranty of
13
- # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
- # GNU Affero General Public License for more details.
15
- #
16
- # This file may also be used under the terms of a commercial license
17
- # if purchased from OpenC3, Inc.
18
-
19
- require 'openc3/utilities/store'
20
-
21
- module OpenC3
22
- class TraefikModel
23
- def self.register_route(microservice_name:, port:, prefix:, priority: 20)
24
- prefix = '/' + prefix unless prefix[0] == '/'
25
- if ENV['KUBERNETES_SERVICE_HOST']
26
- url = "http://#{microservice_name.gsub('__', '-')}:#{port}"
27
- else
28
- url = "http://openc3-operator:#{port}"
29
- end
30
- service_name = microservice_name
31
- router_name = microservice_name
32
- Store.set("traefik/http/services/#{service_name}/loadbalancer/servers/0/url", url)
33
- Store.set("traefik/http/routers/#{router_name}/service", service_name)
34
- Store.set("traefik/http/routers/#{router_name}/priority", priority)
35
- Store.set("traefik/http/routers/#{router_name}/rule", "PathPrefix(`#{prefix}`)")
36
- end
37
-
38
- def self.unregister_route(microservice_name:)
39
- service_name = microservice_name
40
- router_name = microservice_name
41
- Store.del("traefik/http/routers/#{router_name}/rule")
42
- Store.del("traefik/http/routers/#{router_name}/priority")
43
- Store.del("traefik/http/routers/#{router_name}/service")
44
- Store.del("traefik/http/services/#{service_name}/loadbalancer/servers/0/url")
45
- end
46
- end
47
- end