Skip to content

Commit 8ba1a4a

Browse files
committed
test jbn
1 parent da01e74 commit 8ba1a4a

File tree

1 file changed

+12
-7
lines changed

1 file changed

+12
-7
lines changed

infrahub_sdk/testing/repository.py

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -59,8 +59,8 @@ def path(self) -> str:
5959

6060
def init(self) -> None:
6161
self.dst_directory.mkdir(parents=True, exist_ok=True)
62-
6362
dest_path = self.dst_directory / self.name
63+
6464
if dest_path.exists():
6565
shutil.rmtree(dest_path)
6666

@@ -69,27 +69,32 @@ def init(self) -> None:
6969
dst=dest_path,
7070
ignore=shutil.ignore_patterns(".git", *self.directories_to_ignore),
7171
)
72-
dest_path.chmod(0o755)
73-
print(dest)
72+
print(f"Files copied to {dest}")
7473

75-
self._repo = GitRepoManager(str(Path(self.dst_directory / self.name)), branch=self.initial_branch)
74+
porcelain.init(str(dest_path))
75+
self._repo = GitRepoManager(str(dest_path), branch=self.initial_branch)
7676

7777
files = list(
7878
porcelain.get_untracked_paths(self._repo.git.path, self._repo.git.path, self._repo.git.open_index())
7979
)
80-
print(files)
8180
files_to_add = [str(Path(self._repo.git.path) / t) for t in files]
82-
print(files_to_add)
81+
print(f"Files to add: {files_to_add}")
82+
8383
if files_to_add:
8484
porcelain.add(repo=self._repo.git.path, paths=files_to_add)
8585
porcelain.commit(repo=self._repo.git.path, message="First commit")
8686
porcelain.checkout_branch(self._repo.git, self.initial_branch.encode("utf-8"))
8787

88+
print(f"Repository accessible in container at: {self.remote_directory_name}/{self.name}")
89+
8890
async def add_to_infrahub(self, client: InfrahubClient, branch: str | None = None) -> dict:
91+
container_path = f"{self.remote_directory_name}/{self.name}"
92+
print(f"Using container path: {container_path}")
93+
8994
input_data = {
9095
"data": {
9196
"name": {"value": self.name},
92-
"location": {"value": f"{self.remote_directory_name}/{self.name}"},
97+
"location": {"value": container_path},
9398
},
9499
}
95100

0 commit comments

Comments
 (0)