Public bug reported:

Multi-branch job folders that have class name as
"jenkins.branch.OrganizationFolder" are not supported for
reconfig_credential due to assertion failure for is_folder check.

Function is_folder only supports generic job folder class
"com.cloudbees.hudson.plugins.folder.Folder"

A simple patch for this is below.


diff --git a/jenkins/__init__.py b/jenkins/__init__.py
index 620ce14..7aec164 100755
--- a/jenkins/__init__.py
+++ b/jenkins/__init__.py
@@ -2062,8 +2062,8 @@ class Jenkins(object):
         :param name: Job name, ``str``
         :returns: ``True`` if job is folder, ``False`` otherwise
         '''
-        return 'com.cloudbees.hudson.plugins.folder.Folder' \
-            == self.get_job_info(name)['_class']
+        return self.get_job_info(name)['_class'] in 
['com.cloudbees.hudson.plugins.folder.Folder',
+                                                     
'jenkins.branch.OrganizationFolder']

     def assert_credential_exists(self, name, folder_name, domain_name='_',
                                  exception_message='credential[%s] does not '

** Affects: python-jenkins
     Importance: Undecided
         Status: New

** Description changed:

  Multi-branch job folders that have class name as
  "jenkins.branch.OrganizationFolder" are not supported for
  reconfig_credential due to assertion failure for is_folder check.
  
  Function is_folder only supports generic job folder class
  "com.cloudbees.hudson.plugins.folder.Folder"
  
  A simple patch for this is below.
  
+ ```
  diff --git a/jenkins/__init__.py b/jenkins/__init__.py
  index 620ce14..7aec164 100755
  --- a/jenkins/__init__.py
  +++ b/jenkins/__init__.py
  @@ -2062,8 +2062,8 @@ class Jenkins(object):
-          :param name: Job name, ``str``
-          :returns: ``True`` if job is folder, ``False`` otherwise
-          '''
+          :param name: Job name, ``str``
+          :returns: ``True`` if job is folder, ``False`` otherwise
+          '''
  -        return 'com.cloudbees.hudson.plugins.folder.Folder' \
  -            == self.get_job_info(name)['_class']
  +        return self.get_job_info(name)['_class'] in 
['com.cloudbees.hudson.plugins.folder.Folder',
  +                                                     
'jenkins.branch.OrganizationFolder']
  
-      def assert_credential_exists(self, name, folder_name, domain_name='_',
-                                   exception_message='credential[%s] does not '
+      def assert_credential_exists(self, name, folder_name, domain_name='_',
+                                   exception_message='credential[%s] does not '
+ ```

** Description changed:

  Multi-branch job folders that have class name as
  "jenkins.branch.OrganizationFolder" are not supported for
  reconfig_credential due to assertion failure for is_folder check.
  
  Function is_folder only supports generic job folder class
  "com.cloudbees.hudson.plugins.folder.Folder"
  
  A simple patch for this is below.
  
- ```
+ 
  diff --git a/jenkins/__init__.py b/jenkins/__init__.py
  index 620ce14..7aec164 100755
  --- a/jenkins/__init__.py
  +++ b/jenkins/__init__.py
  @@ -2062,8 +2062,8 @@ class Jenkins(object):
           :param name: Job name, ``str``
           :returns: ``True`` if job is folder, ``False`` otherwise
           '''
  -        return 'com.cloudbees.hudson.plugins.folder.Folder' \
  -            == self.get_job_info(name)['_class']
  +        return self.get_job_info(name)['_class'] in 
['com.cloudbees.hudson.plugins.folder.Folder',
  +                                                     
'jenkins.branch.OrganizationFolder']
  
       def assert_credential_exists(self, name, folder_name, domain_name='_',
                                    exception_message='credential[%s] does not '
- ```

-- 
You received this bug notification because you are a member of Python
Jenkins Developers, which is subscribed to Python Jenkins.
https://bugs.launchpad.net/bugs/1878489

Title:
  function is_folder does not support jenkins.branch.OrganizationFolder

Status in Python Jenkins:
  New

Bug description:
  Multi-branch job folders that have class name as
  "jenkins.branch.OrganizationFolder" are not supported for
  reconfig_credential due to assertion failure for is_folder check.

  Function is_folder only supports generic job folder class
  "com.cloudbees.hudson.plugins.folder.Folder"

  A simple patch for this is below.

  
  diff --git a/jenkins/__init__.py b/jenkins/__init__.py
  index 620ce14..7aec164 100755
  --- a/jenkins/__init__.py
  +++ b/jenkins/__init__.py
  @@ -2062,8 +2062,8 @@ class Jenkins(object):
           :param name: Job name, ``str``
           :returns: ``True`` if job is folder, ``False`` otherwise
           '''
  -        return 'com.cloudbees.hudson.plugins.folder.Folder' \
  -            == self.get_job_info(name)['_class']
  +        return self.get_job_info(name)['_class'] in 
['com.cloudbees.hudson.plugins.folder.Folder',
  +                                                     
'jenkins.branch.OrganizationFolder']

       def assert_credential_exists(self, name, folder_name, domain_name='_',
                                    exception_message='credential[%s] does not '

To manage notifications about this bug go to:
https://bugs.launchpad.net/python-jenkins/+bug/1878489/+subscriptions

-- 
Mailing list: https://launchpad.net/~python-jenkins-developers
Post to     : python-jenkins-developers@lists.launchpad.net
Unsubscribe : https://launchpad.net/~python-jenkins-developers
More help   : https://help.launchpad.net/ListHelp

Reply via email to