Skip to content

Commit c415957

Browse files
committed
Merge branch 'master' into stream-porject-config-extract
2 parents c76a199 + beefa24 commit c415957

File tree

1 file changed

+0
-34
lines changed

1 file changed

+0
-34
lines changed

migration/migration.py

Lines changed: 0 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,6 @@
2222
Exports SonarQube platform configuration as JSON
2323
"""
2424
import sys
25-
import os
26-
from threading import Lock
2725

2826
from cli import options
2927
from sonar import exceptions, errcodes, utilities, version
@@ -67,7 +65,6 @@
6765
options.WHAT_PORTFOLIOS: __JSON_KEY_PORTFOLIOS,
6866
}
6967

70-
_WRITE_LOCK = Lock()
7168

7269
def __parse_args(desc):
7370
parser = options.set_common_args(desc)
@@ -102,36 +99,6 @@ def __write_export(config: dict[str, str], file: str) -> None:
10299
print(utilities.json_dump(config), file=fd)
103100

104101

105-
def __remove_chars_at_end(file: str, nb_bytes: int) -> None:
106-
"""Writes the configuration in file"""
107-
with open(file, mode="rb+") as fd:
108-
fd.seek(-nb_bytes, os.SEEK_END)
109-
fd.truncate()
110-
111-
112-
def __add_project_header(file: str) -> None:
113-
"""Writes the configuration in file"""
114-
with open(file, mode="a", encoding="utf-8") as fd:
115-
print(',\n "projects": {\n', file=fd)
116-
117-
118-
def __add_project_footer(file: str) -> None:
119-
"""Closes projects section"""
120-
__remove_chars_at_end(file, 2)
121-
with open(file, mode="a", encoding="utf-8") as fd:
122-
print("\n }\n}", file=fd)
123-
124-
125-
def write_project(project_json: dict[str, any], file: str) -> None:
126-
"""
127-
writes a project JSON in a file
128-
"""
129-
key = project_json.pop("key")
130-
with _WRITE_LOCK:
131-
with utilities.open_file(file, mode="a") as fd:
132-
print(f'"{key}": {utilities.json_dump(project_json)},', file=fd)
133-
134-
135102
def __export_config(endpoint: platform.Platform, what: list[str], **kwargs) -> None:
136103
"""Exports a platform configuration in a JSON file"""
137104
export_settings = {
@@ -171,7 +138,6 @@ def __export_config(endpoint: platform.Platform, what: list[str], **kwargs) -> N
171138
ndx, func = call_data
172139
try:
173140
sq_settings[ndx] = func(endpoint, export_settings=export_settings, key_list=key_list)
174-
__write_export(sq_settings, kwargs[options.REPORT_FILE])
175141
except exceptions.UnsupportedOperation as e:
176142
log.warning(e.message)
177143
sq_settings = utilities.remove_empties(sq_settings)

0 commit comments

Comments
 (0)