Пример #1
0
 def pod_delete(uuid):
     LOG.debug("pod_delete %s" % uuid)
     try:
         out, err = utils.trycmd('kubectl', 'delete', 'pod', uuid)
         if err:
             return False
     except Exception as e:
         LOG.error("Couldn't delete pod  %s due to error %s" % (uuid, e))
         return False
     return True
Пример #2
0
 def rc_delete(self, master_address, name):
     LOG.debug("rc_delete %s" % name)
     try:
         out, err = utils.trycmd('kubectl', 'delete', 'rc', name,
                                 '-s', master_address)
         if err:
             return False
     except Exception as e:
         LOG.error("Couldn't delete rc %s due to error %s" % (name, e))
         return False
     return True
Пример #3
0
 def pod_create(contents):
     LOG.debug("pod_create contents %s" % contents)
     try:
         out, err = utils.trycmd('kubectl', 'create', '-f', contents)
         if err:
             return False
     except Exception as e:
         LOG.error("Couldn't create pod with contents %s due to error %s"
                   % (contents, e))
         return False
     return True
Пример #4
0
 def service_delete(uuid):
     LOG.debug("service_delete %s" % uuid)
     try:
         out, err = utils.trycmd('kubectl', 'delete', 'service', uuid)
         if err:
             return False
     except Exception as e:
         LOG.error("Couldn't delete service  %s due to error %s"
                   % (uuid, e))
         return False
     return False
Пример #5
0
 def service_create(uuid, contents):
     LOG.debug("service_create %s contents %s" % (uuid, contents))
     try:
         out, err = utils.trycmd('kubectl', 'create', '-f', contents)
         if err:
             return False
     except Exception as e:
         LOG.error("Couldn't create service with contents %s \
                     due to error %s" % (contents, e))
         return False
     return True
Пример #6
0
 def rc_delete(self, api_address, name):
     LOG.debug("rc_delete %s" % name)
     try:
         out, err = utils.trycmd('kubectl', 'delete', 'rc', name,
                                 '-s', api_address)
         if err:
             return False
     except Exception as e:
         LOG.error(_LE("Couldn't delete rc %(rc)s due to error %(error)s")
                      % {'rc': name, 'error': e})
         return False
     return True
Пример #7
0
 def service_delete(self, api_address, name):
     LOG.debug("service_delete %s" % name)
     try:
         out, err = utils.trycmd('kubectl', 'delete', 'service', name,
                                 '-s', api_address)
         if err:
             return False
     except Exception as e:
         LOG.error(_LE("Couldn't delete service %(service)s due to error "
                       "%(error)s") % {'service': name, 'error': e})
         return False
     return True
Пример #8
0
 def rc_delete(self, api_address, name):
     LOG.debug("rc_delete %s" % name)
     try:
         out, err = utils.trycmd('kubectl', 'delete', 'rc', name,
                                 '-s', api_address)
         if err:
             return False
     except Exception as e:
         LOG.error(_LE("Couldn't delete rc %(rc)s due to error %(error)s")
                      % {'rc': name, 'error': e})
         return False
     return True
Пример #9
0
 def service_delete(self, api_address, name):
     LOG.debug("service_delete %s" % name)
     try:
         out, err = utils.trycmd('kubectl', 'delete', 'service', name,
                                 '-s', api_address)
         if err:
             return False
     except Exception as e:
         LOG.error(_LE("Couldn't delete service %(service)s due to error "
                       "%(error)s") % {'service': name, 'error': e})
         return False
     return True
Пример #10
0
    def pod_delete(self, api_address, name):
        LOG.debug("pod_delete %s" % name)
        try:
            out, err = utils.trycmd('kubectl', 'delete', 'pod', name,
                                    '-s', api_address,)
        except Exception as e:
            LOG.error(_LE("Couldn't delete pod %(pod)s due to error "
                          "%(error)s") % {'pod': name, 'error': e})
            return False

        if err:
            if ('"%s" not found' % name) in err:
                raise exception.PodNotFound(pod=name)
            else:
                return False

        return True
Пример #11
0
    def pod_delete(self, api_address, name):
        LOG.debug("pod_delete %s" % name)
        try:
            out, err = utils.trycmd('kubectl', 'delete', 'pod', name,
                                    '-s', api_address,)
        except Exception as e:
            LOG.error(_LE("Couldn't delete pod %(pod)s due to error "
                          "%(error)s") % {'pod': name, 'error': e})
            return False

        if err:
            if ('"%s" not found' % name) in err:
                raise exception.PodNotFound(pod=name)
            else:
                return False

        return True
Пример #12
0
def _k8s_update_with_path(api_address, resource_file):
    return utils.trycmd('kubectl', 'update',
                        '-s', api_address,
                        '-f', resource_file)
Пример #13
0
def _k8s_update_with_path(api_address, resource_file):
    return utils.trycmd('kubectl', 'update',
                        '-s', api_address,
                        '-f', resource_file)
Пример #14
0
def _k8s_create_with_path(master_address, resource_file):
    return utils.trycmd('kubectl', 'create',
                        '-s', master_address,
                        '-f', resource_file)