Skip to content

Commit

Permalink
modify how client is built
Browse files Browse the repository at this point in the history
  • Loading branch information
tcarmet committed Mar 11, 2024
1 parent 0cb5044 commit 4d4051a
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 10 deletions.
7 changes: 3 additions & 4 deletions runner_manager/backend/vsphere.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,17 +32,16 @@ class VsphereBackend(BaseBackend):
name: Literal[Backends.vsphere] = Field(default=Backends.vsphere)
config: VsphereConfig
instance_config: VsphereInstanceConfig
session = Session()

@property
def client(self) -> VsphereClient:
session = Session()
session.verify = self.config.verify_ssl
self.session.verify = self.config.verify_ssl
return create_vsphere_client(
server=self.config.server,
username=self.config.username,
password=self.config.password,
bearer_token=self.config.bearer_token,
session=session,
session=self.session,
)

def get_folder(self, datacenter_name, folder_name):
Expand Down
8 changes: 2 additions & 6 deletions tests/unit/backend/test_vsphere.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,12 @@

@fixture()
def vsphere_group(settings) -> RunnerGroup:
config = VsphereConfig(
server=os.environ.get("GOVC_URL", ""),
username=os.environ.get("GOVC_USERNAME", ""),
password=os.environ.get("GOVC_PASSWORD", ""),
)
config = VsphereConfig(server=os.environ.get("GOVC_URL", ""),username=os.environ.get("GOVC_USERNAME", ""),password=os.environ.get("GOVC_PASSWORD", ""))
runner_group: RunnerGroup = RunnerGroup(
id=2,
name="test",
organization="octo-org",
manager=settings.name,
manager="runner-manager",
backend=VsphereBackend(
name=Backends.vsphere,
config=config,
Expand Down

0 comments on commit 4d4051a

Please sign in to comment.