@@ -72,6 +72,8 @@ public class TaskomaticApi {
72
72
MINION_ACTION_JOB_PREFIX + "download-" ;
73
73
public static final String MINION_ACTIONCHAIN_BUNCH_LABEL = "minion-action-chain-executor-bunch" ;
74
74
public static final String MINION_ACTIONCHAIN_JOB_PREFIX = "minion-action-chain-executor-" ;
75
+
76
+ private static final String SCHEDULE_SINGLE_SAT_BUNCH_RUN = "tasko.scheduleSingleSatBunchRun" ;
75
77
private static final Logger LOG = LogManager .getLogger (TaskomaticApi .class );
76
78
77
79
@@ -135,7 +137,7 @@ public void scheduleSSHActionExecution(Action actionIn, MinionServer sshMinion,
135
137
scheduleParams .put ("action_id" , Long .toString (actionIn .getId ()));
136
138
scheduleParams .put ("force_pkg_list_refresh" , Boolean .toString (forcePackageListRefresh ));
137
139
scheduleParams .put ("ssh_minion_id" , sshMinion .getMinionId ());
138
- invoke ("tasko.scheduleSingleSatBunchRun" ,
140
+ invoke (SCHEDULE_SINGLE_SAT_BUNCH_RUN ,
139
141
"ssh-minion-action-executor-bunch" ,
140
142
StringUtils .substring (
141
143
"ssh-minion-action-executor-" + actionIn .getId () + "-" + sshMinion .getId (), 0 , 50 ),
@@ -263,7 +265,7 @@ public Date scheduleRepoSync(Channel chan, User user, String cron,
263
265
public Date scheduleSingleSatBunch (User user , String bunchName ,
264
266
Map <String , String > params ) throws TaskomaticApiException {
265
267
ensureSatAdminRole (user );
266
- return (Date ) invoke ("tasko.scheduleSingleSatBunchRun" , bunchName , params );
268
+ return (Date ) invoke (SCHEDULE_SINGLE_SAT_BUNCH_RUN , bunchName , params );
267
269
}
268
270
269
271
/**
@@ -276,7 +278,7 @@ public Date scheduleSingleSatBunch(User user, String bunchName,
276
278
*/
277
279
public Date scheduleGathererRefresh (User user , Map <String , String > params ) throws TaskomaticApiException {
278
280
ensureOrgAdminRole (user );
279
- return (Date ) invoke ("tasko.scheduleSingleSatBunchRun" , "gatherer-matcher-bunch" , params );
281
+ return (Date ) invoke (SCHEDULE_SINGLE_SAT_BUNCH_RUN , "gatherer-matcher-bunch" , params );
280
282
}
281
283
282
284
/**
@@ -342,7 +344,7 @@ public Date scheduleSatBunch(User user, String jobLabel, String bunchName, Strin
342
344
*/
343
345
public void scheduleRecurringAction (RecurringAction action , User user ) throws TaskomaticApiException {
344
346
if (!action .canAccess (user )) {
345
- throw new PermissionException (String .format ("User '%s' can't schedule action '$ s'" , user , action ));
347
+ throw new PermissionException (String .format ("User '%s' can't schedule action '% s'" , user , action ));
346
348
}
347
349
348
350
doScheduleSatBunch (user , action .computeTaskoScheduleName (), "recurring-action-executor-bunch" ,
@@ -369,7 +371,7 @@ private Date doScheduleSatBunch(User user, String jobLabel, String bunchName, St
369
371
*/
370
372
public void unscheduleRecurringAction (RecurringAction action , User user ) throws TaskomaticApiException {
371
373
if (!action .canAccess (user )) {
372
- throw new PermissionException (String .format ("User '%s' can't unschedule action '$ s'" , user , action ));
374
+ throw new PermissionException (String .format ("User '%s' can't unschedule action '% s'" , user , action ));
373
375
}
374
376
375
377
doUnscheduleSatBunch (user , action .computeTaskoScheduleName (), "recurring-action-executor-bunch" );
@@ -517,8 +519,7 @@ public String getRepoSyncSchedule(Channel chan, User user)
517
519
* @throws TaskomaticApiException if there was an error
518
520
*/
519
521
public List <Map <String , Object >> listSatBunchSchedules (User user ) throws TaskomaticApiException {
520
- List <Map <String , Object >> bunches = (List <Map <String , Object >>) invoke ("tasko.listSatBunches" );
521
- return bunches ;
522
+ return (List <Map <String , Object >>) invoke ("tasko.listSatBunches" );
522
523
}
523
524
524
525
/**
@@ -669,7 +670,7 @@ public void scheduleActionChainExecution(ActionChain actionchain)
669
670
Map <String , String > params = new HashMap <>();
670
671
params .put ("actionchain_id" , Long .toString (actionchain .getId ()));
671
672
672
- invoke ("tasko.scheduleSingleSatBunchRun" , MINION_ACTIONCHAIN_BUNCH_LABEL ,
673
+ invoke (SCHEDULE_SINGLE_SAT_BUNCH_RUN , MINION_ACTIONCHAIN_BUNCH_LABEL ,
673
674
MINION_ACTIONCHAIN_JOB_PREFIX + actionchain .getId (), params ,
674
675
earliestAction );
675
676
}
@@ -689,7 +690,7 @@ public void scheduleStagingJob(Long actionId, Long minionId, Date stagingDateTim
689
690
params .put ("staging_job" , "true" );
690
691
params .put ("staging_job_minion_server_id" , Long .toString (minionId ));
691
692
692
- invoke ("tasko.scheduleSingleSatBunchRun" , MINION_ACTION_BUNCH_LABEL ,
693
+ invoke (SCHEDULE_SINGLE_SAT_BUNCH_RUN , MINION_ACTION_BUNCH_LABEL ,
693
694
MINION_ACTION_JOB_DOWNLOAD_PREFIX + actionId + "-" + minionId , params ,
694
695
stagingDateTime );
695
696
}
@@ -751,7 +752,7 @@ public void scheduleSubscribeChannels(User user, SubscribeChannelsAction action)
751
752
Map <String , String > params = new HashMap <>();
752
753
params .put ("action_id" , Long .toString (action .getId ()));
753
754
params .put ("user_id" , Long .toString (user .getId ()));
754
- invoke ("tasko.scheduleSingleSatBunchRun" , MINION_ACTION_BUNCH_LABEL ,
755
+ invoke (SCHEDULE_SINGLE_SAT_BUNCH_RUN , MINION_ACTION_BUNCH_LABEL ,
755
756
MINION_ACTION_JOB_PREFIX + action .getId (), params ,
756
757
action .getEarliestAction ());
757
758
}
@@ -809,7 +810,7 @@ public void scheduleSinglePaygUpdate(PaygSshData sshdata)
809
810
throws TaskomaticApiException {
810
811
Map <String , String > scheduleParams = new HashMap <>();
811
812
scheduleParams .put ("sshData_id" , sshdata .getId ().toString ());
812
- invoke ("tasko.scheduleSingleSatBunchRun" , "update-payg-data-bunch" , scheduleParams );
813
+ invoke (SCHEDULE_SINGLE_SAT_BUNCH_RUN , "update-payg-data-bunch" , scheduleParams );
813
814
}
814
815
815
816
/**
@@ -856,7 +857,7 @@ public void scheduleSingleRootCaCertUpdate(Map<String, String> filenameToRootCaC
856
857
857
858
Map <String , Object > paramList = new HashMap <>();
858
859
paramList .put ("filename_to_root_ca_cert_map" , sanitisedFilenameToRootCaCertMap );
859
- invoke ("tasko.scheduleSingleSatBunchRun" , "root-ca-cert-update-bunch" , paramList );
860
+ invoke (SCHEDULE_SINGLE_SAT_BUNCH_RUN , "root-ca-cert-update-bunch" , paramList );
860
861
}
861
862
862
863
/**
@@ -868,7 +869,7 @@ public void scheduleSingleGpgKeyImport(String gpgKey) throws TaskomaticApiExcept
868
869
if (StringUtils .isBlank (gpgKey )) {
869
870
return ;
870
871
}
871
- invoke ("tasko.scheduleSingleSatBunchRun" , "custom-gpg-key-import-bunch" , Map .of ("gpg-key" , gpgKey ));
872
+ invoke (SCHEDULE_SINGLE_SAT_BUNCH_RUN , "custom-gpg-key-import-bunch" , Map .of ("gpg-key" , gpgKey ));
872
873
}
873
874
874
875
/**
@@ -878,7 +879,7 @@ public void scheduleSingleGpgKeyImport(String gpgKey) throws TaskomaticApiExcept
878
879
* @throws TaskomaticApiException if there is an error
879
880
*/
880
881
public void scheduleProductRefresh (Date earliest , boolean withReposync ) throws TaskomaticApiException {
881
- invoke ("tasko.scheduleSingleSatBunchRun" , "mgr-sync-refresh-bunch" ,
882
+ invoke (SCHEDULE_SINGLE_SAT_BUNCH_RUN , "mgr-sync-refresh-bunch" ,
882
883
Map .of ("noRepoSync" , !withReposync ), earliest );
883
884
}
884
885
}
0 commit comments