towerlib icon indicating copy to clipboard operation
towerlib copied to clipboard

"copy" features are missed.

Open hongzhaoo opened this issue 4 years ago • 6 comments

on awx web UI, users may create job templates or inventories by copying existing ones. it would be great helpful if the towerlib supports theses features.

hongzhaoo avatar Dec 10 '21 11:12 hongzhaoo

Yes, you may be right. But while waiting for someone to fix that, there is neat workaround to excute a copy action with towerlib:

towerlib = Tower("tower.com", "tower_user", "tower_pw", secure=True, ssl_verify=False)

job_template = towerlib_obj.get_job_template_by_name("My Job Template")
relative_url_copy = job_template.__dict__['_data']['related']['copy']

url = f'{towerlib.api[:-7]}{relative_url_copy}'
new_job_template_name = { "name": f'{job_template.name} - Copy' }

new_job_template = towerlib.session.post(url, json=new_job_template_name)

phospi avatar Dec 10 '21 13:12 phospi

This should be easy to implement. I will try to make some time next week for this.

costastf avatar Dec 10 '21 16:12 costastf

@phospi @costastf thank you guys.

hongzhaoo avatar Dec 13 '21 01:12 hongzhaoo

@hongzhaoo, @phospi apologies for not picking this up, but I have been busy with the birth of my son and parental leave. Any chance @phospi you would like to provide a PR with the feature?

costastf avatar Feb 10 '22 09:02 costastf

@costastf Sorry, we are currently short-staffed. The workaround is sufficient for us. We don't plan to implement this feature at the time being.

phospi avatar Feb 11 '22 09:02 phospi

Thanks @phospi I appreciate the response.

costastf avatar Feb 11 '22 09:02 costastf