def _import(self, argv): """ Pushes local data to comodit server. Data may include applications, distributions, platforms, organizations, environments and hosts. Local data are automatically imported if no collision with remote data is detected. In case of collision, 'force' option can be used to still import data. """ self._options = self._config.options org = self._client.organizations().get(argv[0]) env = self._client.environments(argv[0]).get(argv[1]) if len(argv) < 3: raise ArgumentException("Wrong number of arguments") importer = Import(self._config.options.skip_conflict, queue_actions=True, with_instances=self._config.options.with_instances) importer.import_full_host(org, env, argv[2]) if self._config.options.dry_run: importer.display_queue(show_only_conflicts=False) elif (importer.no_conflict() or self._config.options.skip_conflict): importer.execute_queue() else: importer.display_queue(show_only_conflicts=True) print( "Impossible to import host. There are conflicts. Use --skip-conflict to force" )