Hi Community,
We have a lot of configured scheduled Assets imports running everyday several times due day
If we need to disable them temporarily - we would like to avoid going through dozen of ObjectSchemas and disable manually more then hundred of imports
question is: is there a possibility to disable them all at once
I tried to use class com.riadalabs.jira.plugins.insight.channel.external.api.facade.ImportSourceConfigurationFacade:
import com.onresolve.scriptrunner.runner.customisers.PluginModule
import com.onresolve.scriptrunner.runner.customisers.WithPlugin
import com.onresolve.scriptrunner.db.DatabaseUtil
import com.riadalabs.jira.plugins.insight.channel.external.api.facade.ImportSourceConfigurationFacade
@WithPlugin('com.riadalabs.jira.plugins.insight')
@PluginModule ImportSourceConfigurationFacade importSourceConfigurationFacade
//getting list of all imports from database directly
DatabaseUtil.withSql('Imports') { sql ->
// going through each row of defined SQL query
sql.eachRow("""SELECT SRC.NAME, SRC.ID FROM JiraDB.jiraschema.AO_8542F1_IFJ_IMPORT_SRC AS SRC ORDER BY SRC.ID ASC""") {
def importID = it.getAt('ID') as Integer //Import ID
def importSource = importSourceConfigurationFacade.loadImportSource(importID)
def disabledImportStatus = importSource.importSourceStatus.createDisabled()
importSource.setImportSourceStatus(disabledImportStatus)
//log.warn(importSource.importSourceStatus)
log.warn("Import Name: "+importSource.getName()+"; Import ID: $importID; Enabled: "+importSource.isEnabled())
}
}
Script is running and giving goal result for ImportSourceStatus = false
but imports remains enabled in UI and in DB
The importSource only exists in memory within the script context
You have to store it back after setting the status.
importSourceConfigurationFacade.storeImportSource(importSource)
Thanks,
I missed that somehow. It works now
Added this command and condition for importSource.isEnabled() not to update every import objects
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Just to add for future references:
We found out that there is hidden PUT API request can be used to disable imports:
https://{JIRA-URL}/rest/insight/1.0/importsource/{import_ID}/disable
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
It seems like the script is correctly updating the import status in the database, but it's not reflecting in the UI. Ensure that you're committing the changes to the database after updating the import source status to ensure they take effect.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.