uffizzi_core 2.2.10 → 2.2.12

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 9419a80d61cb906e699b4096f7ed6f10fc01f32a6718a977c38387d04af04cb9
4
- data.tar.gz: 279eda26ef9283fc173d93f5b7fc166780ffaa51e2dd83b0be7fbea1ba7862cc
3
+ metadata.gz: f772c9b87543e9235c6d874a0b51976de68bc59ce4df268431cedeed2ad591b4
4
+ data.tar.gz: 9cae54ffd97d0d1168a7421fa9bc982cb60ada19024559f9e3a9de4de52e9fad
5
5
  SHA512:
6
- metadata.gz: 646d0199efbd24eddd77def2b0f8a629e16f81b3f6f871a9961b2cde46f37b5609fbc6662eec3f5e74e74a879ddba1cf504776a767c738ab8127eb28a555e9a5
7
- data.tar.gz: 98c028198257d7bd268b4c6bfaa7a6663be35530f6ed1218d2108e7d6602a43122538a6c54cec92d5ff0d7c247d2e6f1a50a32885600e43a13554a15d514235a
6
+ metadata.gz: c13d3b51c33532ba74b12fe34c4ec87f2b0de01fc3d135ab85568dca91440866b87bc24a8b6556a541bf78988e7405bc24909504873ca7d1bcce82d79bc3931a
7
+ data.tar.gz: afd0851814b2b0509f83b4c84c2739077b2bfbc073f31fe6db15e88bec6272d3bc2c74af1ce6bdc3b756c002b5a1572382894f3ce7850c6ba886b18e658de24e
@@ -61,7 +61,7 @@ module UffizziCore::Concerns::Models::Container
61
61
  transitions from: [:disabled], to: :active
62
62
  end
63
63
 
64
- event :disable, after: :clean do
64
+ event :disable do
65
65
  transitions from: [:active], to: :disabled
66
66
  end
67
67
  end
@@ -76,10 +76,6 @@ module UffizziCore::Concerns::Models::Container
76
76
  public && active?
77
77
  end
78
78
 
79
- def clean
80
- update(public: false, port: nil)
81
- end
82
-
83
79
  def set_defaults
84
80
  update_target_port_value
85
81
  end
@@ -1,6 +1,14 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  class UffizziCore::ControllerService
4
+ class InvalidPublicPort < StandardError
5
+ def initialize(containers)
6
+ msg = "Deployment with ID #{containers.first.deployment.id} does not have any public port"
7
+
8
+ super(msg)
9
+ end
10
+ end
11
+
4
12
  class << self
5
13
  include UffizziCore::DependencyInjectionConcern
6
14
 
@@ -28,6 +36,10 @@ class UffizziCore::ControllerService
28
36
  end
29
37
 
30
38
  def deploy_containers(deployment, containers)
39
+ check_any_container_has_public_port(containers) do |exists|
40
+ UffizziCore::DeploymentService.disable!(deployment) unless exists
41
+ end
42
+
31
43
  containers = containers.map do |container|
32
44
  UffizziCore::Controller::DeployContainers::ContainerSerializer.new(container).as_json(include: '**')
33
45
  end
@@ -100,6 +112,15 @@ class UffizziCore::ControllerService
100
112
 
101
113
  private
102
114
 
115
+ def check_any_container_has_public_port(containers)
116
+ exists = containers.any? { |c| c.port.present? && c.public }
117
+ yield(exists) if block_given?
118
+
119
+ return if exists
120
+
121
+ raise InvalidPublicPort.new(containers)
122
+ end
123
+
103
124
  def request_events(deployment)
104
125
  controller_client(deployment).deployment_containers_events(deployment_id: deployment.id)
105
126
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module UffizziCore
4
- VERSION = '2.2.10'
4
+ VERSION = '2.2.12'
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: uffizzi_core
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.2.10
4
+ version: 2.2.12
5
5
  platform: ruby
6
6
  authors:
7
7
  - Josh Thurman
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2023-08-09 00:00:00.000000000 Z
12
+ date: 2023-08-14 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: aasm