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 wildcard container selection and some code cleanup #47

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

d-EScape
Copy link
Contributor

For lack of a better name I called the option --wildcard (-w). It will select all containers that have the specified text in their names.
Use case: easily create stack files to import in portainer.
Example: I have renamed my domotica related containers to dom.domoticz, dom.mqtt, dom.zwave etc. I can create 1 stack file by doing a
'autocompose.py -w dom.'

output has been checked with docker-compose config

For lack of a better name I called the option --wildcard (-w). Ik will select al containers that have the specified text in their names.
Use case: easily create stack files to import in portainer.
Example: I have renamed my domotica related containers to dom.domoticz, dom.mqtt, dom.zwave etc. I can create 1 stack file by doing a 
'autocompose.py -w dom.'
@Red5d
Copy link
Owner

Red5d commented Nov 30, 2022

@d-EScape The wildcard addition is appreciated, though could you please review the conflicts here? I looked through to try and fix them myself, but not sure exactly how some of your "code cleanup" items will work with the most recent updates.

@demon demon mentioned this pull request Jan 11, 2023
@d-EScape
Copy link
Contributor Author

d-EScape commented Jul 31, 2023

Thanks @demon! The regex approach in #57 looks much more elegant.
It does however also export all networks when filtering on --all (e.g. ./autocompose.py -f "someprefix.*" -a). That is because of lines 120-122.

if args.all:
        host_networks = generate_network_info()
        networks = host_networks

Is there any reason for exporting unused networks in that case? If so, can you change this to

 if args.all and not args.filter:
        host_networks = generate_network_info()
        networks = host_networks

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.

2 participants