diff --git a/app/code/Magento/NewRelicReporting/Console/Command/DeployMarker.php b/app/code/Magento/NewRelicReporting/Console/Command/DeployMarker.php new file mode 100644 index 0000000000000..272b7592cbd15 --- /dev/null +++ b/app/code/Magento/NewRelicReporting/Console/Command/DeployMarker.php @@ -0,0 +1,59 @@ +deploymentsFactory = $deploymentsFactory; + $this->serviceShellUser = $serviceShellUser; + parent::__construct($name); + } + + protected function configure() + { + $this->setName("newrelic:create:deploy-marker"); + $this->setDescription("Check the deploy queue for entries and create an appropriate deploy marker.") + ->addArgument( + 'message', + InputArgument::REQUIRED, + 'Deploy Message?' + ) + ->addArgument( + 'changelog', + InputArgument::REQUIRED, + 'Change Log?' + ) + ->addArgument( + 'user', + InputArgument::OPTIONAL, + 'Deployment User' + ); + parent::configure(); + } + + protected function execute(InputInterface $input, OutputInterface $output) + { + $this->deploymentsFactory->create()->setDeployment( + $input->getArgument('message'), + $input->getArgument('changelog'), + $this->serviceShellUser->get($input->getArgument('user')) + ); + $output->writeln('NewRelic deployment information sent'); + } +} diff --git a/app/code/Magento/NewRelicReporting/Model/Cron/ReportNewRelicCron.php b/app/code/Magento/NewRelicReporting/Model/Cron/ReportNewRelicCron.php index a4a7d30b44f5b..6b2bd50dc456b 100644 --- a/app/code/Magento/NewRelicReporting/Model/Cron/ReportNewRelicCron.php +++ b/app/code/Magento/NewRelicReporting/Model/Cron/ReportNewRelicCron.php @@ -175,7 +175,6 @@ protected function reportCounts() public function report() { if ($this->config->isNewRelicEnabled()) { - $this->reportModules(); $this->reportCounts(); } diff --git a/app/code/Magento/NewRelicReporting/Model/ServiceShellUser.php b/app/code/Magento/NewRelicReporting/Model/ServiceShellUser.php new file mode 100644 index 0000000000000..8262428d9bf2b --- /dev/null +++ b/app/code/Magento/NewRelicReporting/Model/ServiceShellUser.php @@ -0,0 +1,22 @@ + [ - ['name' => 'name', 'setup_version' => '2.0.0', 'type' => 'enabled'], - ['name' => 'name', 'setup_version' => '2.0.0', 'type' => 'disabled'], - ['name' => 'name', 'setup_version' => '2.0.0', 'type' => 'installed'], - ['name' => 'name', 'setup_version' => '2.0.0', 'type' => 'uninstalled'], - ], - 'enabled' => 1, - 'disabled' => 1, - 'installed' => 1, - ]; $this->config->expects($this->once()) ->method('isNewRelicEnabled') ->willReturn(true); - $this->collect->expects($this->once()) - ->method('getModuleData') - ->willReturn($testModuleData); $this->counter->expects($this->once()) ->method('getAllProductsCount'); $this->counter->expects($this->once()) @@ -198,24 +184,10 @@ public function testReportNewRelicCron() */ public function testReportNewRelicCronRequestFailed() { - $testModuleData = [ - 'changes' => [ - ['name' => 'name', 'setup_version' => '2.0.0', 'type' => 'enabled'], - ['name' => 'name', 'setup_version' => '2.0.0', 'type' => 'disabled'], - ['name' => 'name', 'setup_version' => '2.0.0', 'type' => 'installed'], - ['name' => 'name', 'setup_version' => '2.0.0', 'type' => 'uninstalled'], - ], - 'enabled' => 1, - 'disabled' => 1, - 'installed' => 1, - ]; $this->config->expects($this->once()) ->method('isNewRelicEnabled') ->willReturn(true); - $this->collect->expects($this->once()) - ->method('getModuleData') - ->willReturn($testModuleData); $this->counter->expects($this->once()) ->method('getAllProductsCount'); $this->counter->expects($this->once()) diff --git a/app/code/Magento/NewRelicReporting/etc/di.xml b/app/code/Magento/NewRelicReporting/etc/di.xml index cba92f91cd4bb..9cfe909571a96 100644 --- a/app/code/Magento/NewRelicReporting/etc/di.xml +++ b/app/code/Magento/NewRelicReporting/etc/di.xml @@ -30,4 +30,12 @@ + + + + Magento\NewRelicReporting\Console\Command\DeployMarker + + +