import com.google.gerrit.sshd.*
import com.google.gerrit.extensions.annotations.*
import com.google.gerrit.lucene.*
import com.google.inject.*
import org.kohsuke.args4j.*
@Export("start")
@CommandMetaData(name = "start", description = "Start a new on-line re-indexing for a target Lucene index version")
class StartReindex extends SshCommand {
@Inject OnlineReindexer.Factory reindexerFactory
@Argument(index = 0, usage = "Index version", metaVar = "VERSION")
int indexVersion
public void run() {
def indexer = reindexerFactory.create(indexVersion)
indexer.start()
stdout.println "On-line reindexing scheduled for version " + indexVersion
}
}
--
--
To unsubscribe, email repo-discuss...@googlegroups.com
More info at http://groups.google.com/group/repo-discuss?hl=en
---
You received this message because you are subscribed to the Google Groups "Repo and Gerrit Discussion" group.
To unsubscribe from this group and stop receiving emails from it, send an email to repo-discuss...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
You received this message because you are subscribed to a topic in the Google Groups "Repo and Gerrit Discussion" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/repo-discuss/pUn8fHVh58w/unsubscribe.
To unsubscribe from this group and all its topics, send an email to repo-discuss...@googlegroups.com.
On 10 May 2016, at 20:05, Khai Do <zaro...@gmail.com> wrote:Hi Luca, I wanted to force an online reindex so tried your reindexer script (reindexer-1.0.groovy) but I can't seem to get it to work. I have installed the groovy-provider-plugin[1]
and the plugin scripts[2] on Gerrit core ver 2.11.4.
There doesn't seem to be any docs on how to run the command but from the code it looks like it's just 'ssh -p 29418 localhost gerrit reindex start' which doesn't work for me.
It doesn't seem to recognize the command. I've noticed that the groovy provider plugin docs says it requires some core changes to work when I look at the topic[3] for those core changes it looks like some of them were abandoned.
On 20 May 2016, at 16:45, Khai Do <zaro...@gmail.com> wrote:Thanks Luca, finally able to try this again, looks like I just mistyped the command as 'reindex' instead of 'reindexer'. It works for me now.
I noticed that these admin scripts don't respect gerrit access rules because it looks like any user is able to run these commands.
Is there a way to enforce access rules in the admin scripts? or would this need to be written as a proper gerrit (java) plugin?
Maybe another thought would be to enforce access rules for these scripts in the groovy-provider plugin?
On 20 May 2016, at 17:40, Khai Do <zaro...@gmail.com> wrote:I just tested and the annotation seems to work as expected. I'll propose that annotation to these scripts because they are 'admin'. Also I'll find some time to fix up the docs so others won't need to bother you further :)
I still have one lingering questions though. Why even have a plugin to force reindex, this seem appropriate as a core change. Maybe as 'gerrit reindex --force'?