Closed nerg4l closed 1 year ago
hi @nerg4l , thanks for this addition.
This might be a bit naive approach as I'm not sure if you can change these flags by calling the command again or you have to unlink first and then call link again.
I don't know either; perhaps try it out?
Also, I am not sure how to test the functionality properly.
if you're asking about how to add tests, then you can simply add tasks to https://github.com/dokku/ansible-dokku/blob/master/molecule/default/verify.yml
I guess for some of these flags you will be able to check whether they have taken effect? I don't think you will need super strong tests here in the role; most should be tested already inside dokku
Thanks. I will try out the command on a droplet today.
About the testing part, I just want to know how can I try this in development Ansible role.
When an app is already linked then running the link command again regarding of flags will result in the following message:
Already linked as DATABASE_URL
However, I couldn't find a way to tell if a flag is active or not. As you said, I can only test if the flag has taken effect.
When an app is already linked then running the link command again regarding of flags will result in the following message:
Already linked as DATABASE_URL
@josegonzalez is there a way to check for this information without running the link command?
@nerg4l if there doesn't turn out to be a way to check, and if the the exit code when re-running the link command is 0 (echo $?
after it runs), one could also decide to ignore this output and assume that everything is fine.
For checking an existing link one can use dokku --quiet <service>:linked <name> <app>
. I was looking for a command which could be used to tell if a flag is set or a way to modifying them by setting the link again with flags. It did not work. If I try a less generic approach and I only add alias support then an easy test could be to check the env.
hi @nerg4l , in case you want to look back into this at some point:
As you point out, for a "proper" implementation, the module would need a way to determine the current state of the flags and, if it differs from the requested one, unlink and link again.
If that is difficult, and if being able to set the flags via the role is very useful, I would also be ok with ignoring a change in requested flags for a link that has already been created, as long as this shortcoming is clearly documented in the description of the flags
field.
There isnt a good way to check with url we link with atm, but maybe we can have a that be part of the :linked
output?
What other things are missing, either from report or other output?
@josegonzalez It should be enough if dokku <service>:linked <name> <app>
could report the flags. That change only would allow us to check when a flag is set and then we can unlink the service and link again with the added/changed flags.
I'm closing this stale PR since it has been waiting more than 12 months for input.
The last stage was looking for a change in dokku for dokku <service>:linked <name> <app>
to report flags.
I'm happy to also accept a workaround without this functionality if desired.
Feel free to reopen this PR when resuming work on it.
This PR contains changes to support
--link-flags
when usingdokku_service_link
. This might be a bit naive approach as I'm not sure if you can change these flags by calling the command again or you have tounlink
first and then calllink
again.Also, I am not sure how to test the functionality properly. I would appreciate some help with that.
Closes #68