зеркало из https://github.com/Azure/ARO-RP.git
add format-yaml tool
This commit is contained in:
Родитель
6d3b7d0010
Коммит
b03ee7c50c
5
Makefile
5
Makefile
|
@ -79,7 +79,7 @@ proxy:
|
|||
pyenv${PYTHON_VERSION}:
|
||||
virtualenv --python=/usr/bin/python${PYTHON_VERSION} pyenv${PYTHON_VERSION}
|
||||
. pyenv${PYTHON_VERSION}/bin/activate && \
|
||||
pip install azdev && \
|
||||
pip install autopep8 azdev ruamel.yaml && \
|
||||
azdev setup -r . && \
|
||||
sed -i -e "s|^dev_sources = $(PWD)$$|dev_sources = $(PWD)/python|" ~/.azure/config
|
||||
|
||||
|
@ -118,7 +118,8 @@ test-python: generate pyenv${PYTHON_VERSION}
|
|||
. pyenv${PYTHON_VERSION}/bin/activate && \
|
||||
$(MAKE) az && \
|
||||
azdev linter && \
|
||||
azdev style
|
||||
azdev style && \
|
||||
hack/format-yaml/format-yaml.py .pipelines
|
||||
|
||||
admin.kubeconfig:
|
||||
hack/get-admin-kubeconfig.sh /subscriptions/${AZURE_SUBSCRIPTION_ID}/resourceGroups/${RESOURCEGROUP}/providers/Microsoft.RedHatOpenShift/openShiftClusters/${CLUSTER} >admin.kubeconfig
|
||||
|
|
|
@ -0,0 +1,27 @@
|
|||
#!/usr/bin/env python3
|
||||
|
||||
# Copyright (c) Microsoft Corporation.
|
||||
# Licensed under the Apache License 2.0.
|
||||
|
||||
import os
|
||||
import sys
|
||||
import ruamel.yaml
|
||||
|
||||
|
||||
def main():
|
||||
yaml = ruamel.yaml.YAML()
|
||||
|
||||
for root, _, files in os.walk(sys.argv[1]):
|
||||
for name in files:
|
||||
if not name.endswith('.yml'):
|
||||
continue
|
||||
|
||||
with open(os.path.join(root, name)) as f:
|
||||
y = yaml.load(f)
|
||||
|
||||
with open(os.path.join(root, name), 'w') as f:
|
||||
yaml.dump(y, f)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
Загрузка…
Ссылка в новой задаче