From 7355edbaa515e06179f3788d58b314d30bddd6e5 Mon Sep 17 00:00:00 2001 From: rahul-179 Date: Sat, 22 May 2021 12:24:46 +0530 Subject: [PATCH 1/2] Dataset change default GitAccessCredentialsPrivate to False --- dkube/sdk/rsrcs/dataset.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dkube/sdk/rsrcs/dataset.py b/dkube/sdk/rsrcs/dataset.py index 97460c61..79540d0b 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( From 372ab0a6b7c80a65aebbf8b989e8f4d26e7b9d9d Mon Sep 17 00:00:00 2001 From: rahul-179 Date: Sun, 23 May 2021 22:26:30 +0530 Subject: [PATCH 2/2] Update private value for datums --- dkube/sdk/rsrcs/code.py | 8 ++++---- dkube/sdk/rsrcs/dataset.py | 5 ++++- dkube/sdk/rsrcs/model.py | 7 +++++-- 3 files changed, 13 insertions(+), 7 deletions(-) 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 79540d0b..2921d960 100644 --- a/dkube/sdk/rsrcs/dataset.py +++ b/dkube/sdk/rsrcs/dataset.py @@ -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':