Skip to content

Commit 3d9341a

Browse files
authored
chore: new-client.py to fail with message when a module exists (#9256)
Fixes https://togithub.com/googleapis/google-cloud-java/issues/9244 ``` suztomo@suztomo2:~/google-cloud-java$ python3.9 generation/new_client/new-client.py generate \ --api_shortname=datacatalog \ --proto-path=google/cloud/datacatalog \ --name-pretty="Data Catalog" \ --product-docs="https://cloud.google.com/data-catalog" \ --api-description="DataCatalog is a centralized and unified data catalog service for all your Cloud resources, where users and systems can discover data, explore and curate its semantics, understand how to act on it, and help govern its usage." /usr/local/google/home/suztomo/google-cloud-java/generation/new_client Couldn't create the module because the module /usr/local/google/home/suztomo/google-cloud-java/java-datacatalog already exists. In Java client library generation, a new API version of an existing module does not require new-client.py invocation. See go/yoshi-java-new-client#adding-a-new-service-version-by-owlbot. ```
1 parent 35b5c8e commit 3d9341a

1 file changed

Lines changed: 8 additions & 1 deletion

File tree

generation/new_client/new-client.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -213,7 +213,14 @@ def generate(
213213

214214
# Initialize workdir
215215
workdir = Path(f"{sys.path[0]}/../../java-{output_name}").resolve()
216-
subprocess.run(["rm", "-fr", workdir])
216+
if os.path.isdir(workdir):
217+
sys.exit(
218+
"Couldn't create the module because "
219+
f"the module {workdir} already exists. In Java client library "
220+
"generation, a new API version of an existing module does not "
221+
"require new-client.py invocation. "
222+
"See go/yoshi-java-new-client#adding-a-new-service-version-by-owlbot."
223+
)
217224
print(f"Creating a new module {workdir}")
218225
os.makedirs(workdir, exist_ok=False)
219226
# write .repo-metadata.json file

0 commit comments

Comments
 (0)