Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions dkube/sdk/rsrcs/code.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ def update_basic(self, user, name, tags):
self.datum.name = name
self.datum.tags = tags

def update_git_details(self, url, branch=None, authopt=GIT_ACCESS_OPTS[0], authval=None):
def update_git_details(self, url, branch=None, authopt=None, authval=None):

"""
Method to update the details of git datasource.
Expand Down Expand Up @@ -93,12 +93,12 @@ def update_git_details(self, url, branch=None, authopt=GIT_ACCESS_OPTS[0], authv

self.gitcreds.username = self.user

if authopt == 'apikey':
if authopt != None and authval != None:
self.gitcreds.private = True

if authopt == 'apikey':
self.gitcreds.apikey = authval
elif authopt == 'password':
self.gitcreds.private = True

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@rahul-179 if credentials are passed then private=True is correct right ?

@rahul-179 rahul-179 May 24, 2021

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mak-454 yes, we will set private as true only if creds are passed
i removed it because function signature for update_git_details(self, url, branch=None, authopt=GIT_ACCESS_OPTS[0], authval=None)
always set authopt to GIT_ACCESS_OPTS[0]
which indirectly always set private to true

self.gitcreds.password = authval
elif authopt == 'sshkey':
self.gitcreds.private = True
self.gitcreds.sshkey = authval
7 changes: 5 additions & 2 deletions dkube/sdk/rsrcs/dataset.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ def __init__(self, user, name=generate("dataset"), tags=None):
access_key_id=None, access_key=None, bucket=None, prefix=None, endpoint=None)

self.gitcreds = GitAccessCredentials(
username=None, password=None, apikey=None, sshkey=None, private=True)
username=None, password=None, apikey=None, sshkey=None, private=False)
self.gitaccess = GitAccessInfo(
path=None, url=None, branch=None, credentials=self.gitcreds)
self.hostpath = DatumModelHostpath(
Expand Down Expand Up @@ -123,7 +123,7 @@ def update_dataset_source(self, source=DATASET_SOURCES[0]):
"""
self.datum.source = source

def update_git_details(self, url, branch=None, authopt=GIT_ACCESS_OPTS[0], authval=None):
def update_git_details(self, url, branch=None, authopt=None, authval=None):
"""
Method to update the details of git datasource.

Expand Down Expand Up @@ -157,6 +157,9 @@ def update_git_details(self, url, branch=None, authopt=GIT_ACCESS_OPTS[0], authv

self.gitcreds.username = self.user

if authopt != None and authval != None:
self.gitcreds.private = True

if authopt == 'apikey':
self.gitcreds.apikey = authval
elif authopt == 'password':
Expand Down
7 changes: 5 additions & 2 deletions dkube/sdk/rsrcs/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ def __init__(self, user, name=generate("dataset"), tags=None):
access_key_id=None, access_key=None, bucket=None, prefix=None, endpoint=None)

self.gitcreds = GitAccessCredentials(
username=None, password=None, apikey=None, sshkey=None, private=True)
username=None, password=None, apikey=None, sshkey=None, private=False)
self.gitaccess = GitAccessInfo(
path=None, url=None, branch=None, credentials=self.gitcreds)

Expand Down Expand Up @@ -115,7 +115,7 @@ def update_model_source(self, source=MODEL_SOURCES[0]):

self.datum.source = source

def update_git_details(self, url, branch=None, authopt=GIT_ACCESS_OPTS[0], authval=None):
def update_git_details(self, url, branch=None, authopt=None, authval=None):
"""
i Method to update the details of git source.

Expand Down Expand Up @@ -149,6 +149,9 @@ def update_git_details(self, url, branch=None, authopt=GIT_ACCESS_OPTS[0], authv

self.gitcreds.username = self.user

if authopt != None and authval != None:
self.gitcreds.private = True

if authopt == 'apikey':
self.gitcreds.apikey = authval
elif authopt == 'password':
Expand Down