mirror of
https://gitlab.sectorq.eu/jaydee/portainer.git
synced 2025-12-14 02:34:53 +01:00
build
This commit is contained in:
7
port.py
7
port.py
@@ -110,6 +110,10 @@ class Portainer:
|
||||
self.get_stacks()
|
||||
self.get_containers()
|
||||
|
||||
def set_defaults(self, config):
|
||||
'''Set default configuration from provided config dictionary.'''
|
||||
self.cur_config = config
|
||||
|
||||
def get_site(self, site):
|
||||
if site == "portainer":
|
||||
self.base_url = os.getenv(
|
||||
@@ -698,6 +702,7 @@ class Portainer:
|
||||
stacks = self.get_stacks()
|
||||
count = 0
|
||||
data = []
|
||||
stack_names = []
|
||||
for stack in stacks:
|
||||
if endpoint is not None:
|
||||
if not stack["EndpointId"] in self.endpoints["by_id"]:
|
||||
@@ -706,6 +711,7 @@ class Portainer:
|
||||
if self.endpoints["by_name"][endpoint] != stack["EndpointId"]:
|
||||
continue
|
||||
try:
|
||||
stack_names.append(stack["Name"])
|
||||
data.append(
|
||||
[
|
||||
stack["Id"],
|
||||
@@ -723,6 +729,7 @@ class Portainer:
|
||||
headers = ["StackID", "Name", "Endpoint"]
|
||||
print(tabulate.tabulate(data, headers=headers, tablefmt="github"))
|
||||
print(f"Total stacks: {count}")
|
||||
# print(sorted(stack_names))
|
||||
|
||||
def start_stack(self, stack=None, endpoint_id=None):
|
||||
"""Start one stack or all stacks on an endpoint."""
|
||||
|
||||
Reference in New Issue
Block a user