예제 #1
0
def k8s_copy_config(context, destination_namespace, name=None):
    source_configmap = ConfigMap(context, name=name)
    destination_configmap = ConfigMap(context,
                                      name=name,
                                      namespace=destination_namespace)
    source_configmap.load()
    destination_configmap.struct['data'] = source_configmap.struct['data']
    destination_configmap.save()
예제 #2
0
def set_env(context, environment, namespace=None):
  configmap = ConfigMap(context, namespace=namespace)
  configmap.load()
  for s in environment:
    if '=' not in s:
      raise HokusaiError("Error: environment variables must be of the form 'KEY=VALUE'")
    split = s.split('=', 1)
    configmap.update(split[0], split[1])
  configmap.save()
예제 #3
0
def get_env(context, environment, namespace=None):
  configmap = ConfigMap(context, namespace=namespace)
  configmap.load()
  if environment:
    for k, v in configmap.all():
      if k in environment:
        print("%s=%s" % (k, v))
  else:
    for k, v in configmap.all():
      print("%s=%s" % (k, v))
예제 #4
0
def unset_env(context, environment, namespace=None):
  configmap = ConfigMap(context, namespace=namespace)
  configmap.load()
  for s in environment:
    configmap.delete(s)
  configmap.save()
예제 #5
0
파일: env.py 프로젝트: starsirius/hokusai
def unset_env(context, environment):
  configmap = ConfigMap(context)
  configmap.load()
  for s in environment:
    configmap.delete(s)
  configmap.save()
예제 #6
0
def get_env(context, environment, namespace=None):
    configmap = ConfigMap(context, namespace=namespace)
    configmap.load()
    for k, v in sorted(configmap.all().items()):
        if not environment or (environment and k in environment):
            print_smart("%s=%s" % (k, v))