Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
hsz1273327 committed Jul 28, 2021
1 parent c5ef11b commit 2dc7377
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
# 0.0.4

## bug修复

+ 修复`createorupdatestack`在没有stack时无法部署的问题

# 0.0.3

## 接口修改
Expand Down
8 changes: 4 additions & 4 deletions portainer_deploy_tool/create_or_update_stack.py
Original file line number Diff line number Diff line change
Expand Up @@ -248,12 +248,14 @@ def __init__(self, *args: Any, **kwargs: Any) -> None:
def find_compose(self, cwd: Path, suffix: str, root: Path) -> None:
for p in cwd.iterdir():
if p.is_file:
log.info("find file", file_name=p.name)
if p.name.endswith(suffix):
rp = p.relative_to(root)
stack_name = p.name.replace(suffix, "")
if stack_name in [i.stack_name for i in self.compose_infos]:
log.error("stack name repetition", stack_name=stack_name)
raise AttributeError("stack name repetition")
log.debug("find stack", stack_name=stack_name)
ci = ComposeInfo(stack_name=stack_name, path=str(rp))
self.compose_infos.append(ci)
elif p.is_dir():
Expand Down Expand Up @@ -300,7 +302,7 @@ def do_main(self) -> None:
self.find_compose(cwd=cwdp, suffix=suffix, root=root)
# 处理excepts
endpoints_stacks = self.handdler_excepts(excepts)
log.debug("deal with excepts ok", endpoints_stacks=endpoints_stacks)
log.debug("deal with excepts ok", endpoints_stacks=endpoints_stacks, compose_infos=self.compose_infos)
# 获取jwt
jwt = get_jwt(rq, base_url=base_url, username=username, password=password)
log.debug("deal with jwt ok", jwt=jwt)
Expand All @@ -317,9 +319,7 @@ def do_main(self) -> None:
except Exception as e:
raise e
log.debug("deal with swarmID ok", swarmID=swarmID, endpoint=endpoint)
exist_stacks = endpoint_stack_info.get(endpoint)
if exist_stacks is None:
continue
exist_stacks = endpoint_stack_info.get(endpoint, {})
preparing_stacks = endpoints_stacks[endpoint]
for _stack in preparing_stacks:
stack = exist_stacks.get(_stack.stack_name)
Expand Down

0 comments on commit 2dc7377

Please sign in to comment.