Try to retrieve a stackscript.
(module, client)
| 26 | |
| 27 | |
| 28 | def stackscript_available(module, client): |
| 29 | """Try to retrieve a stackscript.""" |
| 30 | try: |
| 31 | label = module.params["label"] |
| 32 | desc = module.params["description"] |
| 33 | |
| 34 | result = client.linode.stackscripts(StackScript.label == label, StackScript.description == desc, mine_only=True) |
| 35 | return result[0] |
| 36 | except IndexError: |
| 37 | return None |
| 38 | except Exception as exception: |
| 39 | module.fail_json(msg="Unable to query the Linode API. Saw: %s" % exception) |
| 40 | |
| 41 | |
| 42 | def initialise_module(): |