Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

client.job.list_all throws 404 but curl works fine. #245

Open
andrew80k opened this issue Sep 15, 2017 · 1 comment
Open

client.job.list_all throws 404 but curl works fine. #245

andrew80k opened this issue Sep 15, 2017 · 1 comment

Comments

@andrew80k
Copy link

andrew80k commented Sep 15, 2017

require 'jenkins_api_client'

begin
  @client = JenkinsApi::Client.new(:server_ip => 'jenkins.example.com',:server_port => '443',:username => 'user',:password => 'password',:log_level => 0,:ssl => true)
  puts @client.job.list_all
rescue Exception => e
  puts e.message
end

produces:

D, [2017-09-15T08:18:18.546154 #32469] DEBUG -- : GET /api/json?tree=jobs[name]
D, [2017-09-15T08:18:19.272611 #32469] DEBUG -- : HTTP Code: 404, Response Body:
E, [2017-09-15T08:18:19.272756 #32469] ERROR -- : JenkinsApi::Exceptions::NotFound: Requested component is not found on the Jenkins CI server.

Yet I can do:

curl -X GET -u 'user:password' "https://jenkins.example.com/api/json?tree=jobs\[name\]" | python -m json.tool

And get:

{
    "_class": "hudson.model.Hudson",
    "jobs": [
        {
            "_class": "com.cloudbees.hudson.plugins.folder.Folder",
            "name": "ADMIN"
        },
        {
            "_class": "com.cloudbees.hudson.plugins.folder.Folder",
            "name": "CODE_QUALITY"
        },
        {
            "_class": "com.cloudbees.hudson.plugins.folder.Folder",
            "name": "MODERNIZATION"
        },
        {
            "_class": "com.cloudbees.hudson.plugins.folder.Folder",
            "name": "PRE-PROD"
        },
        {
            "_class": "com.cloudbees.hudson.plugins.folder.Folder",
            "name": "SANDBOX"
        },
        {
            "_class": "com.cloudbees.hudson.plugins.folder.Folder",
            "name": "STAGING"
        },
        {
            "_class": "com.cloudbees.hudson.plugins.folder.Folder",
            "name": "TEST-AUTOMATION"
        },
        {
            "_class": "com.cloudbees.hudson.plugins.folder.Folder",
            "name": "UTILITIES"
        }
    ]
}

Jenkins version is:

 X-Jenkins: 2.59

I have been writing a barebones ruby interface for the last day or so, but REALLY don't want to do that.

I assume something is getting mangled, but can't figure out what it is. Any assistance/advice would be appreciated.

@katelovescode
Copy link
Contributor

Hey @andrew80k - I can't duplicate this locally. Both commands get me the same result, which is listing my jobs. This could be related to the fact that jenkins_api_client right now doesn't fully support the folders plugin by CloudBees. We have some in-progress issues dealing with this and it is planned for future functionality, but I'm not sure when.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants