Esempio n. 1
0
    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"
            )
Esempio n. 2
0
    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

        if len(argv) < 1:
            raise ArgumentException("Wrong number of arguments")
        self._root = argv[0]

        importer = Import(self._config.options.skip_conflict, queue_actions=True, with_instances=self._config.options.with_instances)
        importer.import_organization(self._client, self._root)

        if (importer.no_conflict() or self._config.options.skip_conflict) and not self._config.options.dry_run:
            importer.execute_queue()
        else:
            importer.display_queue(show_only_conflicts = True)
Esempio n. 3
0
    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 = globals.options

        if len(argv) < 1:
            raise ArgumentException("Wrong number of arguments")
        self._root = argv[0]

        importer = Import(globals.options.skip_conflict, True)
        importer.import_organization(self._client, self._root)

        if (importer.no_conflict() or
                globals.options.skip_conflict) and not globals.options.dry_run:
            importer.execute_queue()
        else:
            importer.display_queue(show_only_conflicts=True)