Ejemplo n.º 1
0
    def _register_hostname(self, hostname, node_type, uuid):
        if not hostname:
            if not settings.AWX_AUTO_DEPROVISION_INSTANCES:
                raise CommandError(
                    'Registering with values from settings only intended for use in K8s installs'
                )

            from awx.main.management.commands.register_queue import RegisterQueue

            (changed, instance) = Instance.objects.register(
                ip_address=os.environ.get('MY_POD_IP'),
                node_type='control',
                uuid=settings.SYSTEM_UUID)
            RegisterQueue(settings.DEFAULT_CONTROL_PLANE_QUEUE_NAME,
                          100,
                          0, [],
                          is_container_group=False).register()
            RegisterQueue(
                settings.DEFAULT_EXECUTION_QUEUE_NAME,
                100,
                0, [],
                is_container_group=True,
                pod_spec_override=settings.
                DEFAULT_EXECUTION_QUEUE_POD_SPEC_OVERRIDE).register()
        else:
            (changed,
             instance) = Instance.objects.register(hostname=hostname,
                                                   node_type=node_type,
                                                   uuid=uuid)
        if changed:
            print("Successfully registered instance {}".format(hostname))
        else:
            print("Instance already registered {}".format(instance.hostname))
        self.changed = changed
Ejemplo n.º 2
0
    def get_or_register(self):
        if settings.AWX_AUTO_DEPROVISION_INSTANCES:
            from awx.main.management.commands.register_queue import RegisterQueue

            pod_ip = os.environ.get('MY_POD_IP')
            if settings.IS_K8S:
                registered = self.register(ip_address=pod_ip,
                                           node_type='control',
                                           uuid=settings.SYSTEM_UUID)
            else:
                registered = self.register(ip_address=pod_ip,
                                           uuid=settings.SYSTEM_UUID)
            RegisterQueue(settings.DEFAULT_CONTROL_PLANE_QUEUE_NAME,
                          100,
                          0, [],
                          is_container_group=False).register()
            RegisterQueue(
                settings.DEFAULT_EXECUTION_QUEUE_NAME,
                100,
                0, [],
                is_container_group=True,
                pod_spec_override=settings.
                DEFAULT_EXECUTION_QUEUE_POD_SPEC_OVERRIDE).register()
            return registered
        else:
            return (False, self.me())
Ejemplo n.º 3
0
    def get_or_register(self):
        if settings.AWX_AUTO_DEPROVISION_INSTANCES:
            from awx.main.management.commands.register_queue import RegisterQueue

            pod_ip = os.environ.get('MY_POD_IP')
            registered = self.register(ip_address=pod_ip)
            RegisterQueue(settings.DEFAULT_CONTROL_PLANE_QUEUE_NAME, 100, 0, [], is_container_group=False).register()
            RegisterQueue(settings.DEFAULT_EXECUTION_QUEUE_NAME, 100, 0, [], is_container_group=True).register()
            return registered
        else:
            return (False, self.me())
Ejemplo n.º 4
0
 def get_or_register(self):
     if settings.AWX_AUTO_DEPROVISION_INSTANCES:
         from awx.main.management.commands.register_queue import RegisterQueue
         pod_ip = os.environ.get('MY_POD_IP')
         registered = self.register(ip_address=pod_ip)
         RegisterQueue('tower', None, 100, 0, []).register()
         return registered
     else:
         return (False, self.me())