Class: UffizziCore::Controller::DeployContainers::ContainerSerializer

Inherits:
BaseSerializer
  • Object
show all
Defined in:
app/serializers/uffizzi_core/controller/deploy_containers/container_serializer.rb

Instance Method Summary collapse

Instance Method Details

#commandObject



30
31
32
# File 'app/serializers/uffizzi_core/controller/deploy_containers/container_serializer.rb', line 30

def command
  object.command.blank? ? nil : JSON.parse(object.command)
end

#entrypointObject



26
27
28
# File 'app/serializers/uffizzi_core/controller/deploy_containers/container_serializer.rb', line 26

def entrypoint
  object.entrypoint.blank? ? nil : JSON.parse(object.entrypoint)
end

#healthcheckObject



34
35
36
37
38
39
40
41
42
43
44
45
46
# File 'app/serializers/uffizzi_core/controller/deploy_containers/container_serializer.rb', line 34

def healthcheck
  return {} if object.healthcheck.blank?

  command = object.healthcheck['test']
  new_command = if command.is_a?(Array)
    items_to_remove = ['CMD', 'CMD-SHELL']
    command.select { |item| items_to_remove.exclude?(item) }
  elsif object.healthcheck['test'].is_a?(String)
    command.split
  end

  object.healthcheck.merge('test' => new_command)
end