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.
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.
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?
This is my controller.
require 'rubygems'
require 'net/ssh'
class BackupsController < 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
dumpshow is my script which does an ssh runs ls $1 . I want to send project.identifier as $1
With the above script I am getting the following error.
NameError (undefined local variable or method 'project' for #<BackupsController:0x7ff5b4a756a0>):
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.
I got it working. It was just params[:project_id]. Took time for me to get to the vocabulary of redmine. Has got limited dev documentation, i feel.