Merge pull request #740 from TeoV/master

New check for TPid in apier/v2/tp.go
This commit is contained in:
Dan Christian Bogos
2017-09-15 17:42:00 +02:00
committed by GitHub
3 changed files with 10 additions and 10 deletions

View File

@@ -42,7 +42,7 @@ func (self *ApierV2) RemTP(attrs AttrRemTp, reply *string) error {
}
func (self *ApierV2) ExportTPToFolder(attrs utils.AttrDirExportTP, exported *utils.ExportedTPStats) error {
if len(*attrs.TPid) == 0 {
if attrs.TPid == nil || *attrs.TPid == "" {
return utils.NewErrMandatoryIeMissing("TPid")
}
dir := self.Config.TpExportPath
@@ -75,7 +75,7 @@ func (self *ApierV2) ExportTPToFolder(attrs utils.AttrDirExportTP, exported *uti
}
func (self *ApierV2) ExportTPToZipString(attrs utils.AttrDirExportTP, reply *string) error {
if len(*attrs.TPid) == 0 {
if attrs.TPid == nil || *attrs.TPid == "" {
return utils.NewErrMandatoryIeMissing("TPid")
}
dir := ""

View File

@@ -399,8 +399,8 @@ DROP TABLE IF EXISTS tp_resources;
CREATE TABLE tp_resources (
`pk` int(11) NOT NULL AUTO_INCREMENT,
`tpid` varchar(64) NOT NULL,
`id` varchar(64) NOT NULL,
`tenant` varchar(64) NOT NULL,
`id` varchar(64) NOT NULL,
`filter_type` varchar(16) NOT NULL,
`filter_field_name` varchar(64) NOT NULL,
`filter_field_values` varchar(256) NOT NULL,
@@ -415,7 +415,7 @@ CREATE TABLE tp_resources (
`created_at` TIMESTAMP,
PRIMARY KEY (`pk`),
KEY `tpid` (`tpid`),
UNIQUE KEY `unique_tp_resource` (`tpid`, `id`, `filter_type`, `filter_field_name`)
UNIQUE KEY `unique_tp_resource` (`tpid`,`tenant`, `id`, `filter_type`, `filter_field_name`)
);
--
@@ -424,9 +424,9 @@ CREATE TABLE tp_resources (
DROP TABLE IF EXISTS tp_stats;
CREATE TABLE tp_stats (
`tenant` varchar(64) NOT NULL,
`id` int(11) NOT NULL AUTO_INCREMENT,
`tpid` varchar(64) NOT NULL,
`tenant` varchar(64) NOT NULL,
`tag` varchar(64) NOT NULL,
`filter_type` varchar(16) NOT NULL,
`filter_field_name` varchar(64) NOT NULL,
@@ -442,7 +442,7 @@ CREATE TABLE tp_stats (
`created_at` TIMESTAMP,
PRIMARY KEY (`id`),
KEY `tpid` (`tpid`),
UNIQUE KEY `unique_tp_stats` (`tpid`, `tag`, `filter_type`, `filter_field_name`)
UNIQUE KEY `unique_tp_stats` (`tpid`, `tenant`, `tag`, `filter_type`, `filter_field_name`)
);
--

View File

@@ -395,8 +395,8 @@ DROP TABLE IF EXISTS tp_resources;
CREATE TABLE tp_resources (
"pk" SERIAL PRIMARY KEY,
"tpid" varchar(64) NOT NULL,
"id" varchar(64) NOT NULL,
"tenant"varchar(64) NOT NULL,
"id" varchar(64) NOT NULL,
"filter_type" varchar(16) NOT NULL,
"filter_field_name" varchar(64) NOT NULL,
"filter_field_values" varchar(256) NOT NULL,
@@ -411,7 +411,7 @@ CREATE TABLE tp_resources (
"created_at" TIMESTAMP WITH TIME ZONE
);
CREATE INDEX tp_resources_idx ON tp_resources (tpid);
CREATE INDEX tp_resources_unique ON tp_resources ("tpid", "id", "filter_type", "filter_field_name");
CREATE INDEX tp_resources_unique ON tp_resources ("tpid", "tenant", "id", "filter_type", "filter_field_name");
--
@@ -420,9 +420,9 @@ CREATE INDEX tp_resources_unique ON tp_resources ("tpid", "id", "filter_type",
DROP TABLE IF EXISTS tp_stats;
CREATE TABLE tp_stats (
"tenant"varchar(64) NOT NULL,
"id" SERIAL PRIMARY KEY,
"tpid" varchar(64) NOT NULL,
"tenant"varchar(64) NOT NULL,
"tag" varchar(64) NOT NULL,
"filter_type" varchar(16) NOT NULL,
"filter_field_name" varchar(64) NOT NULL,
@@ -438,7 +438,7 @@ CREATE TABLE tp_stats (
"created_at" TIMESTAMP WITH TIME ZONE
);
CREATE INDEX tp_stats_idx ON tp_stats (tpid);
CREATE INDEX tp_stats_unique ON tp_stats ("tpid", "tag", "filter_type", "filter_field_name");
CREATE INDEX tp_stats_unique ON tp_stats ("tpid","tenant", "tag", "filter_type", "filter_field_name");
--
-- Table structure for table `tp_threshold_cfgs`