Example #1
0
    def check(self):

        if self.platform.startswith('Ubuntu'): sysctl = '/sbin/sysctl'
        else: sysctl = '/usr/sbin/sysctl'

        out = pipe_all(['{} -a'.format(sysctl), 'grep "fs\.file-max =.*"']).stdout()
        for l in out.splitlines():
            k, v = l.strip().split(' = ')
        if v == '131070':
            return True
        else: 
            return False
Example #2
0
 def test_pipe_with_cmd_list(self):
     pipeline = shell.pipe_all([
         'cat {0}'.format(self.ifconfig_out_path), 'grep -A 1 eth0',
         'grep inet', 'awk "{print $2}"', 'cut -d: -f 2'
     ])
     self.assertEqual(pipeline.stdout(), '192.168.116.101\n')
     self.assertEqual(pipeline.re(), 0)
     pipeline = shell.p([
         'cat {0}'.format(self.ifconfig_out_path), 'grep -A 1 eth0',
         'grep inet', 'awk "{print $2}"', 'cut -d: -f 2'
     ])
     self.assertEqual(pipeline.stdout(), '192.168.116.101\n')
     self.assertEqual(pipeline.re(), 0)
Example #3
0
 def test_pipe_with_cmd_list(self):
     pipeline = shell.pipe_all(['cat {0}'.format(self.ifconfig_out_path),
                                'grep -A 1 eth0',
                                'grep inet',
                                'awk "{print $2}"',
                                'cut -d: -f 2'])
     self.assertEqual(pipeline.stdout(), '192.168.116.101\n')
     self.assertEqual(pipeline.re(), 0)
     pipeline = shell.p(['cat {0}'.format(self.ifconfig_out_path),
                         'grep -A 1 eth0',
                         'grep inet',
                         'awk "{print $2}"',
                         'cut -d: -f 2'])
     self.assertEqual(pipeline.stdout(), '192.168.116.101\n')
     self.assertEqual(pipeline.re(), 0)
Example #4
0
File: rc.py Project: minhajksm/code
controllercfg = (
    "-c ~/code/source/go-workspace/src/github.com/GoogleCloudPlatform/"
    "kubernetes/examples/guestbook/frontend-controller.json ")

for i in range(50):
    print kubecfg + controllercfg + "create replicationControllers"
    ex(kubecfg + controllercfg + "create replicationControllers").stdout()

    print "________________Created________________________________"
    print ex(kubecfg + "list pods").stdout()
    time.sleep(10)
    print ex(kubecfg + "list pods").stdout()
    time.sleep(10)
    print ex(kubecfg + "list pods").stdout()
    time.sleep(10)
    print ex(kubecfg + "list pods").stdout()
    time.sleep(10)

    re = pipe_all([kubecfg + "list pods", "sed -n 6,8p",
                   "awk '{print $1}'"]).stdout()
    ex(kubecfg + "delete replicationControllers/frontendController").stdout()

    for line in re.split('\n'):
        if line:
            print kubecfg + "delete pods/" + line
            ex(kubecfg + "delete pods/" + line).stdout()
            time.sleep(1)

    print "________________Deleted________________________________"
    time.sleep(20)
Example #5
0
File: rc.py Project: minhajksm/code
kubecfg = ("~/code/source/go-workspace/src/github.com/GoogleCloudPlatform/"
           "kubernetes/cluster/kubecfg.sh ")
controllercfg = ("-c ~/code/source/go-workspace/src/github.com/GoogleCloudPlatform/"
                 "kubernetes/examples/guestbook/frontend-controller.json ")

for i in range(50):
  print kubecfg + controllercfg + "create replicationControllers"
  ex(kubecfg + controllercfg + "create replicationControllers").stdout()

  print "________________Created________________________________"
  print ex(kubecfg + "list pods").stdout()
  time.sleep(10)
  print ex(kubecfg + "list pods").stdout()
  time.sleep(10)
  print ex(kubecfg + "list pods").stdout()
  time.sleep(10)
  print ex(kubecfg + "list pods").stdout()
  time.sleep(10)

  re = pipe_all([kubecfg + "list pods", "sed -n 6,8p", "awk '{print $1}'"]).stdout()
  ex(kubecfg + "delete replicationControllers/frontendController").stdout()

  for line in re.split('\n'):
    if line:
      print kubecfg + "delete pods/" + line
      ex(kubecfg + "delete pods/" + line).stdout()
      time.sleep(1)

  print "________________Deleted________________________________"
  time.sleep(20)