Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id DC2A12009DC for ; Tue, 2 May 2017 19:31:09 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id DABAA160BAB; Tue, 2 May 2017 17:31:09 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id A16DB160B9D for ; Tue, 2 May 2017 19:31:08 +0200 (CEST) Received: (qmail 37597 invoked by uid 500); 2 May 2017 17:31:07 -0000 Mailing-List: contact commits-help@nifi.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@nifi.apache.org Delivered-To: mailing list commits@nifi.apache.org Received: (qmail 37587 invoked by uid 99); 2 May 2017 17:31:07 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd3-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 02 May 2017 17:31:07 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd3-us-west.apache.org (ASF Mail Server at spamd3-us-west.apache.org) with ESMTP id 5DF04192B93 for ; Tue, 2 May 2017 17:31:07 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd3-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: -100.001 X-Spam-Level: X-Spam-Status: No, score=-100.001 tagged_above=-999 required=6.31 tests=[RP_MATCHES_RCVD=-0.001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001, USER_IN_WHITELIST=-100] autolearn=disabled Received: from mx1-lw-us.apache.org ([10.40.0.8]) by localhost (spamd3-us-west.apache.org [10.40.0.10]) (amavisd-new, port 10024) with ESMTP id UiP28apNW_Cq for ; Tue, 2 May 2017 17:31:06 +0000 (UTC) Received: from mailrelay1-us-west.apache.org (mailrelay1-us-west.apache.org [209.188.14.139]) by mx1-lw-us.apache.org (ASF Mail Server at mx1-lw-us.apache.org) with ESMTP id 09A165F3BF for ; Tue, 2 May 2017 17:31:06 +0000 (UTC) Received: from jira-lw-us.apache.org (unknown [207.244.88.139]) by mailrelay1-us-west.apache.org (ASF Mail Server at mailrelay1-us-west.apache.org) with ESMTP id 865C3E0D85 for ; Tue, 2 May 2017 17:31:05 +0000 (UTC) Received: from jira-lw-us.apache.org (localhost [127.0.0.1]) by jira-lw-us.apache.org (ASF Mail Server at jira-lw-us.apache.org) with ESMTP id 6900B21DEF for ; Tue, 2 May 2017 17:31:04 +0000 (UTC) Date: Tue, 2 May 2017 17:31:04 +0000 (UTC) From: "ASF GitHub Bot (JIRA)" To: commits@nifi.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Commented] (MINIFI-275) Configuration without IDs for components causes exceptions MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 archived-at: Tue, 02 May 2017 17:31:10 -0000 [ https://issues.apache.org/jira/browse/MINIFI-275?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15993333#comment-15993333 ] ASF GitHub Bot commented on MINIFI-275: --------------------------------------- Github user phrocker commented on a diff in the pull request: https://github.com/apache/nifi-minifi-cpp/pull/85#discussion_r114376703 --- Diff: libminifi/src/core/yaml/YamlConfiguration.cpp --- @@ -538,14 +561,62 @@ void YamlConfiguration::parsePropertiesNodeYaml( std::string rawValueString = propertyValueNode.as(); if (!processor->setProperty(propertyName, rawValueString)) { logger_->log_warn( - "Received property %s with value %s but is not one of the properties for %s", - propertyName.c_str(), rawValueString.c_str(), - processor->getName().c_str()); + "Received property %s with value %s but it is not one of the properties for %s", + propertyName, + rawValueString, + processor->getName()); } } } } +std::string YamlConfiguration::getOrGenerateId( + YAML::Node *yamlNode, + std::string idField) { + std::string id; + YAML::Node node = yamlNode->as(); + + if (node[idField]) { + if (YAML::NodeType::Scalar == node[idField].Type()) { + id = node[idField].as(); + } else { + throw std::invalid_argument( + "getOrGenerateId: idField is expected to reference YAML::Node " + "of YAML::NodeType::Scalar."); + } + } else { + uuid_t uuid; + uuid_generate(uuid); + char uuid_str[37]; + uuid_unparse(uuid, uuid_str); + id = uuid_str; + logger_->log_debug("Generating random ID: id => [%s]", id); + } + return id; +} + +void YamlConfiguration::checkRequiredField( --- End diff -- While it's touching the same code, I believe this may be out of the scope of this PR and ticket. We can simply create another ticket for this case. > Configuration without IDs for components causes exceptions > ---------------------------------------------------------- > > Key: MINIFI-275 > URL: https://issues.apache.org/jira/browse/MINIFI-275 > Project: Apache NiFi MiNiFi > Issue Type: Bug > Components: C++, Processing Configuration > Reporter: Aldrin Piri > Assignee: Kevin Doran > Priority: Blocker > Fix For: cpp-0.2.0 > > Attachments: config.TEST.yml > > > One of the changes to how components are handled in C++ introduced a defect into the original construct over the version 1 schema of the YAML. > The absence of this ID causes a YAML exception. > We should provide handling to support configurations how they were created originally, possibly providing a default/generated ID where one isn't specified, and start laying the foundation for versioned schemas as provided in our Java implementation. -- This message was sent by Atlassian JIRA (v6.3.15#6346)