Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add flags option for dokku_service_link #80

Closed
wants to merge 2 commits into from

Conversation

nerg4l
Copy link
Contributor

@nerg4l nerg4l commented Sep 27, 2020

This PR contains changes to support --link-flags when using dokku_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 to unlink first and then call link again.

Also, I am not sure how to test the functionality properly. I would appreciate some help with that.

Closes #68

@nerg4l nerg4l force-pushed the link-flags branch 2 times, most recently from 6b0be7d to 50b09f6 Compare September 28, 2020 10:20
@ltalirz
Copy link
Member

ltalirz commented Oct 2, 2020

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

@nerg4l
Copy link
Contributor Author

nerg4l commented Oct 3, 2020

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.

@nerg4l
Copy link
Contributor Author

nerg4l commented Oct 3, 2020

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.

@ltalirz
Copy link
Member

ltalirz commented Oct 3, 2020

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.

@nerg4l
Copy link
Contributor Author

nerg4l commented Oct 3, 2020

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.

@ltalirz
Copy link
Member

ltalirz commented Nov 11, 2021

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.

@josegonzalez
Copy link
Member

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?

@josegonzalez
Copy link
Member

What other things are missing, either from report or other output?

@nerg4l
Copy link
Contributor Author

nerg4l commented Nov 12, 2021

@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.

@ltalirz
Copy link
Member

ltalirz commented Dec 23, 2022

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.

@ltalirz ltalirz closed this Dec 23, 2022
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.

Request: --alias support for dokku_service_link
3 participants