Skip to content

Commit e4a5416

Browse files
committed
Refactor project_hash calculation
1 parent 15fe9c1 commit e4a5416

1 file changed

Lines changed: 10 additions & 1 deletion

File tree

src/Command/MainCommand.php

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,8 +90,17 @@ protected function execute(Input $input, Output $output): int
9090
$this->deployer->input = $input;
9191
$this->deployer->output = $output;
9292
$this->deployer['log'] = $input->getOption('log');
93+
$hash = null;
94+
if (!empty($this->deployer->config['repository'])) {
95+
$hash = sha1($this->deployer->config['repository']);
96+
} else {
97+
$hosts = $this->deployer->hosts->all();
98+
if (count($hosts) > 0) {
99+
$hash = sha1($hosts[0]->getHostname());
100+
}
101+
}
93102
$this->telemetry([
94-
'project_hash' => empty($this->deployer->config['repository']) ? null : sha1($this->deployer->config['repository']),
103+
'project_hash' => $hash,
95104
'hosts_count' => $this->deployer->hosts->count(),
96105
'recipes' => $this->deployer->config->get('recipes', []),
97106
'recipe_type' => $this->deployer->config->get('recipe_type', ''),

0 commit comments

Comments
 (0)