Invalid cartridge specified with exit_code 109 - openshift

i want to create app with REST API Openshift i do this curl Command with smarterclayton cartridge :
curl -k -X POST https://openshift.redhat.com/broker/rest/domains/jhaopenshift/applications
--user "user#gmail.com:passwd"
--data "name=myapp&cartridge=https://github.com/smarterclayton/openshift-cdk-cart/blob/master/metadata/manifest.yml&scale=false"
but i still have and Invalid Cartridge error :
{
"api_version":1.6,
"data":null,
"messages":[{"exit_code":109,
"field":"cartridge",
"index":null,
"severity":"error",
"text":"Invalid cartridge 'https://github.com/smarterclayton/openshift-cdk-cart/blob/master/metadata/manifest.yml' specified."}],
"status":"unprocessable_entity",
"supported_api_versions":[1.0,1.1,1.2,1.3,1.4,1.5,1.6],
"type":null,"version":"1.6"
}
and with -H 'Accept: application/xml' option i get this :
curl: (6) Could not resolve host: Accept
curl: (6) Could not resolve host: POST
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<html><head>
<title>500 Internal Server Error</title>
</head><body>
<h1>Internal Server Error</h1>
<p>The server encountered an internal error or
misconfiguration and was unable to complete
your request.</p>
<p>Please contact the server administrator,
root#localhost and inform them of the time the error occurred,
and anything you might have done that may have
caused the error.</p>
<p>More information about this error may be available
in the server error log.</p>
<hr>
<address>Apache/2.2.15 (Red Hat) Server at openshift.redhat.com Port 80</address>
</body></html>
any ideas how to fix this error?

This should work:
curl -k -X POST https://openshift.redhat.com/broker/rest/domains/jhaopenshift/applications --user "user:pass" --data "name=myapp&cartridge[url]=https://cartreflect-claytondev.rhcloud.com/reflect?github=smarterclayton/openshift-cdk-cart&scale=false"
You need to supply the [url] after the cartridge parameter, you also need to either point to a manifest.yml file that has the Source-Url element included, or use the cartridge reflector to point to the partial github url with the format user/repo

Related

Curl commands fails when data is send from file

Hi I am sending the data through json file and sending that in curl command using the following command and I am getting following error
curl -k https://localhost:25678/api-name -H "Content-Type:application/json" -X POST --data #test.json
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
<title>500 Internal Server Error</title>
<h1>Internal Server Error</h1>
<p>The server encountered an internal error and was unable to complete your request. Either the server is overloaded or there is an error in the application.</p>
The contents of my file is like this
"{'secret': 'toMwVie86l8qlYG2dEiEmZQldZhiAYW6UDwXRkLLRR3qtoONwsSqhd5fPctTQzGSnlSpZPwb4MheUnLQ4z4wyrCd6jDQb3wqfqE3lDnrNpiQhfEU0qVKdBIDIbIck3WmhRqN9YXNEy/XSnsla6ZAUid5RkAZLOx8Lvg91NmgSog='}"
Could someone please help me if I am doing something wrong

Export contents of the Openshift image to a file

I've been searching for this for a while. I don't have access to the binary items used to build the image because an artifactory migration ruined the repo. There is one particularly precious binary I would love to extract from the image. I know docker save would save me, but I don't have access to docker, only to the oc client.
EDIT:
After looking around a little, thought that docker-registry API should be the way to go. Debugging oc client and logs of the docker-registry pods, found that both v1 and v2 API versions seem to be used.
Somehow cannot get any further than the version check.
Getting the auth token and registry url from oc:
TOKEN=`oc whoami -t`
URL="https://"`oc -n default get route docker-registry -o jsonpath="{.status.ingress[0].host}"
Then getting a correct response to:
curl -k -X GET -H "Authorization: Bearer $TOKEN" "$URL/v2/"
...
HTTP/1.1 200 OK
but:
curl -k -X GET -H "Authorization: Bearer $TOKEN" "$URL/v2/_catalog"
...
HTTP/1.1 400 Bad Request
You can log in to the internal image registry if exposed and then pull the image back down to your local system and do what you want with it. Instructions for logging in can be found in:
http://cookbook.openshift.org/image-registry-and-image-streams/how-do-i-push-an-image-to-the-internal-image-registry.html
That talks about doing a push, but you want to do a pull.

cURL and Error 411 (Content Length)

I'm using cURL to connect to a remote host. Some of my commands execute just fine (like authentication via POST and pulling information via GET). I'm getting a weird error when trying to use a POST to add information with regards to content length. This is my syntax;
curl -k -i -b sessionid -X POST https://hostname/BeyondTrust/api/public/v3/Workgroups/apiTest/Assets?AssetName=string&DnsName=string&DomainName=string -H "Content-Type: application/json" -H "Authorization: PS-Auth key=b8e1...2c27; runas=userName; pwd=[password]" -d ""
This is my output;
[1] 58164
[2] 58165
-bash: -H: command not found
[2]+ Done DnsName=string
HTTP/1.1 411 Length Required
Content-Type: text/html; charset=us-ascii
Server: Microsoft-HTTPAPI/2.0
Date: Fri, 27 Oct 2017 14:29:12 GMT
Connection: close
Content-Length: 344
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
<HTML><HEAD><TITLE>Length Required</TITLE>
<META HTTP-EQUIV="Content-Type" Content="text/html; charset=us-ascii"></HEAD>
<BODY><h2>Length Required</h2>
<hr><p>HTTP Error 411. The request must be chunked or have a content length.</p>
</BODY></HTML>
I've researched it, and this is a common problem, apparently. -d "" does not fix and have tried --ignore-content-length and Content-Length: 0 in the headers, but I still have the same issue. Can someone point me in the right direction?
You need to quote the URL because it contains some special shell characters.
This output tells you something went wrong:
[1] 58164
[2] 58165
-bash: -H: command not found
[2]+ Done DnsName=string
Your command got split into multiple jobs and resulted in some errors because of the & in the URL's query string.
Putting the URL in double-quotes " will fix the issue.
curl -k -i -b sessionid \
-X POST \
"https://hostname/BeyondTrust/api/public/v3/Workgroups/apiTest/Assets?AssetName=string&DnsName=string&DomainName=string"
This way your URL will be interpreted properly and the shell won't try to start it in the background.

HTTP 1.1 400 Unknown version Rest API create defect HPALM

Hi I am trying to create defect from Rest API into HPALM.
I am using following command. I am getting an error:
HTTP/1.1 400 Unknown Version
C:\Adwait>curl -D- -X POST --data-binary #C:\Adwait\HPCreateDefect.json -H "Authorization: Basic RGVtb" -H "Content-Type:application/json" "http://ServerURL:8080/qcbin/rest/domains/DEMO_PURPOSE\/projects/DEMO_01/defects HTTP/1.1" -k
HTTP/1.1 400 Unknown Version
Content-Length: 0
Connection: close
Server: Jetty(9.1.4.v20140401)
#Adwait please check how you write the link above.
Even if suggested in some libraries from HP, you do not have to add the HTTP/1.1 at the end of the link used.
Please check and close the query itself. I had in the beginning same problem creating a python interface for the QC REST API.
Have a nice day!

Wget windows and multiple --header switches

I'm trying to use wget 1.11.4 running on Windows Server 2003 to do some JSON with a web site. I can retrieve info OK but I can't send any. I'm not positive that my JSON is formatted correctly but there seems to be a more fundamental problem.
If I do:
wget --header="Authorization: Bearer <redacted>" --no-check-certificate --post-data="{'workspaces':{'title':'CMC Regulatory Support','creator_role':'maven'}}" https://api.mavenlink.com/api/v1/workspaces.json
I get a JSON error back from the site "ERROR 422: Unprocessable Entity." But if I add another --header:
wget -S --header="Authorization: Bearer <redacted>" -–header="Content-Type: application/json" --no-check-certificate --post-data="{'workspaces':{'title':'CMC Regulatory Support','creator_role':'maven'}}" https://api.mavenlink.com/api/v1/workspaces.json
I get:
SYSTEM_WGETRC = c:/progra~1/wget/etc/wgetrc
syswgetrc = C:\Program Files\GnuWin32/etc/wgetrc
wget: invalid option -- û
Usage: wget [OPTION]... [URL]...
Try `wget --help' for more options.
but the manual clearly states that multiple --header switches are allowed, and I see that swithc used in examples on the web?. WTF?
Your second --header parameter before the Content-Type contains different dashes.
-–header="Content-Type
If you fix it wget will send the request.