Rack - Redmine Plugin Publish Error

Asked

Viewed 67 times

0

I am creating a plugin for Redmine that will act as generator and publisher of projects within a repository, but I am having problems accessing my button Publish project.

The function I created to publish the project is in the same file within the directory /gerar_versao_projeto/lib/client plugin. It will have to communicate with a file server_versao.java which is on my server and is responsible for doing the entire publishing process and returning error or success to Redmine. But all the data has been encoded and debugged. I believe it is a problem with Rack because the same hash is generated for the button Beget is being used by the Publish.

I have already checked other possibilities of error and the most possible at the moment would be this.

Would anyone have any idea?

  • 2

    if it is possible to post your code

1 answer

1

PROJECT GENERATING FUNCTION

def exec_client

begin
  hostname = Setting.plugin_gerar_versao_projeto['ip_number']
  port = Setting.plugin_gerar_versao_projeto['port_number']
  s = TCPSocket.open(hostname, port)
  s.puts "MSG_RV"
  @project = Project.find_by_identifier(params[:id])
  @repositories = @project.repositories
  @repository = @repositories.first

  if params[:branch] == nil
    s.puts @repository.name
  else
    s.puts params[:branch]
  end

  msg_final = s.read
  puts "MSG_FINAL = #{msg_final}"
  if msg_final =~ /MSG_ERR/
     display_alert l(:alert_error)
  elsif msg_final =~ /MSG_SUC/
      display_alert l(:release_done)
  end

  s.close               # Close the socket when done
rescue
  display_alert l(:alert_error)
end

end


The same applies to the Post function, changing only the Final Message condition:

msg_final = s.read
      puts "MSG_FINAL = #{msg_final}"
      if msg_final =~ /MSG_ERR/
         display_alert l(:alert_error)
      elsif msg_final =~ /MSG_SUC/
          display_alert l(:publish_done)

end

Both functions create a socket and make a connection through the 13000 port of my application/repository server. When the functions are executed, they return a message to REDMINE, which in turn returns SUCESSFULL or ERROR.

What I’m noticing is that by clicking the buttons , both are using the same parameters in the concept of RACK:


started POST "/projects/teste/repository/exec_client" for 127.0.0.1 at 2014-02-26 08:44:07 -0300
Processing by RepositoriesController#exec_client as JS
  Parameters: {"authenticity_token"=>"ta+3n7z4wGBjnBBaovBAEc9D3oAePYwSLUIhVpciR2c=", "id"=>"teste"}

and

  Started POST "/projects/teste/repository/exec_release" for 127.0.0.1 at 2014-02-26 08:43:31 -0300
Processing by RepositoriesController#exec_release as JS
  Parameters: {"authenticity_token"=>"ta+3n7z4wGBjnBBaovBAEc9D3oAePYwSLUIhVpciR2c=", "id"=>"teste"}

In case you need any more sources, I’ll be here.

  • The problem has been solved. Due to a poorly placed s in both Setting.plugin_gerar_versao_project['ip_number'] functions, it did not receive IP and port parameters.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.