Skip to content

ticket_data is not always a list - #7

Open
tonk wants to merge 2 commits into
scaleup-technologies:mainfrom
tonk:fix_ticket_id
Open

ticket_data is not always a list#7
tonk wants to merge 2 commits into
scaleup-technologies:mainfrom
tonk:fix_ticket_id

Conversation

@tonk

@tonk tonk commented Mar 16, 2026

Copy link
Copy Markdown

Running the scaleuptechnologies.zammad.zammad_ticket module resulted in an error, because the ticket_data did not contain a list, but just a dictionary.

Zammad version: 7.0.0-1773148656.3c95b7da.bookworm

tonk added 2 commits March 16, 2026 10:34
Running the `scaleuptechnologies.zammad.zammad_ticket` module resulted
in an error, because the `ticket_data` did not contain a list, but
just a dictionary.

Zammad version: 7.0.0-1773148656.3c95b7da.bookworm
@cloucs

cloucs commented Mar 19, 2026

Copy link
Copy Markdown
Collaborator

Thanks for your contribution! I'll take a look at it.

@cloucs cloucs left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I might need a little more context. I just tested it in Zammad 7.0.0 and managed to create a ticket, using the module without encountering any problems. It returns a dictionary from which I can retrieve the ID using ticket_data.get("id"). There were no errors. Could you please describe in more detail when the error occurs and how I can reproduce it?

ticket_data["article"]["sender"] = module.params["sender"]
ticket_data, status_code = create_ticket(module, zammad_access, ticket_data)
if isinstance(ticket_data, list):
ticket_id = ticket_data.get[0]("id")

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That looks wrong to me. Maybe you meant this?
ticket_id = ticket_data[0].get("id")

ticket_data["article"]["sender"] = module.params["sender"]
ticket_data, status_code = create_ticket(module, zammad_access, ticket_data)
if isinstance(ticket_data, list):
ticket_id = ticket_data.get[0]("id")

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

True, but in my case it doesn't hurt me, as I get a single ticket returned.

@tonk

tonk commented Mar 25, 2026

Copy link
Copy Markdown
Author

It really looks like it has to do with the Zammad installation.
When I was testing this, my Zammad was completely empty, no tickets. And then this module failed.
Now that I have a couple of tickets in Zammad, the module works.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants