Related
{
"status": true,
"error": false,
"data": [
{
"type": 0,
"title": "",
"description": "",
"data": [
{
"images": "/media/banner/Glocart%20Shop/Glocart-Shop_moVB3tP.jpg",
"is_external": true,
"link": "https://www.wikipedia.org/",
"product_id": null,
"offer_list_id": null,
"product_list_id": null
},
{
"images": "/media/banner/Grocery/Grocery_m341Az6.jpg",
"is_external": false,
"link": null,
"product_id": null,
"offer_list_id": 1,
"product_list_id": null
}
]
},
{
"type": 1,
"title": "Categories",
"description": "",
"data": [
{
"category_name": "Beverages",
"category_id": 5,
"category_icon": "/media/category_icon_upload_location/61ho157I07L._SX522__WpWCZ7h.jpg"
},
{
"category_name": "Tea & Coffee",
"category_id": 6,
"category_icon": "/media/category_icon_upload_location/Lipton-Green-Tea-Bags-250-SDL859816919-1-31762.jpg"
},
{
"category_name": "Body Care",
"category_id": 3,
"category_icon": "/media/category_icon_upload_location/nourishing-body-lotion-100ml_1024x1024.png"
},
{
"category_name": "Personal Hygiene",
"category_id": 7,
"category_icon": "/media/category_icon_upload_location/lif0259_2_1.jpg"
},
{
"category_name": "Jams & Preserves",
"category_id": 32,
"category_icon": "/media/category_icon_upload_location/kissan-mixed-fruit-jam-500-gm-164390973-ymzpr.jpg"
},
{
"category_name": "Air Fresheners",
"category_id": 28,
"category_icon": "/media/category_icon_upload_location/Godrej_Aer_Home_Air_Freshener_Spray_Morning_Misty_Meadows__fkCoOzL.jpg"
},
{
"category_name": "Chocolate",
"category_id": 35,
"category_icon": "/media/category_icon_upload_location/71p5hUVC0eL._SX569_.jpg"
},
{
"category_name": "Cosmetics & Makeup",
"category_id": 27,
"category_icon": "/media/category_icon_upload_location/81oA3GcTyRL._SL1500_.jpg"
},
{
"category_name": "Personal care",
"category_id": 26,
"category_icon": "/media/category_icon_upload_location/gillette-guard-3-card-blade-pack_rixer.png"
}
]
},
{
"type": 2,
"title": "Fresh Deals",
"description": "Today's Arrival",
"data": [
{
"product_id": 193,
"image_url": "/media/product_images/61XJQZV8YxL._SX425_.jpg",
"product_name": "UNILEVER KSN PINEAPPLE SQH 750ML-RS.15 PRICE OFF",
"offer_price": 14500,
"normal_price": 15500,
"is_in_cart": false,
"cart_qty": 0
},
{
"product_id": 193,
"image_url": "/media/product_images/61XJQZV8YxL._SX425_.jpg",
"product_name": "UNILEVER KSN PINEAPPLE SQH 750ML-RS.15 PRICE OFF",
"offer_price": 14500,
"normal_price": 15500,
"is_in_cart": false,
"cart_qty": 0
},
{
"product_id": 193,
"image_url": "/media/product_images/61XJQZV8YxL._SX425_.jpg",
"product_name": "UNILEVER KSN PINEAPPLE SQH 750ML-RS.15 PRICE OFF",
"offer_price": 14500,
"normal_price": 15500,
"is_in_cart": false,
"cart_qty": 0
}
]
},
{
"type": 3,
"title": "",
"description": "",
"data": [
{
"images": "/media/banner/Glocart%20Shop/Glocart-Shop_moVB3tP.jpg",
"is_external": true,
"link": "https://www.wikipedia.org/",
"product_id": null,
"offer_list_id": null,
"product_list_id": null
},
{
"images": "/media/banner/Glocart%20Shop/Glocart-Shop_moVB3tP.jpg",
"is_external": true,
"link": "https://www.wikipedia.org/",
"product_id": null,
"offer_list_id": null,
"product_list_id": null
}
]
},
{
"type": 4,
"title": "",
"description": "",
"data": [
{
"images": "/media/banner/Glocart%20Shop/Glocart-Shop_moVB3tP.jpg",
"is_external": true,
"link": null,
"product_id": null,
"offer_list_id": null,
"product_list_id": null
}
]
},
{
"type": 5,
"title": "Discount Range",
"description": "",
"data": [
{
"banner": "/media/product_images/61XJQZV8YxL._SX425_.jpg",
"discount_from": 50,
"discount_to": 60
},
{
"banner": "/media/product_images/61XJQZV8YxL._SX425_.jpg",
"discount_from": 40,
"discount_to": 100
}
]
},
{
"type": 2,
"title": "Top Deals",
"description": "Upto 45% discount",
"data": [
{
"product_id": 193,
"image_url": "/media/product_images/61XJQZV8YxL._SX425_.jpg",
"product_name": "UNILEVER KSN PINEAPPLE SQH 750ML-RS.15 PRICE OFF",
"offer_price": 14500,
"normal_price": 15500,
"is_in_cart": false,
"cart_qty": 0
},
{
"product_id": 193,
"image_url": "/media/product_images/61XJQZV8YxL._SX425_.jpg",
"product_name": "UNILEVER KSN PINEAPPLE SQH 750ML-RS.15 PRICE OFF",
"offer_price": 14500,
"normal_price": 15500,
"is_in_cart": false,
"cart_qty": 0
},
{
"product_id": 193,
"image_url": "/media/product_images/61XJQZV8YxL._SX425_.jpg",
"product_name": "UNILEVER KSN PINEAPPLE SQH 750ML-RS.15 PRICE OFF",
"offer_price": 14500,
"normal_price": 15500,
"is_in_cart": false,
"cart_qty": 0
}
]
},
{
"type": 0,
"title": "",
"description": "",
"data": {
"images": "/media/banner/Glocart%20Shop/Glocart-Shop_moVB3tP.jpg",
"is_external": true,
"link": "https://www.wikipedia.org/",
"product_id": null,
"offer_list_id": null,
"product_list_id": null
}
},
{
"type": 6,
"title": "Suggested for you",
"description": "",
"data": [
{
"product_id": 193,
"image_url": "/media/product_images/61XJQZV8YxL._SX425_.jpg",
"product_name": "UNILEVER KSN PINEAPPLE SQH 750ML-RS.15 PRICE OFF",
"offer_price": 14500,
"normal_price": 15500,
"is_in_cart": false,
"cart_qty": 0
},
{
"product_id": 193,
"image_url": "/media/product_images/61XJQZV8YxL._SX425_.jpg",
"product_name": "UNILEVER KSN PINEAPPLE SQH 750ML-RS.15 PRICE OFF",
"offer_price": 14500,
"normal_price": 15500,
"is_in_cart": false,
"cart_qty": 0
},
{
"product_id": 193,
"image_url": "/media/product_images/61XJQZV8YxL._SX425_.jpg",
"product_name": "UNILEVER KSN PINEAPPLE SQH 750ML-RS.15 PRICE OFF",
"offer_price": 14500,
"normal_price": 15500,
"is_in_cart": false,
"cart_qty": 0
}
]
},
{
"type": 0,
"title": "",
"description": "",
"data": {
"images": "/media/banner/Grocery/Grocery_m341Az6.jpg",
"is_external": false,
"link": null,
"product_id": null,
"offer_list_id": 1,
"product_list_id": null
}
},
{
"type": 7,
"title": "",
"description": "",
"data": [
{
"banner": "/media/product_images/61XJQZV8YxL._SX425_.jpg",
"category_name": "Personal Care",
"category_id": 1,
"have_sub_category": true,
"sub_categories": [
{
"category_name": "Chocolate",
"category_id": 35,
"category_icon": "/media/category_icon_upload_location/71p5hUVC0eL._SX569_.jpg"
},
{
"category_name": "Chocolate",
"category_id": 35,
"category_icon": "/media/category_icon_upload_location/71p5hUVC0eL._SX569_.jpg"
}
]
}
]
},
{
"type": 7,
"title": "",
"description": "",
"data": [
{
"banner": "/media/product_images/61XJQZV8YxL._SX425_.jpg",
"category_name": "Beauty Care",
"category_id": 2,
"have_sub_category": false,
"sub_categories": []
}
]
},
{
"type": 7,
"title": "",
"description": "",
"data": [
{
"banner": "/media/product_images/61XJQZV8YxL._SX425_.jpg",
"category_name": "Home Care",
"category_id": 3,
"have_sub_category": false,
"sub_categories": []
}
]
}
],
"cart_items_count": 5,
"total_cart_price": 30000,
"is_authenticated": true,
"new_notification_count": 1,
"cash_back_msg": "Dummy Cash Back message"
}
I have created one..but shows error
struct Home2Response: Codable {
var status, error: Bool?
var data: [Home2ResponseDatum]?
var cartItemsCount, totalCartPrice: Int?
var isAuthenticated: Bool?
var newNotificationCount: Int?
var cashBackMsg: String?
enum CodingKeys: String, CodingKey {
case status, error, data
case cartItemsCount = "cart_items_count"
case totalCartPrice = "total_cart_price"
case isAuthenticated = "is_authenticated"
case newNotificationCount = "new_notification_count"
case cashBackMsg = "cash_back_msg"
}
}
// MARK: - Home2ResponseDatum
struct Home2ResponseDatum: Codable {
var type: Int?
var title: String?
var datumDescription: String?
var data: [Any]?
enum CodingKeys: String, CodingKey {
case type, title
case datumDescription = "description"
case data
}
}
The name in JSON should match the one in your struct.
Change datumDescription into description.
struct Data : Codable {
let type : Int?
let title : String?
let description : String?
let data : [Data]?
Is it possible to use jsPDF to grab text from a HTML page and jsPDF-autotable to grab the table and to get that all inside one PDF? I have a document which has some content, and tables in the middle of the content. However, I was not able to print that document.
Sample code:
Sample code:enter code here
In the below code I am looping my Content array. Content can be of different types. For the table content am trying to use pdf.autoTable and for the text content am using pdf.text
var pdf = new jspdf('p', 'pt', 'a4');
pdf.setFontSize(18);
pdf.line(20, 25, 25, 25);
for (let i = 0; i < this.dalSectionsArray.length; i++) {
dynamicHtmlSource = dynamicHtmlSource + '<p style="text-align:left;">
<b>' + this.dalSectionsArray[i].title + '</b></p><b/>';
pdf.text(dynamicHtmlSource, 10+i, 10+i);
for (let j = 0; j < this.dalContentsArray.length; j++) {
if (this.dalSectionsArray[i].id ===
this.dalContentsArray[j].sectionView.id) {
if (this.dalContentsArray[j].subType === 'Clause') {
dynamicHtmlSource = this.getClauseData(this.dalContentsArray[j]);
pdf.text(dynamicHtmlSource,20+j,20+j);
} else if (this.dalContentsArray[j].subType === 'Block') {
dynamicHtmlSource = this.getBlockData(this.dalContentsArray[j]);
pdf.text(dynamicHtmlSource,30+j,30+j);
} else if (this.dalContentsArray[j].subType === 'Restriction') {
dynamicHtmlSource =
this.getRestrictionData(this.dalContentsArray[j]);
pdf.text(dynamicHtmlSource, 40+j, 40+j);
} else if (this.dalContentsArray[j].subType === 'Table') {
pdf.autoTable({
startY:50+j,
columnStyles: { europe: { halign: 'center' } }, // European
countries centered
body: this.dalContentsArray[j].tableValues,
columns: this.dalContentsArray[j].displayColumns
})
}
}
pdf.fromHTML('',
this.margins.left, // x coord
this.margins.top,
{
// y coord
width: this.margins.width// max width of content on PDF
}, (dispose) => {
this.headerFooterFormatting(pdf, pdf.internal.getNumberOfPages());
},
this.margins);
var iframe = document.createElement('iframe');
iframe.setAttribute('style', 'position:absolute;right:0; top:0;
bottom:0; height:100%; width:650px; padding:20px;');
document.body.appendChild(iframe);
pdf.setProperties({
title: 'jspdf-iframe',
subject: 'DAL Content',
author: 'PDFAuthor',
keywords: 'generated, javascript, web 2.0, ajax',
creator: 'ABC'
});
iframe.src = pdf.output('datauristring');
Issue is the pdf is completely messed and not printed properly. Can any
one help me in this regard.
Sample JSON:
{
"dalId": "{QQ-4b3544ef-3821-439c-84cf-b6f18c9a86fc-uw}-{1}",
"sections": [
{
"title": "ABC",
"description": "",
"order": "1",
"status": "Active",
"startDate": "2018-12-12T00:00:00",
"endDate": null,
"id": "{b3cdda34-1fd2-4463-9aa0-24beff4b83fe}-{1}",
"_etag": "\"0d0006a2-0000-0c00-0000-5c94e5760000\"",
"partitionKey": "GGG-Section-{b3cdda34-1fd2-4463-9aa0-24beff4b83fe}-{1}",
"type": "Section",
"clientId": "GGG",
"createdBy": "FFFFF",
"createdDate": "2018-11-12T00:00:00",
"modifiedBy": "FFFFF",
"modifiedDate": "2018-11-12T00:00:00",
"isactive": false
},
{
"title": "DEF",
"description": "",
"order": "2",
"status": "Active",
"startDate": "2018-12-12T00:00:00",
"endDate": null,
"id": "{fca09906-dff9-40b2-a971-28fef7f37dbf}-{1}",
"_etag": "\"0d0004a2-0000-0c00-0000-5c94e5760000\"",
"partitionKey": "GGG-Section-{fca09906-dff9-40b2-a971-28fef7f37dbf}-{1}",
"type": "Section",
"clientId": "GGG",
"createdBy": "FFFFF",
"createdDate": "2018-11-12T00:00:00",
"modifiedBy": "FFFFF",
"modifiedDate": "2018-11-12T00:00:00",
"isactive": false
},
{
"title": "GHI",
"description": "",
"order": "3",
"status": "Active",
"startDate": "2018-12-12T00:00:00",
"endDate": null,
"id": "{9cfb60cf-354c-4194-9e2e-6bab41c6b280}-{1}",
"_etag": "\"0d00faa1-0000-0c00-0000-5c94e5750000\"",
"partitionKey": "GGG-Section-{9cfb60cf-354c-4194-9e2e-6bab41c6b280}-{1}",
"type": "Section",
"clientId": "GGG",
"createdBy": "FFFFF",
"createdDate": "2018-11-12T00:00:00",
"modifiedBy": "FFFFF",
"modifiedDate": "2018-11-12T00:00:00",
"isactive": false
}
],
"contents": [
{
"dalId": "{QQ-4b3544ef-3821-439c-84cf-b6f18c9a86fc-uw}-{1}",
"baseDataid": "{a351366f-bf4b-44e0-94ff-a81be899ec3a}-{1}",
"subType": "Table",
"sectionView": {
"id": "{9cfb60cf-354c-4194-9e2e-6bab41c6b280}-{1}",
"title": "AAA",
"description": "",
"order": "4"
},
"title": "PL",
"description": "",
"order": "3",
"status": "Active",
"startDate": "2018-12-12T00:00:00",
"endDate": null,
"displayColumns": [ "N", "M", "O", "P" ],
"tableValues": [
{
"N": "Level 21",
"M": "22",
"O": "",
"P": "",
"isRowEditable": false
},
{
"id": "6cb79b9f-2ef2-4d3a-b6c4-7d84dd61aaf7",
"isDeleted": true,
"N": "KKKKKKK",
"M": "GBP 20M",
"O": "",
"isRowEditable": false
},
{
"id": "c83caf0b-8f00-4dc8-bf35-473bda398937",
"isDeleted": true,
"N": "EP",
"M": "GBP 15M",
"O": "",
"isRowEditable": false
}
],
"placeHolderValues": "",
"organizationDataView": [
{
"id": "{8b958d63-d605-4b9a-a3c4-a3c1c052316e}-{1}",
"orgGroupName": "QQ",
"orgGroupType": "DD",
"orgLevel": 1,
"orgParentGroupId": ""
}
],
"id": "{16a3fb1e-f7fa-4dfe-a4d3-c51b56c8dbee-uw}-{1}",
"_etag": "\"0d00a0ca-0000-0c00-0000-5c94ef3f0000\"",
"partitionKey": "GGG-CCCCOOOOO-{16a3fb1e-f7fa-4dfe-a4d3-c51b56c8dbee-uw}-{1}",
"type": "CCCCOOOOO",
"clientId": "GGG",
"createdBy": "MM",
"createdDate": "2018-12-12T00:00:00",
"modifiedBy": "PPP",
"modifiedDate": null,
"isactive": false
},
{
"dalId": "{QQ-4b3544ef-3821-439c-84cf-b6f18c9a86fc-uw}-{1}",
"baseDataid": "{2b498850-8f11-475d-b170-5705d05c4bf1}-{1}",
"subType": "Clause",
"sectionView": {
"id": "{b3cdda34-1fd2-4463-9aa0-24beff4b83fe}-{1}",
"title": "LLL",
"description": "",
"order": "3"
},
"title": "kkkkk",
"Description": [
{
"type": "label",
"value": "<br/>Some sample text here"
}
],
"order": "6",
"status": "Active",
"startDate": "2018-12-12T00:00:00",
"endDate": null,
"displayColumns": [],
"tableValues": null,
"placeHolderValues": "",
"organizationDataView": [
{
"id": "{8b958d63-d605-4b9a-a3c4-a3c1c052316e}-{1}",
"orgGroupName": "QQ",
"orgGroupType": "DD",
"orgLevel": 1,
"orgParentGroupId": ""
}
],
"id": "{6193cef1-2fe5-47c2-8367-0650ab66caf3-uw}-{1}",
"_etag": "\"0d00a5ca-0000-0c00-0000-5c94ef400000\"",
"partitionKey": "GGG-CCCCOOOOO-{6193cef1-2fe5-47c2-8367-0650ab66caf3-uw}-{1}",
"type": "CCCCOOOOO",
"clientId": "GGG",
"createdBy": "MM",
"createdDate": "2018-12-12T00:00:00",
"modifiedBy": "PPP",
"modifiedDate": null,
"isactive": false
},
{
"dalId": "{QQ-4b3544ef-3821-439c-84cf-b6f18c9a86fc-uw}-{1}",
"baseDataid": "{d6793120-5e5b-40ec-a1ea-e82e7bdc9d1a}-{1}",
"subType": "Clause",
"sectionView": {
"id": "{9cfb60cf-354c-4194-9e2e-6bab41c6b280}-{1}",
"title": "UT",
"description": "Sample Text",
"order": "4"
},
"title": "PR",
"Description": [
{
"type": "label",
"value": "Sample"
},
{
"type": "dropDown",
"value": "USD",
"options": [ "USD", "INR", "Dollar" ]
},
{
"type": "text",
"value": "50"
},
{
"type": "label",
"value": "Sample "
},
{
"type": "dropDown",
"value": "USD",
"options": [ "USD", "INR", "Dollar" ]
},
{
"type": "text",
"value": "50"
},
{
"type": "label",
"value": "Sample"
},
{
"type": "dropDown",
"value": "USD",
"options": [ "USD", "INR", "Dollar" ]
},
{
"type": "text",
"value": "50"
},
{
"type": "label",
"value": "Sample "
},
{
"type": "dropDown",
"value": "USD",
"options": [ "USD", "INR", "Dollar" ]
},
{
"type": "text",
"value": "50"
},
{
"type": "label",
"value": "Sample"
},
{
"type": "dropDown",
"value": "USD",
"options": [ "USD", "INR", "Dollar" ]
},
{
"type": "text",
"value": "50"
},
{
"type": "label",
"value": "any one programme/risk</li><li>a maximum premium of "
},
{
"type": "dropDown",
"value": "USD",
"options": [ "USD", "INR", "Dollar" ]
},
{
"type": "text",
"value": "50"
},
{
"type": "label",
"value": "Sample"
},
{
"type": "dropDown",
"value": "USD",
"options": [ "USD", "INR", "Dollar" ]
},
{
"type": "text",
"value": "50"
},
{
"type": "label",
"value": "<br/>SSample"
},
{
"type": "dropDown",
"value": "USD",
"options": [ "USD", "INR", "Dollar" ]
},
{
"type": "text",
"value": "50"
},
{
"type": "label",
"value": "Sample"
},
{
"type": "dropDown",
"value": "USD",
"options": [ "USD", "INR", "Dollar" ]
},
{
"type": "text",
"value": "50"
},
{
"type": "label",
"value": ".Sample"
},
{
"type": "dropDown",
"value": "USD",
"options": [ "USD", "INR", "Dollar" ]
},
{
"type": "text",
"value": "50"
},
{
"type": "label",
"value": ", on Lloyd's paper, in respect of Canadian domiciled Property risks<br/>Your authority for Health extends to unlimited Healthcare where required by statute<br/>You may accept up to "
},
{
"type": "dropDown",
"value": "USD",
"options": [ "USD", "INR", "Dollar" ]
},
{
"type": "text",
"value": "50"
},
{
"type": "label",
"value": ", on Lloyd's paper, in respect of declarations under the Coast P&I Facility<br/>You may accept up to "
},
{
"type": "dropDown",
"value": "USD",
"options": [ "USD", "INR", "Dollar" ]
},
{
"type": "text",
"value": "50"
},
{
"type": "label",
"value": ", on Lloyd's paper, in respect of combined primary and excess grounding liability<br/>"
}
],
"order": "6",
"status": "Active",
"startDate": "2018-12-12T00:00:00",
"endDate": null,
"displayColumns": [],
"tableValues": null,
"placeHolderValues": "",
"organizationDataView": [
{
"id": "{8b958d63-d605-4b9a-a3c4-a3c1c052316e}-{1}",
"orgGroupName": "QQ",
"orgGroupType": "DD",
"orgLevel": 1,
"orgParentGroupId": ""
}
],
"id": "{22505164-4d56-493e-8df2-b1bb53ab419a-uw}-{1}",
"_etag": "\"0d00acca-0000-0c00-0000-5c94ef400000\"",
"partitionKey": "GGG-CCCCOOOOO-{22505164-4d56-493e-8df2-b1bb53ab419a-uw}-{1}",
"type": "CCCCOOOOO",
"clientId": "GGG",
"createdBy": "MM",
"createdDate": "2018-12-12T00:00:00",
"modifiedBy": "PPP",
"modifiedDate": null,
"isactive": false
},
{
"dalId": "{QQ-4b3544ef-3821-439c-84cf-b6f18c9a86fc-uw}-{1}",
"baseDataid": "{ac949799-60c7-4f85-840f-f30203c5ee43}-{1}",
"subType": "Block",
"sectionView": {
"id": "{fca09906-dff9-40b2-a971-28fef7f37dbf}-{1}",
"title": "GR",
"description": "",
"order": "2"
},
"title": "",
"description": "Sample",
"order": "1",
"status": "Active",
"startDate": "2018-12-12T00:00:00",
"endDate": null,
"displayColumns": [],
"tableValues": null,
"placeHolderValues": "",
"organizationDataView": [
{
"id": "{8b958d63-d605-4b9a-a3c4-a3c1c052316e}-{1}",
"orgGroupName": "QQ",
"orgGroupType": "DD",
"orgLevel": 1,
"orgParentGroupId": ""
}
],
"id": "{8652fedc-0d7c-48d8-bc3f-577294551671-uw}-{1}",
"_etag": "\"0d00baca-0000-0c00-0000-5c94ef400000\"",
"partitionKey": "GGG-CCCCOOOOO-{8652fedc-0d7c-48d8-bc3f-577294551671-uw}-{1}",
"type": "CCCCOOOOO",
"clientId": "GGG",
"createdBy": "MM",
"createdDate": "2018-12-12T00:00:00",
"modifiedBy": "PPP",
"modifiedDate": null,
"isactive": false
},
{
"dalId": "{QQ-4b3544ef-3821-439c-84cf-b6f18c9a86fc-uw}-{1}",
"baseDataid": "{522f1248-0882-4348-9bba-59c056c816c8}-{1}",
"subType": "Clause",
"sectionView": {
"id": "{b3cdda34-1fd2-4463-9aa0-24beff4b83fe}-{1}",
"title": "LLL",
"description": "",
"order": "3"
},
"title": "UP",
"Description": [
{
"type": "label",
"value": "Sample"
}
],
"order": "1",
"status": "Active",
"startDate": "2018-12-12T00:00:00",
"endDate": null,
"displayColumns": [],
"tableValues": null,
"placeHolderValues": "",
"organizationDataView": [
{
"id": "{8b958d63-d605-4b9a-a3c4-a3c1c052316e}-{1}",
"orgGroupName": "QQ",
"orgGroupType": "DD",
"orgLevel": 1,
"orgParentGroupId": ""
}
],
"id": "{944eae3d-fa0f-4b0e-9c66-3499a16fc2fd-uw}-{1}",
"_etag": "\"0d00bfca-0000-0c00-0000-5c94ef400000\"",
"partitionKey": "GGG-CCCCOOOOO-{944eae3d-fa0f-4b0e-9c66-3499a16fc2fd-uw}-{1}",
"type": "CCCCOOOOO",
"clientId": "GGG",
"createdBy": "MM",
"createdDate": "2018-12-12T00:00:00",
"modifiedBy": "PPP",
"modifiedDate": null,
"isactive": false
},
{
"dalId": "{QQ-4b3544ef-3821-439c-84cf-b6f18c9a86fc-uw}-{1}",
"baseDataid": "{6c6a3c80-3536-4c51-8ccf-fcdc16d94090}-{1}",
"subType": "Table",
"sectionView": {
"id": "{9cfb60cf-354c-4194-9e2e-6bab41c6b280}-{1}",
"title": "KKPKPKPK",
"description": "",
"order": "4"
},
"title": "PT",
"description": "",
"order": "4",
"status": "Active",
"startDate": "2018-12-12T00:00:00",
"endDate": null,
"displayColumns": [ ".", "KKKKKKK", "EP", "P" ],
"tableValues": [
{
".": "Level 11",
"KKKKKKK": "",
"EP": "Level 21",
"P": "",
"isRowEditable": false
},
{
".": "Asbestos - other than licensed removers",
"KKKKKKK": "GBP 5M",
"EP": ".",
"isRowEditable": false
},
{
".": "Auto manufacturing - safety critical components",
"KKKKKKK": "GBP 10M",
"EP": ".",
"isRowEditable": false
},
{
".": "Rail - contracting companies",
"KKKKKKK": "GBP 5M",
"EP": ".",
"isRowEditable": false
},
{
".": "Asbestos - other than licensed removers",
"KKKKKKK": ".",
"EP": "GBP 10M",
"isRowEditable": false
},
{
".": "Rail - contracting companies",
"KKKKKKK": ".",
"EP": "GBP 10M",
"isRowEditable": false
}
],
"placeHolderValues": "",
"organizationDataView": [
{
"id": "{8b958d63-d605-4b9a-a3c4-a3c1c052316e}-{1}",
"orgGroupName": "QQ",
"orgGroupType": "DD",
"orgLevel": 1,
"orgParentGroupId": "."
}
],
"id": "{91de8a0b-4156-4121-be05-844b03928c29-uw}-{1}",
"_etag": "\"0d00c5ca-0000-0c00-0000-5c94ef410000\"",
"partitionKey": "GGG-CCCCOOOOO-{91de8a0b-4156-4121-be05-844b03928c29-uw}-{1}",
"type": "CCCCOOOOO",
"clientId": "GGG",
"createdBy": "MM",
"createdDate": "2018-12-12T00:00:00",
"modifiedBy": "PPP",
"modifiedDate": null,
"isactive": false
},
{
"dalId": "{QQ-4b3544ef-3821-439c-84cf-b6f18c9a86fc-uw}-{1}",
"baseDataid": "{92860693-e038-4a58-814c-6a74d59e7cce}-{1}",
"subType": "Clause",
"sectionView": {
"id": "{9cfb60cf-354c-4194-9e2e-6bab41c6b280}-{1}",
"title": "KKPKPKPK",
"description": "",
"order": "4"
},
"title": "",
"Description": [
{
"type": "label",
"value": "Sample"
}
],
"order": "9",
"status": "Active",
"startDate": "2018-12-12T00:00:00",
"endDate": null,
"displayColumns": [],
"tableValues": null,
"placeHolderValues": "",
"organizationDataView": [
{
"id": "{8b958d63-d605-4b9a-a3c4-a3c1c052316e}-{1}",
"orgGroupName": "QQ",
"orgGroupType": "DD",
"orgLevel": 1,
"orgParentGroupId": ""
}
],
"id": "{af17341e-a88c-4564-8296-c513e3708af2-uw-per}-{1}",
"_etag": "\"0d00e3ca-0000-0c00-0000-5c94ef420000\"",
"partitionKey": "GGG-CCCCOOOOO-{af17341e-a88c-4564-8296-c513e3708af2-uw-per}-{1}",
"type": "CCCCOOOOO",
"clientId": "GGG",
"createdBy": "MM",
"createdDate": "2018-12-12T00:00:00",
"modifiedBy": "PPP",
"modifiedDate": null,
"isactive": false
},
{
"dalId": "{QQ-4b3544ef-3821-439c-84cf-b6f18c9a86fc-uw}-{1}",
"baseDataid": "{92860693-e038-4a58-814c-6a74d59e7cce}-{1}",
"subType": "Clause",
"sectionView": {
"id": "{9cfb60cf-354c-4194-9e2e-6bab41c6b280}-{1}",
"title": "KKPKPKPK",
"description": "",
"order": "4"
},
"title": "PL",
"Description": [
{
"type": "label",
"value": "Sample"
}
],
"order": "7",
"status": "Active",
"startDate": "2018-12-12T00:00:00",
"endDate": null,
"displayColumns": [],
"tableValues": null,
"placeHolderValues": "",
"organizationDataView": [
{
"id": "{8b958d63-d605-4b9a-a3c4-a3c1c052316e}-{1}",
"orgGroupName": "QQ",
"orgGroupType": "DD",
"orgLevel": 1,
"orgParentGroupId": ""
}
],
"id": "{af17341e-a88c-4564-8296-c513e3708af2-uw}-{1}",
"_etag": "\"0d00e8ca-0000-0c00-0000-5c94ef420000\"",
"partitionKey": "GGG-CCCCOOOOO-{af17341e-a88c-4564-8296-c513e3708af2-uw}-{1}",
"type": "CCCCOOOOO",
"clientId": "GGG",
"createdBy": "MM",
"createdDate": "2018-12-12T00:00:00",
"modifiedBy": "PPP",
"modifiedDate": null,
"isactive": false
},
{
"dalId": "{QQ-4b3544ef-3821-439c-84cf-b6f18c9a86fc-uw}-{1}",
"baseDataid": "{92c5bd05-c8a2-45c1-a1e9-fd3f78c705ab}-{1}",
"subType": "Table",
"sectionView": {
"id": "{9cfb60cf-354c-4194-9e2e-6bab41c6b280}-{1}",
"title": "KKPKPKPK",
"description": "",
"order": "4"
},
"title": "KKPKPKPK PP",
"description": "",
"order": "1",
"status": "Active",
"startDate": "2018-12-12T00:00:00",
"endDate": null,
"displayColumns": [ "N", "kkk", "LPLPLPL", "Ccy", "M", "LTLT", "P" ],
"tableValues": [
{
"N": "Level 11",
"kkk": "",
"LPLPLPL": "",
"Ccy": "",
"M": "",
"LTLT": "",
"P": "",
"isRowEditable": false
},
{
"N": "Level 11",
"kkk": "",
"LPLPLPL": "",
"Ccy": "",
"M": "11",
"LTLT": "",
"P": "",
"isRowEditable": false
},
{
"N": "QQQl",
"kkk": "QQQQ",
"LPLPLPL": "DDDD",
"Ccy": "GBP",
"M": "10M",
"LTLT": "Any one vessel",
"isRowEditable": false
},
{
"N": "Marine Cargo",
"kkk": "QIEL",
"LPLPLPL": "Lineslip and other non-coverholder facilities",
"Ccy": "GBP",
"M": "5M",
"LTLT": "Any one event",
"isRowEditable": false
},
{
"N": "KKKK",
"kkk": "PPPP",
"LPLPLPL": "DDDD",
"Ccy": "GBP",
"M": "20M",
"LTLT": "Any one vessel",
"isRowEditable": false
}
],
"placeHolderValues": "",
"organizationDataView": [
{
"id": "{8b958d63-d605-4b9a-a3c4-a3c1c052316e}-{1}",
"orgGroupName": "QQ",
"orgGroupType": "DD",
"orgLevel": 1,
"orgParentGroupId": ""
}
],
"id": "{d036bc60-db2d-4c93-86ff-981a62e207ca-uw}-{1}",
"_etag": "\"0d00eacb-0000-0c00-0000-5c94ef530000\"",
"partitionKey": "GGG-CCCCOOOOO-{d036bc60-db2d-4c93-86ff-981a62e207ca-uw}-{1}",
"type": "CCCCOOOOO",
"clientId": "GGG",
"createdBy": "MM",
"createdDate": "2018-12-12T00:00:00",
"modifiedBy": "PPP",
"modifiedDate": null,
"isactive": false
},
{
"dalId": "{QQ-4b3544ef-3821-439c-84cf-b6f18c9a86fc-uw}-{1}",
"baseDataid": "{bf1f6e82-6afd-4837-81ab-acabc665da14}-{1}",
"subType": "Clause",
"sectionView": {
"id": "{b3cdda34-1fd2-4463-9aa0-24beff4b83fe}-{1}",
"title": "LLL",
"description": "",
"order": "3"
},
"title": "klklkl",
"Description": [
{
"type": "label",
"value": "sAMPLE tEXT"
}
],
"order": "4",
"status": "Active",
"startDate": "2018-12-12T00:00:00",
"endDate": null,
"displayColumns": [],
"tableValues": null,
"placeHolderValues": "",
"organizationDataView": [
{
"id": "{8b958d63-d605-4b9a-a3c4-a3c1c052316e}-{1}",
"orgGroupName": "QQ",
"orgGroupType": "DD",
"orgLevel": 1,
"orgParentGroupId": ""
}
],
"id": "{QQ-851f96e7-542f-4a57-a0b1-35feb4698f5e-uw}-{1}",
"_etag": "\"0d0062cc-0000-0c00-0000-5c94ef5a0000\"",
"partitionKey": "GGG-CCCCOOOOO-{QQ-851f96e7-542f-4a57-a0b1-35feb4698f5e-uw}-{1}",
"type": "CCCCOOOOO",
"clientId": "GGG",
"createdBy": "MM",
"createdDate": "2018-12-12T00:00:00",
"modifiedBy": "PPP",
"modifiedDate": null,
"isactive": false
}
]
}
getClauseData(dalContentdata) {
let dynamicClauseHtmlSource = '<h4>' + dalContentdata.title + '</h4>';
dynamicClauseHtmlSource = dynamicClauseHtmlSource + '<p></p>';
dynamicClauseHtmlSource = dynamicClauseHtmlSource + + '<p style="text-align:justify;line-height:0.3em">' + dalContentdata.description + '</p>';
dynamicClauseHtmlSource = this.brToNewLine(dynamicClauseHtmlSource);
return dynamicClauseHtmlSource;
}
getBlockData(dalContentdata) {
let dynamicBlockHtmlSource = '<h4>' + dalContentdata.title + '</h4>';
dynamicBlockHtmlSource = dynamicBlockHtmlSource + '<p></p>';
dynamicBlockHtmlSource = dynamicBlockHtmlSource + dalContentdata.description;
dynamicBlockHtmlSource = this.brToNewLine(dynamicBlockHtmlSource);
return dynamicBlockHtmlSource;
}
getTableData(dalContentdata) {
let tableSource = "<table>";
tableSource = tableSource + "<tr>";
for (var k = 0; k < dalContentdata.displayColumns.length; k++) {
tableSource = tableSource + "<th style='word-wrap: break-word'>" + dalContentdata.displayColumns[k] + "</th>";
}
tableSource = tableSource + "</tr>";
for (var j = 0; j < dalContentdata.tableValues.length; j++) {
tableSource = tableSource + "<tr>";
for (var k = 0; k < dalContentdata.displayColumns.length; k++) {
tableSource = tableSource + "<td style='word-wrap: break-word'>" + dalContentdata.tableValues[0][dalContentdata.displayColumns[k]] + "</td>";
}
tableSource = tableSource + "</tr>";
}
tableSource = tableSource + "</table>";
return tableSource;
}
brToNewLine(str) {
return str.replace(/<br ?\/?>/g, "\n");
}
I installed openstack magnum (ocata release) on docker in my controller node because I have installed newton on my host machines and newton binaries did not install correctly but now when I try to run magnum-service list command the output is:
ERROR: 'NoneType' object has no attribute 'replace' (HTTP 500) (Request-ID: req-c5c279c2-9bc1-4672-90d3-410107880a4e)
magnum --debug service-list:
DEBUG (extension:180) found extension EntryPoint.parse('token_endpoint = openstackclient.api.auth_plugin:TokenEndpoint')
DEBUG (extension:180) found extension EntryPoint.parse('v2token = keystoneauth1.loading._plugins.identity.v2:Token')
DEBUG (extension:180) found extension EntryPoint.parse('v3oauth1 = keystoneauth1.extras.oauth1._loading:V3OAuth1')
DEBUG (extension:180) found extension EntryPoint.parse('admin_token = keystoneauth1.loading._plugins.admin_token:AdminToken')
DEBUG (extension:180) found extension EntryPoint.parse('v3oidcauthcode = keystoneauth1.loading._plugins.identity.v3:OpenIDConnectAuthorizationCode')
DEBUG (extension:180) found extension EntryPoint.parse('v2password = keystoneauth1.loading._plugins.identity.v2:Password')
DEBUG (extension:180) found extension EntryPoint.parse('v3samlpassword = keystoneauth1.extras._saml2._loading:Saml2Password')
DEBUG (extension:180) found extension EntryPoint.parse('v3password = keystoneauth1.loading._plugins.identity.v3:Password')
DEBUG (extension:180) found extension EntryPoint.parse('v3oidcaccesstoken = keystoneauth1.loading._plugins.identity.v3:OpenIDConnectAccessToken')
DEBUG (extension:180) found extension EntryPoint.parse('v3oidcpassword = keystoneauth1.loading._plugins.identity.v3:OpenIDConnectPassword')
DEBUG (extension:180) found extension EntryPoint.parse('v3kerberos = keystoneauth1.extras.kerberos._loading:Kerberos')
DEBUG (extension:180) found extension EntryPoint.parse('token = keystoneauth1.loading._plugins.identity.generic:Token')
DEBUG (extension:180) found extension EntryPoint.parse('v3oidcclientcredentials = keystoneauth1.loading._plugins.identity.v3:OpenIDConnectClientCredentials')
DEBUG (extension:180) found extension EntryPoint.parse('v3tokenlessauth = keystoneauth1.loading._plugins.identity.v3:TokenlessAuth')
DEBUG (extension:180) found extension EntryPoint.parse('v3token = keystoneauth1.loading._plugins.identity.v3:Token')
DEBUG (extension:180) found extension EntryPoint.parse('v3totp = keystoneauth1.loading._plugins.identity.v3:TOTP')
DEBUG (extension:180) found extension EntryPoint.parse('password = keystoneauth1.loading._plugins.identity.generic:Password')
DEBUG (extension:180) found extension EntryPoint.parse('v3fedkerb = keystoneauth1.extras.kerberos._loading:MappedKerberos')
DEBUG (extension:180) found extension EntryPoint.parse('aodh-noauth = aodhclient.noauth:AodhNoAuthLoader')
DEBUG (session:337) REQ: curl -g -i -X GET http://controller:35357/v3 -H "Accept: application/json" -H "User-Agent: magnum keystoneauth1/2.12.1 python-requests/2.10.0 CPython/2.7.12"
INFO (connectionpool:213) Starting new HTTP connection (1): controller
DEBUG (connectionpool:395) "GET /v3 HTTP/1.1" 200 250
DEBUG (session:366) RESP: [200] Date: Mon, 24 Sep 2018 06:56:28 GMT Server: Apache/2.4.18 (Ubuntu) Vary: X-Auth-Token X-Distribution: Ubuntu x-openstack-request-id: req-58453c24-09de-44e2-a2c5-b37a99e4e310 Content-Length: 250 Content-Type: application/json
RESP BODY: {"version": {"status": "stable", "updated": "2016-10-06T00:00:00Z", "media-types": [{"base": "application/json", "type": "application/vnd.openstack.identity-v3+json"}], "id": "v3.7", "links": [{"href": "http://controller:35357/v3/", "rel": "self"}]}}
DEBUG (base:165) Making authentication request to http://controller:35357/v3/auth/tokens
DEBUG (connectionpool:395) "POST /v3/auth/tokens HTTP/1.1" 201 6941
DEBUG (base:170) {"token": {"is_domain": false, "methods": ["password"], "roles": [{"id": "8ef21622b17946e5b1a18957131f648a", "name": "admin"}, {"id": "502cd9efebb04bd3827640b146723e93", "name": "user"}], "expires_at": "2018-09-24T07:56:28.000000Z", "project": {"domain": {"id": "default", "name": "Default"}, "id": "7f5b52b3f61a4f71a00fc3f6c6d9232c", "name": "admin"}, "catalog": [{"endpoints": [{"url": "http://controller:9696", "interface": "admin", "region": "Tehran", "region_id": "Tehran", "id": "2b096a1f466240578bd176ac3d0afaf6"}, {"url": "http://controller:9696", "interface": "internal", "region": "Tehran", "region_id": "Tehran", "id": "d26d991f09664b539a81bcfe4d2db213"}, {"url": "http://controller:9696", "interface": "public", "region": "Tehran", "region_id": "Tehran", "id": "d5fe08da089543c19a3c4fe11eb3d05b"}], "type": "network", "id": "1ac84ac88f684c20a6a62c75a4090f18", "name": "neutron"}, {"endpoints": [{"url": "http://controller:9292", "interface": "internal", "region": "Tehran", "region_id": "Tehran", "id": "8c13fb4c3ac54d1aa2c5697c1e17f838"}, {"url": "http://controller:9292", "interface": "public", "region": "Tehran", "region_id": "Tehran", "id": "b940e0047549462e9772f8cd1262d605"}, {"url": "http://controller:9292", "interface": "admin", "region": "Tehran", "region_id": "Tehran", "id": "ec0db283a74a4127b459d1d182f92749"}], "type": "image", "id": "218a33dc6be14a738d24d5d5d9e4ee8a", "name": "glance"}, {"endpoints": [{"url": "http://controller:8004/v1/7f5b52b3f61a4f71a00fc3f6c6d9232c", "interface": "internal", "region": "Tehran", "region_id": "Tehran", "id": "6faf56074d164ef597736f45951d6ffd"}, {"url": "http://controller:8004/v1/7f5b52b3f61a4f71a00fc3f6c6d9232c", "interface": "public", "region": "Tehran", "region_id": "Tehran", "id": "b91e7ed746c44ee3ae506372ff37caab"}, {"url": "http://controller:8004/v1/7f5b52b3f61a4f71a00fc3f6c6d9232c", "interface": "admin", "region": "Tehran", "region_id": "Tehran", "id": "ea71e861cf0740d48ffa1e3b52f19208"}], "type": "orchestration", "id": "2a3cc821104347f8a50400d2baaff43d", "name": "heat"}, {"endpoints": [{"url": "http://controller:8777", "interface": "internal", "region": "Tehran", "region_id": "Tehran", "id": "96ce47ce1afe4c66aba00e1703ed0eb0"}, {"url": "http://controller:8777", "interface": "public", "region": "Tehran", "region_id": "Tehran", "id": "bc53b46ed0134a169a0b4a0e9e721046"}, {"url": "http://controller:8777", "interface": "admin", "region": "Tehran", "region_id": "Tehran", "id": "c6cfb1d3e2d14d8e9856ddf1e3f4832a"}], "type": "metering", "id": "3bab377c64c5438090d82d32ac404872", "name": "ceilometer"}, {"endpoints": [{"url": "http://controller:5000/v3/", "interface": "public", "region": "Tehran", "region_id": "Tehran", "id": "30203075b93d44b88d40a4d3431fb447"}, {"url": "http://controller:35357/v3/", "interface": "internal", "region": "Tehran", "region_id": "Tehran", "id": "fd67bc46db2049539f36afd36f1e79e2"}, {"url": "http://controller:35357/v3/", "interface": "admin", "region": "Tehran", "region_id": "Tehran", "id": "fecf5cafcae54d04a76f236e8bb9c3d6"}], "type": "identity", "id": "69c3e22db5ca4925a470c8dbf3ca78a1", "name": "keystone"}, {"endpoints": [{"url": "http://controller:8774/v2.1/7f5b52b3f61a4f71a00fc3f6c6d9232c", "interface": "public", "region": "Tehran", "region_id": "Tehran", "id": "07a0ce9b8c524340af077317008da39b"}, {"url": "http://controller:8774/v2.1/7f5b52b3f61a4f71a00fc3f6c6d9232c", "interface": "admin", "region": "Tehran", "region_id": "Tehran", "id": "1a04d3e1a5734cba846dfd93c32665e0"}, {"url": "http://controller:8774/v2.1/7f5b52b3f61a4f71a00fc3f6c6d9232c", "interface": "internal", "region": "Tehran", "region_id": "Tehran", "id": "4fc391d188794fa0b28f6d14e636deae"}], "type": "compute", "id": "a606e06af40f4faa9ca3b18b3eeafb51", "name": "nova"}, {"endpoints": [{"url": "http://controller:8080/v1/AUTH_7f5b52b3f61a4f71a00fc3f6c6d9232c", "interface": "internal", "region": "Tehran", "region_id": "Tehran", "id": "2ab7e3b493c1465dad6c5b485b02ceb5"}, {"url": "http://controller:8080/v1/AUTH_7f5b52b3f61a4f71a00fc3f6c6d9232c", "interface": "public", "region": "Tehran", "region_id": "Tehran", "id": "78f3fd8aa58e411595581a8d8768bd7c"}, {"url": "http://controller:8080/v1", "interface": "admin", "region": "Tehran", "region_id": "Tehran", "id": "e8e2dd4e3c434379bc44d4f784c6d0de"}], "type": "object-store", "id": "aa3a3ddfa0024966a574b27ec2af06d7", "name": "swift"}, {"endpoints": [{"url": "http://controller:8776/v1/7f5b52b3f61a4f71a00fc3f6c6d9232c", "interface": "internal", "region": "Tehran", "region_id": "Tehran", "id": "6291788f2d0d407a95295e040df06674"}, {"url": "http://controller:8776/v1/7f5b52b3f61a4f71a00fc3f6c6d9232c", "interface": "public", "region": "Tehran", "region_id": "Tehran", "id": "97195ab376c34550b37d8da4fa2b172a"}, {"url": "http://controller:8776/v1/7f5b52b3f61a4f71a00fc3f6c6d9232c", "interface": "admin", "region": "Tehran", "region_id": "Tehran", "id": "dc88538325e246a3a3906c9a25e8948c"}], "type": "volume", "id": "be28bf09d9ef44f48d9badfe133ed97f", "name": "cinder"}, {"endpoints": [{"url": "http://controller:8776/v2/7f5b52b3f61a4f71a00fc3f6c6d9232c", "interface": "admin", "region": "Tehran", "region_id": "Tehran", "id": "757361dea28c4b8787c6c40301313482"}, {"url": "http://controller:8776/v2/7f5b52b3f61a4f71a00fc3f6c6d9232c", "interface": "public", "region": "Tehran", "region_id": "Tehran", "id": "b3475927386e4859aed918173b4f5dce"}, {"url": "http://controller:8776/v2/7f5b52b3f61a4f71a00fc3f6c6d9232c", "interface": "internal", "region": "Tehran", "region_id": "Tehran", "id": "db0b1c2a81c64a46a043ab48f8d666c2"}], "type": "volumev2", "id": "e14b62f9ab7146779883fc0c31f4e696", "name": "cinderv2"}, {"endpoints": [{"url": "http://controller:8000/v1", "interface": "admin", "region": "Tehran", "region_id": "Tehran", "id": "2629cb834728483480a7af73f9870645"}, {"url": "http://controller:8000/v1", "interface": "internal", "region": "Tehran", "region_id": "Tehran", "id": "5102fdb2b836407ea1bc5e7878a0f041"}, {"url": "http://controller:8000/v1", "interface": "public", "region": "Tehran", "region_id": "Tehran", "id": "7db9e6882c874546a0e0750f27998da9"}], "type": "cloudformation", "id": "f40a43a7c7094922b2336eb6fb2bbf2c", "name": "heat-cfn"}, {"endpoints": [{"url": "http://controller:9511/v1", "interface": "internal", "region": "Tehran", "region_id": "Tehran", "id": "0b1528bbe71d4b95848c93ba3246abcc"}, {"url": "http://controller:9511/v1", "interface": "admin", "region": "Tehran", "region_id": "Tehran", "id": "9b72490da74b44058d1f10290163ff34"}, {"url": "http://controller:9511/v1", "interface": "public", "region": "Tehran", "region_id": "Tehran", "id": "d131ce5383964b91990cf4989de08c35"}], "type": "container-infra", "id": "fbb700c7298741faaf9c8d3a60810908", "name": "magnum"}], "user": {"domain": {"id": "default", "name": "Default"}, "id": "0f48db6ef8ee4d0c86ffe747579fe78c", "name": "admin"}, "audit_ids": ["bhw-Dp3wTHqad34x4JVd1w"], "issued_at": "2018-09-24T06:56:28.000000Z"}}
DEBUG (session:337) REQ: curl -g -i -X GET http://controller:9511/v1/mservices -H "OpenStack-API-Version: container-infra latest" -H "X-Auth-Token: {SHA1}6fdfd1c001c639c7476888a9fdd9d72ecfc2c7ae" -H "Content-Type: application/json" -H "Accept: application/json" -H "User-Agent: None"
INFO (connectionpool:213) Starting new HTTP connection (1): controller
DEBUG (connectionpool:395) "GET /v1/mservices HTTP/1.1" 500 193
DEBUG (session:366) RESP: [500] OpenStack-API-Minimum-Version: container-infra 1.1 OpenStack-API-Maximum-Version: container-infra 1.6 OpenStack-API-Version: container-infra 1.6 vary: OpenStack-API-Version Content-Type: application/json Content-Length: 193 x-openstack-request-id: req-0a9e24cb-9c08-4620-96e4-1e844fac98bd Server: Werkzeug/0.14.1 Python/2.7.12 Date: Mon, 24 Sep 2018 06:56:29 GMT
RESP BODY: {"errors": [{"status": 500, "code": "server", "links": [], "title": "'NoneType' object has no attribute 'replace'", "detail": "'NoneType' object has no attribute 'replace'", "request_id": ""}]}
DEBUG (shell:694) 'NoneType' object has no attribute 'replace' (HTTP 500) (Request-ID: req-0a9e24cb-9c08-4620-96e4-1e844fac98bd)
Traceback (most recent call last):
File "/usr/lib/python2.7/dist-packages/magnumclient/shell.py", line 691, in main
OpenStackMagnumShell().main(map(encodeutils.safe_decode, sys.argv[1:]))
File "/usr/lib/python2.7/dist-packages/magnumclient/shell.py", line 633, in main
args.func(self.cs, args)
File "/usr/lib/python2.7/dist-packages/magnumclient/v1/mservices_shell.py", line 22, in do_service_list
mservices = cs.mservices.list()
File "/usr/lib/python2.7/dist-packages/magnumclient/v1/mservices.py", line 68, in list
return self._list(self._path(path), "mservices")
File "/usr/lib/python2.7/dist-packages/magnumclient/common/base.py", line 121, in _list
resp, body = self.api.json_request('GET', url)
File "/usr/lib/python2.7/dist-packages/magnumclient/common/httpclient.py", line 366, in json_request
resp = self._http_request(url, method, **kwargs)
File "/usr/lib/python2.7/dist-packages/magnumclient/common/httpclient.py", line 350, in _http_request
error_json.get('debuginfo'), method, url)
InternalServerError: 'NoneType' object has no attribute 'replace' (HTTP 500) (Request-ID: req-0a9e24cb-9c08-4620-96e4-1e844fac98bd)
ERROR: 'NoneType' object has no attribute 'replace' (HTTP 500) (Request-ID: req-0a9e24cb-9c08-4620-96e4-1e844fac98bd)
now magnum-api log is:
Sep 24 14:21:37 C32 keystone-wsgi-admin[26838]: 2018-09-24 14:21:37.107 26838 INFO keystone.common.wsgi [req-6dca8e34-ab31-4b84-b403-8a6972886ce4
Sep 24 14:21:37 C32 magnum-api[17373]: 2018-09-24 14:21:37.329 11738 ERROR wsme.api [req-e1c16795-4ebe-4960-92ac-ca81513e2e2f - - - - -] Server-si
Sep 24 14:21:37 C32 magnum-api[17373]: Traceback (most recent call last):
Sep 24 14:21:37 C32 magnum-api[17373]: File "/var/lib/magnum/env/local/lib/python2.7/site-packages/wsmeext/pecan.py", line 85, in callfunction
Sep 24 14:21:37 C32 magnum-api[17373]: result = f(self, *args, **kwargs)
Sep 24 14:21:37 C32 magnum-api[17373]: File "<decorator-gen-28>", line 2, in get_all
Sep 24 14:21:37 C32 magnum-api[17373]: File "/var/lib/magnum/env/local/lib/python2.7/site-packages/magnum/common/policy.py", line 130, in wrappe
Sep 24 14:21:37 C32 magnum-api[17373]: exc=exception.PolicyNotAuthorized, action=action)
Sep 24 14:21:37 C32 magnum-api[17373]: File "/var/lib/magnum/env/local/lib/python2.7/site-packages/magnum/common/policy.py", line 97, in enforce
Sep 24 14:21:37 C32 magnum-api[17373]: add_policy_attributes(target)
Sep 24 14:21:37 C32 magnum-api[17373]: File "/var/lib/magnum/env/local/lib/python2.7/site-packages/magnum/common/policy.py", line 106, in add_po
Sep 24 14:21:37 C32 magnum-api[17373]: trustee_domain_id = admin_osc.keystone().trustee_domain_id
Sep 24 14:21:37 C32 magnum-api[17373]: File "/var/lib/magnum/env/local/lib/python2.7/site-packages/magnum/common/keystone.py", line 182, in trus
Sep 24 14:21:37 C32 magnum-api[17373]: access = self.domain_admin_auth.get_access(
Sep 24 14:21:37 C32 magnum-api[17373]: File "/var/lib/magnum/env/local/lib/python2.7/site-packages/magnum/common/keystone.py", line 148, in doma
Sep 24 14:21:37 C32 magnum-api[17373]: auth_url=self.auth_url,
Sep 24 14:21:37 C32 magnum-api[17373]: File "/var/lib/magnum/env/local/lib/python2.7/site-packages/magnum/common/keystone.py", line 49, in auth_
Sep 24 14:21:37 C32 magnum-api[17373]: return CONF[ksconf.CFG_LEGACY_GROUP].auth_uri.replace('v2.0', 'v3')
Sep 24 14:21:37 C32 magnum-api[17373]: AttributeError: 'NoneType' object has no attribute 'replace'
It looks like you are missing auth_uri in the [keystone_authtoken] section of your magnum configuration.
You can use Kolla as a reference.
https://github.com/openstack/kolla-ansible/blob/stable/ocata/ansible/roles/magnum/templates/magnum.conf.j2#L56
This issue should by fixed in stable/rocky branch, see:
https://github.com/openstack/kolla-ansible/commit/187323e27655b1b1b5a5a378370d3ef18920272c#diff-786f05c66ee3d151fb1e18e6be9ce71c
Just update your kolla-ansible repository
git pull origin stable/rocky
and (re)deploy magnum again:
kolla-ansible -i inventory deploy -t magnum
If it is also www_authenticate_uri in your config file, then it could be like that :
www_authenticate_uri=http://localhost:5000
I changed URL and added v3 to the end.
www_authenticate_uri=http://localhost:5000/v3
That fixed my problem. Hope it will fix yours too!
Can someone help me out here? I am using Playground for this example, so you can put the whole code into your Playground and see the results.
I found out that when I remove this line:
"address_format": "{{recipient}}\n{{street}}\n{{postalcode}} {{city}}\n{{country}}",
it seems to work.
(The JSON is validated)
import UIKit
struct Country : Decodable {
enum CodingKeys: String, CodingKey {
case continent
case alpha2
case name
}
var name : String?
var continent : String?
var alpha2 : String?
}
let json = """
[
{
"continent": "Europe",
"alpha2": "AD",
"alpha3": "AND",
"country_code": "376",
"currency": "EUR",
"international_prefix": "00",
"ioc": "AND",
"latitude": "42 30 N",
"longitude": "1 30 E",
"name": "Andorra",
"names": [
"Andorre",
"Andorra",
"アンドラ"],
"translations": {
"en": "Andorre",
"it": "Andorra",
"de": "Andorra",
"fr": "Andorre",
"es": null,
"ja": "アンドラ",
"nl": "Andorra",
"ru": "Андорра"},
"national_destination_code_lengths": [2],
"national_number_lengths": [6,7,8,9],
"national_prefix": "None",
"number": "020",
"region": "Europe",
"subregion": "Southern Europe",
"un_locode": "AD",
"languages": ["ca"],
"nationality": "Andorran"},
{
"continent": "Asia",
"address_format": "{{recipient}}\n{{street}}\n{{postalcode}} {{city}}\n{{country}}",
"alpha2": "AE",
"alpha3": "ARE",
"country_code": "971",
"currency": "AED",
"international_prefix": "00",
"ioc": "UAE",
"latitude": "24 00 N",
"longitude": "54 00 E",
"name": "United Arab Emirates",
"names": [
"United Arab Emirates",
"Vereinigte Arabische Emirate",
"Émirats Arabes Unis",
"Emiratos Árabes Unidos",
"アラブ首長国連邦",
"Verenigde Arabische Emiraten"],
"translations": {
"en": "United Arab Emirates",
"it": "Emirati Arabi Uniti",
"de": "Vereinigte Arabische Emirate",
"fr": "Émirats Arabes Unis",
"es": "Emiratos Árabes Unidos",
"ja": "アラブ首長国連邦",
"nl": "Verenigde Arabische Emiraten",
"ru": "Объединенные Арабские Эмираты"},
"national_destination_code_lengths": [2],
"national_number_lengths": [7,8,9],
"national_prefix": "0",
"number": "784",
"region": "Asia",
"subregion": "Western Asia",
"un_locode": "AE",
"languages": ["ar"],
"nationality": "Emirian"}
]
""".data(using: .utf8)!
let decoder = JSONDecoder()
do {
let countries = try decoder.decode([Country].self, from: json)
print(countries)
} catch {
print("erro")
}
If you would print the actually error information
"Unescaped control character around character 722."
rather than meaningless literal string "erro"
the solution is obvious:
The linefeed characters \n must be escaped:
"address_format": "{{recipient}}\\n{{street}}\\n{{postalcode}} {{city}}\\n{{country}}",
You can fix the issue with
let json = """
[
...
]
""".replacingOccurrences(of: "}\n{", with: "}\\n{").data(using: .utf8)!
My code at follow
CCLOG("info: %s",infoStr.c_str());
const char * buf=infoStr.c_str();
cocos2d::extension::Json* mJs = cocos2d::extension::Json_create(buf);
cocos2d::extension::Json* item = Json_getItem(mJs,"results");
cocos2d::extension::Json* array1 = Json_getItemAt (item, 0);
cocos2d::extension::Json* itemNode = Json_getItem(array1,"version");
float floatValue = itemNode->valuefloat;
CCLOG("floatValue: %f",floatValue);
The result of CCLOG("info: %s",infoStr.c_str()); is at follow:
{
"resultCount": 1,
"results": [
{
"kind": "software",
"features": [],
"supportedDevices": [
"iPhone4S",
"iPadWifi",
"iPadThirdGen4G",
"iPhone5",
"iPadMini4G",
"iPadFourthGen4G",
"iPodTouchThirdGen",
"iPadThirdGen",
"iPad3G",
"iPhone4",
"iPodTouchourthGen",
"iPodTouchFifthGen",
"iPhone-3GS",
"iPad2Wifi",
"iPhone5c",
"iPad23G",
"iPhone5s",
"iPadFourthGen",
"iPadMini"
],
"isGameCenterEnabled": false,
"screenshotUrls": [
"http://a5.mzstatic.com/us/r30/Purple/v4/52/c0/e5/52c0e504-3e37-80a8-f17a-0b49bff6e63b/screen1136x1136.jpeg",
"http://a4.mzstatic.com/us/r30/Purple6/v4/b6/8d/50/b68d500a-b84a-44fe-7fac-a055aa49e2ee/screen1136x1136.jpeg",
"http://a5.mzstatic.com/us/r30/Purple4/v4/30/80/ab/3080ab26-fa55-a69b-480d-a57c803f3b81/screen1136x1136.jpeg"
],
"ipadScreenshotUrls": [],
"artworkUrl60": "http://a288.phobos.apple.com/us/r30/Purple6/v4/e6/89/56/e689561d-2bbc-8769-4325-b2acd91e0cf9/AppIcon57x57.png",
"artworkUrl512": "http://a1062.phobos.apple.com/us/r30/Purple4/v4/1d/8c/2c/1d8c2c76-d441-4d3b-d43c-48e6f7aa98ad/mzl.oympcnqz.png",
"artistViewUrl": "https://itunes.apple.com/us/artist/wei-gao/id777399907?uo=4",
"artistId": 777399907,
"artistName": "wei gao",
"price": 0,
"version": "1.0",
"description": "description",
"currency": "USD",
"genres": [
"Photo & Video",
"Entertainment"
],
"genreIds": [
"6008",
"6016"
],
"releaseDate": "2014-01-02T23:19:32Z",
"sellerName": "w",
"bundleId": "D.IMyPhotos",
"trackId": 77,
"trackName": "ff",
"primaryGenreName": "Photo & Video",
"primaryGenreId": 6008,
"formattedPrice": "Free",
"wrapperType": "software",
"trackCensoredName": "ff",
"languageCodesISO2A": [
"EN"
],
"fileSizeBytes": "14",
"sellerUrl": "http://wwww",
"contentAdvisoryRating": "4+",
"artworkUrl100": "http://a1062.phobos.apple.com/us/r30/Purple4/v4/1d/8c/2c/1d8c2c76-d441-4d3b-d43c-48e6f7aa98ad/mzl.oympcnqz.png",
"trackViewUrl": "https://itunes.apple.com/us/app",
"trackContentRating": "4+"
}
]
}
I get Json* mJs always NULL.I think the string of json is right.I used google but can't get the answer.
Do i use Json_create in the wrong way? Or other reason? A lot of thank!