Skip to content
This repository was archived by the owner on Sep 16, 2020. It is now read-only.
This repository was archived by the owner on Sep 16, 2020. It is now read-only.

Creating a Schedule with 'create_on_missing=True' doesn't seem to work #578

Description

@dmsimard

I'm currently developing a module for managing Tower schedules and I'd like to use the same approach as tower_project which ensures the state of the resource by doing a modify with create_on_missing=True: https://github.com/ansible/ansible/blob/1199dff24638736a2401967eff9c37d5da07223b/lib/ansible/modules/web_infrastructure/ansible_tower/tower_project.py#L143-L164

However, I'm getting the following trace when attempting to do that:

The full traceback is:
Traceback (most recent call last):
  File "/tmp/ansible_6rGrUn/ansible_module_tower_schedule.py", line 246, in <module>
    main()
  File "/tmp/ansible_6rGrUn/ansible_module_tower_schedule.py", line 235, in main
    result = schedule.modify(**params)
  File "/usr/lib/python2.7/site-packages/tower_cli/resources/schedule.py", line 84, in decorator_with_pk
    result = func(obj, pk=pk, *args, **kwargs)
  File "/usr/lib/python2.7/site-packages/tower_cli/models/base.py", line 698, in modify
    return self.write(pk, create_on_missing=create_on_missing, force_on_exists=True, **kwargs)
  File "/usr/lib/python2.7/site-packages/tower_cli/models/base.py", line 411, in write
    r = getattr(client, method.lower())(url, data=kwargs)
  File "/usr/lib/python2.7/site-packages/requests/sessions.py", line 507, in post
    return self.request('POST', url, data=data, json=json, **kwargs)
  File "/usr/lib/python2.7/site-packages/tower_cli/api.py", line 276, in request
    "%s method to that URL (%s)." % (method, url),
tower_cli.exceptions.MethodNotAllowed: The Tower server says you can't make a request with the POST method to that URL (http://localhost/api/v2/schedules/).

The modify works if the Schedule already exists.

Is it because a schedule is a related object ?

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions