Project

General

Profile

Revision 2b80fdd9

Added by Ori Rabin almost 6 years ago

Fixes #13043 - Change Parameter inheritance to DockerParameter

View differences:

app/controllers/api/v2/containers_controller.rb
53 53
          param :memory, String
54 54
          param :cpu_shares, :number
55 55
          param :cpu_set, String
56
          param :environment_variables, Hash
56
          param :environment_variables, Array, :desc => N_("Optional array of environment variables hashes. e.g. 'environment_variables': [{'name' => 'example', 'value' => '123'}]")
57 57
          param :attach_stdout, :bool
58 58
          param :attach_stdin, :bool
59 59
          param :attach_stderr, :bool
......
80 80
          set_container_taxonomies
81 81
          process_response @container.save
82 82
        end
83
      rescue ActiveModel::MassAssignmentSecurity::Error => e
84
        render :json => { :error  => _("Wrong attributes: %s") % e.message },
85
               :status => :unprocessable_entity
86 83
      end
87 84

  
88 85
      api :DELETE, '/containers/:id/', N_('Delete a container')
......
169 166
        end
170 167

  
171 168
        if params[:container][:environment_variables].present?
172
          wizard_state.environment.environment_variables =
173
            params[:container][:environment_variables]
169
          environment_variables = []
170
          params[:container][:environment_variables].each do |env_var|
171
            environment_variable = DockerContainerWizardStates::EnvironmentVariable.new
172
            environment_variable.key = env_var[:key]
173
            environment_variable.value = env_var[:value]
174
            environment_variables << environment_variable
175
          end
176
          wizard_state.environment.environment_variables = environment_variables
174 177
        end
175 178
        wizard_state.tap(&:save)
176 179
      end

Also available in: Unified diff