Skip to content

Commit

Permalink
remove assign_to (ignored by ibot 3.25+) (#154)
Browse files Browse the repository at this point in the history
  • Loading branch information
steveims committed Dec 14, 2023
1 parent e3ee5d5 commit 1b21926
Show file tree
Hide file tree
Showing 8 changed files with 9 additions and 41 deletions.
3 changes: 1 addition & 2 deletions src/commands/alice/webhook/start.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,6 @@ export default class AliceWebhookStartCommand extends Command {
type: `alice_webhook`,
major: major,
name: flags.name,
assignTo: encodedConfig.assign_to,
args
}

Expand All @@ -77,4 +76,4 @@ export default class AliceWebhookStartCommand extends Command {
this.safeError(err)
}
}
}
}
3 changes: 1 addition & 2 deletions src/commands/hotsos/start.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,6 @@ export default class HosSOSStartCommand extends Command {
type: `hotsos_poller`,
major: major,
name: flags.name,
assignTo: encodedConfig.assign_to,
args
}

Expand All @@ -77,4 +76,4 @@ export default class HosSOSStartCommand extends Command {
this.safeError(err)
}
}
}
}
2 changes: 1 addition & 1 deletion src/commands/task/groups/list.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ export default class TaskGroupsListCommand extends Command {
this.log(`No task groups have been created.`)
} else if (!this.jsonEnabled()) {
if (output == `json`) {
this.log(JSON.stringify(groups)) // to make assign-to proper json
this.log(JSON.stringify(groups))
} else {
printTaskGroups(groups, flags)
}
Expand Down
2 changes: 1 addition & 1 deletion src/commands/task/list.ts
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ export default class TaskListCommand extends Command {
this.log(`No tasks have been ${flags.scheduled ? `scheduled` : `started`} yet${groupName ? ` with group name ${groupName}` : ``}`)
} else if (!this.jsonEnabled()) {
if (output == `json`) {
this.log(JSON.stringify(tasks)) // to make assign-to and args attributes proper json
this.log(JSON.stringify(tasks))
} else if (flags.scheduled) {
printScheduledTasks((tasks as ScheduledTask[]), flags)
} else {
Expand Down
3 changes: 0 additions & 3 deletions src/lib/api.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -298,7 +298,6 @@ export type NewTask = {
task_name: string,
task_type_name: string,
task_type_namespace: string,
assign_to: string[],
task_type_major: integer,
args: TaskArgs,
}
Expand Down Expand Up @@ -355,7 +354,6 @@ export type TaskType = {

export type TaskGroup = {
timestamp: string,
assign_to: string[],
task_type_namespace: string,
task_type_major: integer,
subscriber_id: string,
Expand All @@ -377,7 +375,6 @@ export type NewTaskGroup = {
task_type_namespace: string,
task_type_name: string,
task_type_major: integer,
assign_to: string[],
members: TaskGroupMembers
}

Expand Down
18 changes: 3 additions & 15 deletions src/lib/args.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ type StartArgs = {
type: string,
major: string,
name: string,
assignTo: string,
args: string | TaskArgs,
}

Expand All @@ -22,20 +21,19 @@ type CreateTaskGroupArgs = {
name: string,
type: string,
major: string,
assignTo: string,
members: string | TaskGroupMembers
}

const createScheduleArgs = (args: string[]): ScheduleArgs => {
return zipObject([`namespace`, `type`, `major`, `name`, `assignTo`, `args`, `start`, `timezone`],args) as ScheduleArgs
return zipObject([`namespace`, `type`, `major`, `name`, `args`, `start`, `timezone`],args) as ScheduleArgs
}

const createStartArgs = (args: string[]): StartArgs => {
return zipObject([`namespace`, `type`,`major`, `name`, `assignTo`, `args`], args) as StartArgs
return zipObject([`namespace`, `type`,`major`, `name`, `args`], args) as StartArgs
}

const createTaskGroupArgs = (args: string[]): CreateTaskGroupArgs => {
return zipObject([`namespace`,`type`, `major`, `name`, `assignTo`, `members`], args) as CreateTaskGroupArgs
return zipObject([`namespace`,`type`, `major`, `name`, `members`], args) as CreateTaskGroupArgs
}

const taskStartArgs = [
Expand All @@ -60,11 +58,6 @@ const taskStartArgs = [
required: true,
description: `Name of the task`
},
{
name: `assign-to`,
required: true,
description: `Devices on which to start this task`
},
{
name: `args`,
required: true,
Expand Down Expand Up @@ -94,11 +87,6 @@ const taskGroupCreateArgs = [
required: true,
description: `Group name`
},
{
name: `assign-to`,
required: true,
description: `Device name`
},
{
name: `members`,
required: true,
Expand Down
6 changes: 1 addition & 5 deletions src/lib/tasks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ export const createTask = async (startArgs: StartArgs): Promise<NewTask> => {
task_type_name: startArgs.type,
task_type_major: +startArgs.major,
task_name: startArgs.name,
assign_to: [deviceUri(startArgs.assignTo)],
task_type_namespace: startArgs.namespace,
args: startArgs.args as TaskArgs,
}
Expand All @@ -27,7 +26,6 @@ export const createScheduledTask = async (flags: ScheduledTaskFlags, scheduleArg
task_type_name: scheduleArgs.type,
task_type_major: +scheduleArgs.major,
task_name: scheduleArgs.name,
assign_to: [deviceUri(scheduleArgs.assignTo)],
task_type_namespace: scheduleArgs.namespace,
args: scheduleArgs.args as TaskArgs,
frequency: flags.frequency,
Expand All @@ -45,7 +43,6 @@ export const createTaskGroup = async (createGroupArgs: CreateTaskGroupArgs): Pro
task_type_namespace: createGroupArgs.namespace,
task_type_name: createGroupArgs.type,
task_type_major: +createGroupArgs.major,
assign_to: [deviceUri(createGroupArgs.assignTo)],
members: createGroupArgs.members as TaskGroupMembers
}
return taskGroup
Expand All @@ -59,8 +56,7 @@ export const createAliceArgs = async (config: IntegrationConfig, flags: Integrat
done_path: `/_alice/` + flags.name + `.done`,
task_types: {
alert: {namespace: namespace, name: `alice_alert`, major: major},
ticket: {namespace: namespace, name: `alice_ticket`, major: major},
assign_to: [config.assign_to]
ticket: {namespace: namespace, name: `alice_ticket`, major: major}
},
tags: [`alice_webhook`]
}
Expand Down
13 changes: 1 addition & 12 deletions src/lib/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -232,10 +232,6 @@ export const printTasks = (tasks: Task[], flags: unknown): void => {
task_type_namespace: {
header: `Namespace`,
},
assign_to: {
header: `Assignee`,
get: row => row.assign_to
},
task_type_major: {
header: `Major`,
},
Expand Down Expand Up @@ -281,10 +277,6 @@ export const printScheduledTasks = (tasks: ScheduledTask[], flags: unknown): voi
count: {
get: row => `${row.count ?? `N/A`}`
},
assign_to: {
header: `Assignee`,
get: row => row.assign_to
},
task_type_major: {
header: `Major`,
},
Expand Down Expand Up @@ -343,7 +335,7 @@ export const printDump = (taskTypes: TaskTypeDump[], flags: unknown,namespace: s
}, options)
}

// [{"timestamp":"2023-11-02T20:28:12Z","assign_to":["urn:relay-resource:name:device:frog"],"task_type_namespace":"system","task_type_major":1,"subscriber_id":"8efb6648-c26c-4147-bee8-fa4c6811fd03","task_type_name":"delivery","group_name":"test","task_group_id":"Nriw1Vp5dysN9ANhdAvDulB"}]
// [{"timestamp":"2023-11-02T20:28:12Z","task_type_namespace":"system","task_type_major":1,"subscriber_id":"8efb6648-c26c-4147-bee8-fa4c6811fd03","task_type_name":"delivery","group_name":"test","task_group_id":"Nriw1Vp5dysN9ANhdAvDulB"}]

export const printTaskGroups = (groups: TaskGroup[], flags: unknown): void => {
const options = { ...(flags as Record<string, unknown>) }
Expand All @@ -356,9 +348,6 @@ export const printTaskGroups = (groups: TaskGroup[], flags: unknown): void => {
header: `Task Group ID`
},
timestamp: {},
assign_to: {
header: `Assignee`
},
task_type_namespace: {
header: `Namespace`,
},
Expand Down

0 comments on commit 1b21926

Please sign in to comment.