Agent deployment v1
This commit is contained in:
parent
8d9c4682c7
commit
62d8c04ab3
|
@ -23,24 +23,6 @@ CREATE TABLE `ttask_credentials` (
|
||||||
ON DELETE CASCADE ON UPDATE CASCADE
|
ON DELETE CASCADE ON UPDATE CASCADE
|
||||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||||
|
|
||||||
CREATE TABLE `tdeployment_hosts` (
|
|
||||||
`id` SERIAL,
|
|
||||||
`id_cs` VARCHAR(100),
|
|
||||||
`ip` VARCHAR(100) NOT NULL UNIQUE,
|
|
||||||
`id_os` INT(10) UNSIGNED DEFAULT 0,
|
|
||||||
`os_version` VARCHAR(100) DEFAULT '' COMMENT "OS version in STR format",
|
|
||||||
`arch` ENUM('x64', 'x86') DEFAULT 'x64',
|
|
||||||
`current_agent_version` VARCHAR(100) DEFAULT '',
|
|
||||||
`desired_agent_version` VARCHAR(100) DEFAULT '',
|
|
||||||
`deployed` bigint(20) NOT NULL DEFAULT 0 COMMENT "When it was deployed",
|
|
||||||
`last_err` text,
|
|
||||||
PRIMARY KEY (`id`),
|
|
||||||
FOREIGN KEY (`id_cs`) REFERENCES `tcredential_store` (`identifier`)
|
|
||||||
ON UPDATE CASCADE ON DELETE SET NULL,
|
|
||||||
FOREIGN KEY (`id_os`) REFERENCES tconfig_os(`id_os`)
|
|
||||||
ON UPDATE CASCADE ON DELETE CASCADE
|
|
||||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
|
||||||
|
|
||||||
CREATE TABLE `tagent_repository` (
|
CREATE TABLE `tagent_repository` (
|
||||||
`id` SERIAL,
|
`id` SERIAL,
|
||||||
`id_os` INT(10) UNSIGNED DEFAULT 0,
|
`id_os` INT(10) UNSIGNED DEFAULT 0,
|
||||||
|
@ -48,12 +30,32 @@ CREATE TABLE `tagent_repository` (
|
||||||
`version` VARCHAR(10) DEFAULT '',
|
`version` VARCHAR(10) DEFAULT '',
|
||||||
`path` text,
|
`path` text,
|
||||||
`uploaded_by` VARCHAR(100) DEFAULT '',
|
`uploaded_by` VARCHAR(100) DEFAULT '',
|
||||||
`uploaded` bigint(20) NOT NULL DEFAULT 0 COMMENT "When it was deployed",
|
`uploaded` bigint(20) NOT NULL DEFAULT 0 COMMENT "When it was uploaded",
|
||||||
`last_err` text,
|
`last_err` text,
|
||||||
PRIMARY KEY (`id`),
|
PRIMARY KEY (`id`),
|
||||||
FOREIGN KEY (`id_os`) REFERENCES tconfig_os(`id_os`)
|
FOREIGN KEY (`id_os`) REFERENCES `tconfig_os`(`id_os`)
|
||||||
ON UPDATE CASCADE ON DELETE CASCADE
|
ON UPDATE CASCADE ON DELETE CASCADE
|
||||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||||
|
|
||||||
|
CREATE TABLE `tdeployment_hosts` (
|
||||||
|
`id` SERIAL,
|
||||||
|
`id_cs` VARCHAR(100),
|
||||||
|
`ip` VARCHAR(100) NOT NULL UNIQUE,
|
||||||
|
`id_os` INT(10) UNSIGNED DEFAULT 0,
|
||||||
|
`os_version` VARCHAR(100) DEFAULT '' COMMENT "OS version in STR format",
|
||||||
|
`arch` ENUM('x64', 'x86') DEFAULT 'x64',
|
||||||
|
`current_agent_version` VARCHAR(100) DEFAULT '' COMMENT "String latest installed agent",
|
||||||
|
`target_agent_version_id` BIGINT UNSIGNED,
|
||||||
|
`deployed` bigint(20) NOT NULL DEFAULT 0 COMMENT "When it was deployed",
|
||||||
|
`last_err` text,
|
||||||
|
PRIMARY KEY (`id`),
|
||||||
|
FOREIGN KEY (`id_cs`) REFERENCES `tcredential_store`(`identifier`)
|
||||||
|
ON UPDATE CASCADE ON DELETE SET NULL,
|
||||||
|
FOREIGN KEY (`id_os`) REFERENCES `tconfig_os`(`id_os`)
|
||||||
|
ON UPDATE CASCADE ON DELETE CASCADE,
|
||||||
|
FOREIGN KEY (`target_agent_version_id`) REFERENCES `tagent_repository`(`id`)
|
||||||
|
ON UPDATE CASCADE ON DELETE SET NULL
|
||||||
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||||
|
|
||||||
|
|
||||||
COMMIT;
|
COMMIT;
|
||||||
|
|
|
@ -2235,27 +2235,6 @@ CREATE TABLE `ttask_credentials` (
|
||||||
ON DELETE CASCADE ON UPDATE CASCADE
|
ON DELETE CASCADE ON UPDATE CASCADE
|
||||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||||
|
|
||||||
-- ----------------------------------------------------------------------
|
|
||||||
-- Table `tdeployment_hosts`
|
|
||||||
-- ----------------------------------------------------------------------
|
|
||||||
CREATE TABLE `tdeployment_hosts` (
|
|
||||||
`id` SERIAL,
|
|
||||||
`id_cs` VARCHAR(100),
|
|
||||||
`ip` VARCHAR(100) NOT NULL UNIQUE,
|
|
||||||
`id_os` INT(10) UNSIGNED DEFAULT 0,
|
|
||||||
`os_version` VARCHAR(100) DEFAULT '' COMMENT "OS version in STR format",
|
|
||||||
`arch` ENUM('x64', 'x86') DEFAULT 'x64',
|
|
||||||
`current_agent_version` VARCHAR(100) DEFAULT '',
|
|
||||||
`desired_agent_version` VARCHAR(100) DEFAULT '',
|
|
||||||
`deployed` bigint(20) NOT NULL DEFAULT 0 COMMENT "When it was deployed",
|
|
||||||
`last_err` text,
|
|
||||||
PRIMARY KEY (`id`),
|
|
||||||
FOREIGN KEY (`id_cs`) REFERENCES `tcredential_store` (`identifier`)
|
|
||||||
ON UPDATE CASCADE ON DELETE SET NULL,
|
|
||||||
FOREIGN KEY (`id_os`) REFERENCES tconfig_os(`id_os`)
|
|
||||||
ON UPDATE CASCADE ON DELETE CASCADE
|
|
||||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
|
||||||
|
|
||||||
-- ---------------------------------------------------------------------
|
-- ---------------------------------------------------------------------
|
||||||
-- Table `tagent_repository`
|
-- Table `tagent_repository`
|
||||||
-- ---------------------------------------------------------------------
|
-- ---------------------------------------------------------------------
|
||||||
|
@ -2266,9 +2245,32 @@ CREATE TABLE `tagent_repository` (
|
||||||
`version` VARCHAR(10) DEFAULT '',
|
`version` VARCHAR(10) DEFAULT '',
|
||||||
`path` text,
|
`path` text,
|
||||||
`uploaded_by` VARCHAR(100) DEFAULT '',
|
`uploaded_by` VARCHAR(100) DEFAULT '',
|
||||||
`uploaded` bigint(20) NOT NULL DEFAULT 0 COMMENT "When it was deployed",
|
`uploaded` bigint(20) NOT NULL DEFAULT 0 COMMENT "When it was uploaded",
|
||||||
`last_err` text,
|
`last_err` text,
|
||||||
PRIMARY KEY (`id`),
|
PRIMARY KEY (`id`),
|
||||||
FOREIGN KEY (`id_os`) REFERENCES tconfig_os(`id_os`)
|
FOREIGN KEY (`id_os`) REFERENCES `tconfig_os`(`id_os`)
|
||||||
ON UPDATE CASCADE ON DELETE CASCADE
|
ON UPDATE CASCADE ON DELETE CASCADE
|
||||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||||
|
|
||||||
|
-- ----------------------------------------------------------------------
|
||||||
|
-- Table `tdeployment_hosts`
|
||||||
|
-- ----------------------------------------------------------------------
|
||||||
|
CREATE TABLE `tdeployment_hosts` (
|
||||||
|
`id` SERIAL,
|
||||||
|
`id_cs` VARCHAR(100),
|
||||||
|
`ip` VARCHAR(100) NOT NULL UNIQUE,
|
||||||
|
`id_os` INT(10) UNSIGNED DEFAULT 0,
|
||||||
|
`os_version` VARCHAR(100) DEFAULT '' COMMENT "OS version in STR format",
|
||||||
|
`arch` ENUM('x64', 'x86') DEFAULT 'x64',
|
||||||
|
`current_agent_version` VARCHAR(100) DEFAULT '' COMMENT "String latest installed agent",
|
||||||
|
`target_agent_version_id` BIGINT UNSIGNED,
|
||||||
|
`deployed` bigint(20) NOT NULL DEFAULT 0 COMMENT "When it was deployed",
|
||||||
|
`last_err` text,
|
||||||
|
PRIMARY KEY (`id`),
|
||||||
|
FOREIGN KEY (`id_cs`) REFERENCES `tcredential_store`(`identifier`)
|
||||||
|
ON UPDATE CASCADE ON DELETE SET NULL,
|
||||||
|
FOREIGN KEY (`id_os`) REFERENCES `tconfig_os`(`id_os`)
|
||||||
|
ON UPDATE CASCADE ON DELETE CASCADE,
|
||||||
|
FOREIGN KEY (`target_agent_version_id`) REFERENCES `tagent_repository`(`id`)
|
||||||
|
ON UPDATE CASCADE ON DELETE SET NULL
|
||||||
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||||
|
|
|
@ -824,27 +824,6 @@ CREATE TABLE `ttask_credentials` (
|
||||||
ON DELETE CASCADE ON UPDATE CASCADE
|
ON DELETE CASCADE ON UPDATE CASCADE
|
||||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||||
|
|
||||||
-- ----------------------------------------------------------------------
|
|
||||||
-- Table `tdeployment_hosts`
|
|
||||||
-- ----------------------------------------------------------------------
|
|
||||||
CREATE TABLE `tdeployment_hosts` (
|
|
||||||
`id` SERIAL,
|
|
||||||
`id_cs` VARCHAR(100),
|
|
||||||
`ip` VARCHAR(100) NOT NULL UNIQUE,
|
|
||||||
`id_os` INT(10) UNSIGNED DEFAULT 0,
|
|
||||||
`os_version` VARCHAR(100) DEFAULT '' COMMENT "OS version in STR format",
|
|
||||||
`arch` ENUM('x64', 'x86') DEFAULT 'x64',
|
|
||||||
`current_agent_version` VARCHAR(100) DEFAULT '',
|
|
||||||
`desired_agent_version` VARCHAR(100) DEFAULT '',
|
|
||||||
`deployed` bigint(20) NOT NULL DEFAULT 0 COMMENT "When it was deployed",
|
|
||||||
`last_err` text,
|
|
||||||
PRIMARY KEY (`id`),
|
|
||||||
FOREIGN KEY (`id_cs`) REFERENCES `tcredential_store` (`identifier`)
|
|
||||||
ON UPDATE CASCADE ON DELETE SET NULL,
|
|
||||||
FOREIGN KEY (`id_os`) REFERENCES tconfig_os(`id_os`)
|
|
||||||
ON UPDATE CASCADE ON DELETE CASCADE
|
|
||||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
|
||||||
|
|
||||||
-- ----------------------------------------------------------------------
|
-- ----------------------------------------------------------------------
|
||||||
-- Table `tmodule_relationship`
|
-- Table `tmodule_relationship`
|
||||||
-- ----------------------------------------------------------------------
|
-- ----------------------------------------------------------------------
|
||||||
|
@ -3657,9 +3636,32 @@ CREATE TABLE `tagent_repository` (
|
||||||
`version` VARCHAR(10) DEFAULT '',
|
`version` VARCHAR(10) DEFAULT '',
|
||||||
`path` text,
|
`path` text,
|
||||||
`uploaded_by` VARCHAR(100) DEFAULT '',
|
`uploaded_by` VARCHAR(100) DEFAULT '',
|
||||||
`uploaded` bigint(20) NOT NULL DEFAULT 0 COMMENT "When it was deployed",
|
`uploaded` bigint(20) NOT NULL DEFAULT 0 COMMENT "When it was uploaded",
|
||||||
`last_err` text,
|
`last_err` text,
|
||||||
PRIMARY KEY (`id`),
|
PRIMARY KEY (`id`),
|
||||||
FOREIGN KEY (`id_os`) REFERENCES tconfig_os(`id_os`)
|
FOREIGN KEY (`id_os`) REFERENCES `tconfig_os`(`id_os`)
|
||||||
ON UPDATE CASCADE ON DELETE CASCADE
|
ON UPDATE CASCADE ON DELETE CASCADE
|
||||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||||
|
|
||||||
|
-- ----------------------------------------------------------------------
|
||||||
|
-- Table `tdeployment_hosts`
|
||||||
|
-- ----------------------------------------------------------------------
|
||||||
|
CREATE TABLE `tdeployment_hosts` (
|
||||||
|
`id` SERIAL,
|
||||||
|
`id_cs` VARCHAR(100),
|
||||||
|
`ip` VARCHAR(100) NOT NULL UNIQUE,
|
||||||
|
`id_os` INT(10) UNSIGNED DEFAULT 0,
|
||||||
|
`os_version` VARCHAR(100) DEFAULT '' COMMENT "OS version in STR format",
|
||||||
|
`arch` ENUM('x64', 'x86') DEFAULT 'x64',
|
||||||
|
`current_agent_version` VARCHAR(100) DEFAULT '' COMMENT "String latest installed agent",
|
||||||
|
`target_agent_version_id` BIGINT UNSIGNED,
|
||||||
|
`deployed` bigint(20) NOT NULL DEFAULT 0 COMMENT "When it was deployed",
|
||||||
|
`last_err` text,
|
||||||
|
PRIMARY KEY (`id`),
|
||||||
|
FOREIGN KEY (`id_cs`) REFERENCES `tcredential_store`(`identifier`)
|
||||||
|
ON UPDATE CASCADE ON DELETE SET NULL,
|
||||||
|
FOREIGN KEY (`id_os`) REFERENCES `tconfig_os`(`id_os`)
|
||||||
|
ON UPDATE CASCADE ON DELETE CASCADE,
|
||||||
|
FOREIGN KEY (`target_agent_version_id`) REFERENCES `tagent_repository`(`id`)
|
||||||
|
ON UPDATE CASCADE ON DELETE SET NULL
|
||||||
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||||
|
|
|
@ -237,6 +237,12 @@ sub data_consumer ($$) {
|
||||||
&& -f $cnf_extra{'creds_file'}) {
|
&& -f $cnf_extra{'creds_file'}) {
|
||||||
unlink($cnf_extra{'creds_file'});
|
unlink($cnf_extra{'creds_file'});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
# Clean one shot tasks
|
||||||
|
if ($task->{'type'} eq DISCOVERY_DEPLOY_AGENTS) {
|
||||||
|
db_delete_limit($dbh, ' trecon_task ', ' id_rt = ? ', 1, $task->{'id_rt'});
|
||||||
|
}
|
||||||
};
|
};
|
||||||
if ($@) {
|
if ($@) {
|
||||||
logger(
|
logger(
|
||||||
|
|
Loading…
Reference in New Issue