-
Notifications
You must be signed in to change notification settings - Fork 96
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
Update config.py #439
base: main
Are you sure you want to change the base?
Update config.py #439
Conversation
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: kajal072001 The full list of commands accepted by this bot can be found here.
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
|
||
from podman.api import cached_property | ||
from podman.api.path_utils import get_xdg_config_home | ||
from podman import PodmanClient |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This line is giving a circular import. Please, remove it. There are ways to call the client such as podman_client = self.client
""" | ||
try: | ||
# Initialize Podman client | ||
podman_client = PodmanClient(base_url="unix://run/podman/io.podman") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This line relates to the fix above
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for your PR, I'll help you getting it through. Let's start with the first comments and then I'll get back with an in depth analysis tomorrow or in the next days
Could you also sign your commit?
git commit -s --amend
if __name__ == "__main__": | ||
try: | ||
# Define container parameters | ||
network_name = "pasta" # Replace with your network name if different | ||
port_mapping = "3128:3128" # Host port : Container port | ||
image = "your-image" # Replace with your actual image | ||
container_name = "your-container" # Replace with your desired container name | ||
|
||
# Additional parameters (if any) | ||
additional_kwargs = { | ||
# Example: Environment variables | ||
# "environment": {"ENV_VAR": "value"}, | ||
# Example: Volume mounts | ||
# "volumes": {"/host/path": {"bind": "/container/path", "mode": "rw"}}, | ||
} | ||
|
||
# Create and start the container | ||
container = create_container_with_pasta( | ||
network_name=network_name, | ||
port_mapping=port_mapping, | ||
image=image, | ||
container_name=container_name, | ||
**additional_kwargs | ||
) | ||
|
||
print(f"Container '{container.name}' is running with TCP namespace forwarding from host port {port_mapping.split(':')[0]} to container port {port_mapping.split(':')[1]}.") | ||
|
||
except Exception as e: | ||
print(f"Failed to create and start container: {e}") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am perplexed about the if __name__ == "__main__":
block. What would be it's use case?
There are circular imports failures related to it, so I would remove it. The example looks nice though so actually it could be documented.
@kajal072001 any update on this pr? |
@kajal072001 any update on my comments? :) |
Addressing #438
Changes
Integrate Configuration Management:
Use the enhanced
PodmanConfig
class to dynamically retrieve and apply network options fromcontainers.conf
.Utilize Detailed Logging:
Configure logging to capture detailed information for debugging purposes.
Validate Network Driver Support:
Confirm that the Pasta network driver supports the
-T
option and handles port mappings as expected.