Note that there are some explanatory texts on larger screens.

plurals
  1. POuse project.identifier as variable in redmine
    primarykey
    data
    text
    <p>In our redmine setup, corresponding to the project.identifier (not :project_id) we have folders in another server and the developers store the mysql database dumps related to their project. I am trying to write a plugin which just shows the list of all the database dumps.</p> <p>For this initially I tried using net/ssh and then the plugin logs into the another server where the db dumps are located and does an ls. I show the ls output in an unordered list in the plugin's view. For this i should send the project.identifier as the argument to ls to get the list of dumps particular to that project. Could not figure out how to send local variables via Net::SSH.</p> <p>Then I changed my idea of using net/ssh and now simply executing a local script which does an ssh and ls. Now I want to use project.identifier again as an argument. How can i pass the value of project.identifier as an argument to the command in system call?</p> <p>This is my controller.</p> <pre><code>require 'rubygems' require 'net/ssh' class BackupsController &lt; ApplicationController helper :projects unloadable def index #host = '192.168.122.245' #user = 'root' #Net::SSH.start( host, user ) do |ssh| #@result = ssh.exec!('dumplist website') #end @identifier = "#{project.identifier}" @result = %x[dumpshow @identifier] end end </code></pre> <p>dumpshow is my script which does an ssh runs <code>ls $1</code> . I want to send project.identifier as $1</p> <p>With the above script I am getting the following error. <code>NameError (undefined local variable or method 'project' for #&lt;BackupsController:0x7ff5b4a756a0&gt;):</code></p> <p>To summarize, I wanna use the variables from Redmine,'s core controller and model. This seems to be simple but I am missing it somewhere. Or there should be a very simple way of finding the current project's identifier as we find out the USer.Current.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload