diff --git a/dkube/sdk/rsrcs/code.py b/dkube/sdk/rsrcs/code.py index a579d125..cf98e856 100644 --- a/dkube/sdk/rsrcs/code.py +++ b/dkube/sdk/rsrcs/code.py @@ -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. @@ -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 self.gitcreds.password = authval elif authopt == 'sshkey': - self.gitcreds.private = True self.gitcreds.sshkey = authval diff --git a/dkube/sdk/rsrcs/dataset.py b/dkube/sdk/rsrcs/dataset.py index 97460c61..2921d960 100644 --- a/dkube/sdk/rsrcs/dataset.py +++ b/dkube/sdk/rsrcs/dataset.py @@ -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( @@ -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. @@ -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': diff --git a/dkube/sdk/rsrcs/model.py b/dkube/sdk/rsrcs/model.py index b7e92459..25d9094a 100644 --- a/dkube/sdk/rsrcs/model.py +++ b/dkube/sdk/rsrcs/model.py @@ -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) @@ -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. @@ -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':