Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
镜像
Containers
Podman Compose
提交
bc9168b0
P
Podman Compose
项目概览
镜像
/
Containers
/
Podman Compose
大约 1 年 前同步成功
通知
10
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
P
Podman Compose
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
bc9168b0
编写于
6月 11, 2023
作者:
E
Evedel
提交者:
Muayyad Alsadi
8月 02, 2023
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
add no-normalize flag
Signed-off-by:
N
Evedel
<
svbiriukov@gmail.com
>
上级
57c527c2
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
20 addition
and
5 deletion
+20
-5
podman_compose.py
podman_compose.py
+5
-1
pytests/test_can_merge_build.py
pytests/test_can_merge_build.py
+4
-1
pytests/test_can_merge_cmd_ent.py
pytests/test_can_merge_cmd_ent.py
+1
-0
pytests/test_normalize_final_build.py
pytests/test_normalize_final_build.py
+10
-3
未找到文件。
podman_compose.py
浏览文件 @
bc9168b0
...
...
@@ -1627,7 +1627,8 @@ class PodmanCompose:
compose
.
get
(
"services"
,
{}),
set
(
args
.
profile
)
)
compose
[
"services"
]
=
resolved_services
compose
=
normalize_final
(
compose
,
self
.
dirname
)
if
not
args
.
no_normalize
:
compose
=
normalize_final
(
compose
,
self
.
dirname
)
self
.
merged_yaml
=
yaml
.
safe_dump
(
compose
)
merged_json_b
=
json
.
dumps
(
compose
,
separators
=
(
","
,
":"
)).
encode
(
"utf-8"
)
self
.
yaml_hash
=
hashlib
.
sha256
(
merged_json_b
).
hexdigest
()
...
...
@@ -3082,6 +3083,9 @@ def compose_build_parse(parser):
@
cmd_parse
(
podman_compose
,
"config"
)
def
compose_config_parse
(
parser
):
parser
.
add_argument
(
"--no-normalize"
,
help
=
"Don't normalize compose model."
,
action
=
"store_true"
)
parser
.
add_argument
(
"--services"
,
help
=
"Print the service names, one per line."
,
action
=
"store_true"
)
...
...
pytests/test_can_merge_build.py
浏览文件 @
bc9168b0
...
...
@@ -138,7 +138,9 @@ def test__parse_compose_file_when_multiple_composes() -> None:
if
actual_compose
!=
expected_result
:
print
(
"compose: "
,
test_input
)
print
(
"override: "
,
test_override
)
print
(
"result: "
,
expected_result
)
print
(
"expected: "
,
expected_result
)
print
(
"actual: "
,
actual_compose
)
compose_expected
=
expected_result
assert
compose_expected
==
actual_compose
...
...
@@ -151,6 +153,7 @@ def set_args(podman_compose: PodmanCompose, file_names: list[str]) -> None:
podman_compose
.
global_args
.
env_file
=
None
podman_compose
.
global_args
.
profile
=
[]
podman_compose
.
global_args
.
in_pod
=
True
podman_compose
.
global_args
.
no_normalize
=
True
def
dump_yaml
(
compose
:
dict
,
name
:
str
)
->
None
:
...
...
pytests/test_can_merge_cmd_ent.py
浏览文件 @
bc9168b0
...
...
@@ -107,6 +107,7 @@ def set_args(podman_compose: PodmanCompose, file_names: list[str]) -> None:
podman_compose
.
global_args
.
env_file
=
None
podman_compose
.
global_args
.
profile
=
[]
podman_compose
.
global_args
.
in_pod
=
True
podman_compose
.
global_args
.
no_normalize
=
None
def
dump_yaml
(
compose
:
dict
,
name
:
str
)
->
None
:
...
...
pytests/test_normalize_final_build.py
浏览文件 @
bc9168b0
...
...
@@ -146,7 +146,7 @@ def test__parse_compose_file_when_single_compose() -> None:
dump_yaml
(
compose_test
,
"test-compose.yaml"
)
podman_compose
=
PodmanCompose
()
set_args
(
podman_compose
,
[
"test-compose.yaml"
])
set_args
(
podman_compose
,
[
"test-compose.yaml"
]
,
no_normalize
=
None
)
podman_compose
.
_parse_compose_file
()
...
...
@@ -271,7 +271,11 @@ def test__parse_compose_file_when_multiple_composes() -> None:
dump_yaml
(
compose_test_2
,
"test-compose-2.yaml"
)
podman_compose
=
PodmanCompose
()
set_args
(
podman_compose
,
[
"test-compose-1.yaml"
,
"test-compose-2.yaml"
])
set_args
(
podman_compose
,
[
"test-compose-1.yaml"
,
"test-compose-2.yaml"
],
no_normalize
=
None
,
)
podman_compose
.
_parse_compose_file
()
...
...
@@ -288,13 +292,16 @@ def test__parse_compose_file_when_multiple_composes() -> None:
assert
compose_expected
==
actual_compose
def
set_args
(
podman_compose
:
PodmanCompose
,
file_names
:
list
[
str
])
->
None
:
def
set_args
(
podman_compose
:
PodmanCompose
,
file_names
:
list
[
str
],
no_normalize
:
bool
)
->
None
:
podman_compose
.
global_args
=
argparse
.
Namespace
()
podman_compose
.
global_args
.
file
=
file_names
podman_compose
.
global_args
.
project_name
=
None
podman_compose
.
global_args
.
env_file
=
None
podman_compose
.
global_args
.
profile
=
[]
podman_compose
.
global_args
.
in_pod
=
True
podman_compose
.
global_args
.
no_normalize
=
no_normalize
def
dump_yaml
(
compose
:
dict
,
name
:
str
)
->
None
:
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录