@@ -48,11 +48,6 @@ static struct list_constraint *list_constraint_new (flux_error_t *errp)
4848 return c ;
4949}
5050
51- bool list_constraint_match (struct list_constraint * c , const struct job * job )
52- {
53- return c -> match (c , job );
54- }
55-
5651static void list_constraint_destructor (void * * item )
5752{
5853 if (item ) {
@@ -186,32 +181,42 @@ static struct list_constraint *create_string_constraint (const char *op,
186181 flux_error_t * errp )
187182{
188183 struct list_constraint * c ;
189- json_t * v = json_array_get (values , 0 );
190- char * s = NULL ;
191- if (!v || !json_is_string (v )) {
192- errprintf (errp , "%s value must be a string" , op );
193- return NULL ;
194- }
195- if (!(s = strdup (json_string_value (v ))))
196- return NULL ;
197- if (!(c = list_constraint_new (errp ))
198- || !zlistx_add_end (c -> values , s )) {
199- list_constraint_destroy (c );
200- free (s );
184+ json_t * entry ;
185+ size_t index ;
186+
187+ if (!(c = list_constraint_new (errp )))
201188 return NULL ;
189+ json_array_foreach (values , index , entry ) {
190+ char * s = NULL ;
191+ if (!json_is_string (entry )) {
192+ errprintf (errp , "%s value must be a string" , op );
193+ goto error ;
194+ }
195+ if (!(s = strdup (json_string_value (entry ))))
196+ return NULL ;
197+ if (!zlistx_add_end (c -> values , s )) {
198+ free (s );
199+ goto error ;
200+ }
202201 }
203202 zlistx_set_destructor (c -> values , wrap_free );
204203 c -> match = match_cb ;
205204 return c ;
205+ error :
206+ list_constraint_destroy (c );
207+ return NULL ;
206208}
207209
208210static bool match_name (struct list_constraint * c ,
209211 const struct job * job )
210212{
211213 const char * name = zlistx_first (c -> values );
212- if (!job -> name )
213- return false;
214- return streq (name , job -> name );
214+ while (name ) {
215+ if (job -> name && streq (name , job -> name ))
216+ return true;
217+ name = zlistx_next (c -> values );
218+ }
219+ return false;
215220}
216221
217222static struct list_constraint * create_name_constraint (json_t * values ,
@@ -224,9 +229,12 @@ static bool match_queue (struct list_constraint *c,
224229 const struct job * job )
225230{
226231 const char * queue = zlistx_first (c -> values );
227- if (!job -> queue )
228- return false;
229- return streq (queue , job -> queue );
232+ while (queue ) {
233+ if (job -> queue && streq (queue , job -> queue ))
234+ return true;
235+ queue = zlistx_next (c -> values );
236+ }
237+ return false;
230238}
231239
232240static struct list_constraint * create_queue_constraint (json_t * values ,
@@ -274,7 +282,8 @@ static int array_to_states_bitmask (json_t *values,
274282 int states = 0 ;
275283 json_t * entry ;
276284 size_t index ;
277- int valid_states = (FLUX_JOB_STATE_PENDING
285+ int valid_states = (FLUX_JOB_STATE_NEW
286+ | FLUX_JOB_STATE_PENDING
278287 | FLUX_JOB_STATE_RUNNING
279288 | FLUX_JOB_STATE_INACTIVE );
280289
0 commit comments