Skip to content

Handle upgrade with multiple installed same plugins #1135

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 7 additions & 5 deletions openc3/lib/openc3/models/gem_model.rb
Original file line number Diff line number Diff line change
Expand Up @@ -102,13 +102,15 @@ def self.install(name_or_path, scope:)
raise err
end

def self.destroy(name)
def self.destroy(name, log_and_raise_needed_errors: true)
gem_name, version = self.extract_name_and_version(name)
plugin_gem_names = PluginModel.gem_names
if plugin_gem_names.include?(name)
message = "Gem file #{name} can't be uninstalled because needed by installed plugin"
Logger.error message
raise message
if log_and_raise_needed_errors
message = "Gem file #{name} can't be uninstalled because needed by installed plugin"
Logger.error message
raise message
end
else
begin
Gem::Uninstaller.new(gem_name, {:version => version, :force => true}).uninstall
Expand All @@ -131,7 +133,7 @@ def self.destroy_all_other_versions(name)
GemModel.names.each do |gem_full_name|
gem_name, gem_version = GemModel.extract_name_and_version(gem_full_name)
if gem_name == keep_gem_name and gem_version != keep_gem_version
GemModel.destroy(gem_full_name)
GemModel.destroy(gem_full_name, log_and_raise_needed_errors: false)
end
end
end
Expand Down
12 changes: 8 additions & 4 deletions openc3/lib/openc3/utilities/process_manager.rb
Original file line number Diff line number Diff line change
Expand Up @@ -117,11 +117,15 @@ def monitor
process.status.update
end
processes_to_delete.each do |process|
Logger.info("Process #{process.status.name}:#{process.process_type}:#{process.detail} completed with state #{process.status.state}", scope: process.scope)
if process.status.state == "Warning"
Logger.warn("Process Output:\n#{process.status.output}", scope: process.scope)
message = "Process #{process.status.name}:#{process.process_type}:#{process.detail} completed with state #{process.status.state}\nProcess Output:\n#{process.status.output}"
if process.status.state != "Complete"
if process.status.state == "Warning"
Logger.warn(message, scope: process.scope)
else
Logger.error(message, scope: process.scope)
end
else
Logger.error("Process Output:\n#{process.status.output}", scope: process.scope)
Logger.info(message, scope: process.scope)
end

@processes.delete(process)
Expand Down