示例#1
0
 def _pat_checker(self, fn, patterns):
     (root_fn, fn_ext) = os.path.splitext(fn)
     if utils.has_any(fn_ext.lower(), *BAD_EXTENSIONS):
         return False
     for pat in patterns:
         if pat.match(fn):
             return True
     return False
示例#2
0
 def _pat_checker(self, fn, patterns):
     (_root_fn, fn_ext) = os.path.splitext(fn)
     if utils.has_any(fn_ext.lower(), *BAD_EXTENSIONS):
         return False
     for pat in patterns:
         if pat.search(fn):
             return True
     return False
示例#3
0
    def status_app(self, program):
        status_cmd = self.get_command("status", program)
        try:
            output = sh.execute(status_cmd, shell=True)[0]
        except excp.ProcessExecutionError:
            return False

        if utils.has_any(output, "is not running"):
            return False
        return True
示例#4
0
    def status_app(self, program):
        status_cmd = self.get_command("status", program)
        try:
            output = sh.execute(status_cmd, shell=True)[0]
        except excp.ProcessExecutionError:
            return False

        if utils.has_any(output, "is not running"):
            return False
        return True
示例#5
0
 def statii(self):
     (sysout, stderr) = self._run_action('status', check_exit_code=False)
     combined = (sysout + stderr).lower()
     st = comp.STATUS_UNKNOWN
     if combined.find("is running") != -1:
         st = comp.STATUS_STARTED
     elif utils.has_any(combined, 'stopped', 'unrecognized', 'not running'):
         st = comp.STATUS_STOPPED
     return [
         comp.ProgramStatus(status=st,
                            details=(sysout + stderr).strip()),
     ]
示例#6
0
 def statii(self):
     # This has got to be the worst status output.
     #
     # I have ever seen (its like a weird mix json+crap)
     (sysout, stderr) = self._run_action("status", check_exit_code=False)
     st = comp.STATUS_UNKNOWN
     combined = (sysout + stderr).lower()
     if utils.has_any(combined, "nodedown", "unable to connect to node", "unrecognized"):
         st = comp.STATUS_STOPPED
     elif combined.find("running_applications") != -1:
         st = comp.STATUS_STARTED
     return [comp.ProgramStatus(status=st, details={"STDOUT": sysout, "STDERR": stderr})]
示例#7
0
 def status(self):
     status_cmd = self.distro.get_command('apache', 'status')
     (sysout, stderr) = sh.execute(*status_cmd, run_as_root=True, check_exit_code=False)
     combined = (sysout + stderr).lower()
     st = comp.STATUS_UNKNOWN
     if combined.find("is running") != -1:
         st = comp.STATUS_STARTED
     elif utils.has_any(combined, 'stopped', 'unrecognized', 'not running'):
         st = comp.STATUS_STOPPED
     return [
         comp.ProgramStatus(status=st,
                            details=(sysout + stderr).strip()),
     ]
示例#8
0
 def status(self):
     status_cmd = self._get_run_actions('status', excp.StatusException)
     (sysout, stderr) = sh.execute(*status_cmd, run_as_root=True, check_exit_code=False)
     combined = (sysout + stderr).lower()
     st = comp.STATUS_UNKNOWN
     if combined.find("running") != -1:
         st = comp.STATUS_STARTED
     elif utils.has_any(combined, 'stop', 'unrecognized'):
         st = comp.STATUS_STOPPED
     return [
         comp.ProgramStatus(name=self.get_option("type"),
                            status=st,
                            details=(sysout + stderr).strip()),
     ]
示例#9
0
 def status(self):
     status_cmd = self.distro.get_command('apache', 'status')
     (sysout, stderr) = sh.execute(*status_cmd,
                                   run_as_root=True,
                                   check_exit_code=False)
     combined = (sysout + stderr).lower()
     st = comp.STATUS_UNKNOWN
     if combined.find("is running") != -1:
         st = comp.STATUS_STARTED
     elif utils.has_any(combined, 'stopped', 'unrecognized', 'not running'):
         st = comp.STATUS_STOPPED
     return [
         comp.ProgramStatus(status=st, details=(sysout + stderr).strip()),
     ]
示例#10
0
 def statii(self):
     (sysout, stderr) = self._run_action('status', check_exit_code=False)
     combined = (sysout + stderr).lower()
     st = bruntime.STATUS_UNKNOWN
     if combined.find("is running") != -1:
         st = bruntime.STATUS_STARTED
     elif utils.has_any(combined, 'stopped', 'unrecognized', 'not running'):
         st = bruntime.STATUS_STOPPED
     return [
         bruntime.ProgramStatus(name='apache',
                                status=st,
                                details={
                                    'STDOUT': sysout,
                                    'STDERR': stderr,
                                }),
     ]
示例#11
0
文件: db.py 项目: apugachev-gd/anvil
 def statii(self):
     (sysout, stderr) = self._run_action('status', False)
     combined = (sysout + stderr).lower()
     st = bruntime.STATUS_UNKNOWN
     if combined.find("running") != -1:
         st = bruntime.STATUS_STARTED
     elif utils.has_any(combined, 'stop', 'unrecognized'):
         st = bruntime.STATUS_STOPPED
     return [
         bruntime.ProgramStatus(name=self.applications[0].name,
                            status=st,
                            details={
                                'STDOUT': sysout,
                                'STDERR': stderr,
                            }),
     ]
示例#12
0
 def statii(self):
     (sysout, stderr) = self._run_action('status', False)
     combined = (sysout + stderr).lower()
     st = comp.STATUS_UNKNOWN
     if combined.find("running") != -1:
         st = comp.STATUS_STARTED
     elif utils.has_any(combined, 'stop', 'unrecognized'):
         st = comp.STATUS_STOPPED
     return [
         comp.ProgramStatus(name=self.applications[0].name,
                            status=st,
                            details={
                                'STDOUT': sysout,
                                'STDERR': stderr,
                            }),
     ]
示例#13
0
 def status(self):
     # This has got to be the worst status output.
     #
     # I have ever seen (its like a weird mix json+crap)
     status_cmd = self.distro.get_command('rabbit-mq', 'status')
     (sysout, stderr) = sh.execute(*status_cmd, check_exit_code=False, run_as_root=True)
     st = comp.STATUS_UNKNOWN
     combined = (sysout + stderr).lower()
     if utils.has_any(combined, 'nodedown', "unable to connect to node", 'unrecognized'):
         st = comp.STATUS_STOPPED
     elif combined.find('running_applications') != -1:
         st = comp.STATUS_STARTED
     return [
         comp.ProgramStatus(status=st,
                            details=(sysout + stderr).strip()),
     ]
示例#14
0
 def statii(self):
     (sysout, stderr) = self._run_action('status', check_exit_code=False)
     combined = (sysout + stderr).lower()
     st = bruntime.STATUS_UNKNOWN
     if combined.find("is running") != -1:
         st = bruntime.STATUS_STARTED
     elif utils.has_any(combined, 'stopped', 'unrecognized', 'not running'):
         st = bruntime.STATUS_STOPPED
     return [
         bruntime.ProgramStatus(name='apache',
                            status=st,
                            details={
                                'STDOUT': sysout,
                                'STDERR': stderr,
                            }),
     ]
示例#15
0
 def status(self):
     # This has got to be the worst status output.
     #
     # I have ever seen (its like a weird mix json+crap)
     status_cmd = self.distro.get_command('rabbit-mq', 'status')
     (sysout, stderr) = sh.execute(*status_cmd,
                                   check_exit_code=False,
                                   run_as_root=True)
     st = comp.STATUS_UNKNOWN
     combined = (sysout + stderr).lower()
     if utils.has_any(combined, 'nodedown', "unable to connect to node",
                      'unrecognized'):
         st = comp.STATUS_STOPPED
     elif combined.find('running_applications') != -1:
         st = comp.STATUS_STARTED
     return [
         comp.ProgramStatus(status=st, details=(sysout + stderr).strip()),
     ]
 def get_option(self, option, *options, **kwargs):
     if option == 'db':
         src = {
             option: {
                 'host': 'localhost',
                 'port': 3306,
                 'type': 'mysql',
                 'user': '******'
             },
         }
     elif option == 'ip':
         return utils.get_host_ip()
     elif utils.has_any(option, 'extra_flags', 'extra_opts', 'instances_path'):
         return ''
     else:
         # Make a fake dictionary hierachy
         src = make_fakey([option] + list(options))
     return utils.get_deep(src, [option] + list(options))
示例#17
0
文件: rabbit.py 项目: AsherBond/anvil
 def statii(self):
     # This has got to be the worst status output.
     #
     # I have ever seen (its like a weird mix json+crap)
     (sysout, stderr) = self._run_action('status', check_exit_code=False)
     st = bruntime.STATUS_UNKNOWN
     combined = (sysout + stderr).lower()
     if utils.has_any(combined, 'nodedown', "unable to connect to node", 'unrecognized'):
         st = bruntime.STATUS_STOPPED
     elif combined.find('running_applications') != -1:
         st = bruntime.STATUS_STARTED
     return [
         bruntime.ProgramStatus(status=st,
                                details={
                                    'STDOUT': sysout,
                                    'STDERR': stderr
                                })
     ]
 def get_option(self, option, *options, **kwargs):
     if option == 'db':
         src = {
             option: {
                 'host': 'localhost',
                 'port': 3306,
                 'type': 'mysql',
                 'user': '******'
             },
         }
     elif option == 'ip':
         return utils.get_host_ip()
     elif utils.has_any(option, 'extra_flags', 'extra_opts',
                        'instances_path'):
         return ''
     else:
         # Make a fake dictionary hierachy
         src = make_fakey([option] + list(options))
     return utils.get_deep(src, [option] + list(options))
示例#19
0
文件: rabbit.py 项目: hshah19/anvil
 def statii(self):
     # This has got to be the worst status output.
     #
     # I have ever seen (its like a weird mix json+crap)
     (sysout, stderr) = self._run_action('status', check_exit_code=False)
     st = bruntime.STATUS_UNKNOWN
     combined = (sysout + stderr).lower()
     if utils.has_any(combined, 'nodedown', "unable to connect to node",
                      'unrecognized'):
         st = bruntime.STATUS_STOPPED
     elif combined.find('running_applications') != -1:
         st = bruntime.STATUS_STARTED
     return [
         bruntime.ProgramStatus(status=st,
                                details={
                                    'STDOUT': sysout,
                                    'STDERR': stderr
                                })
     ]
示例#20
0
 def _filter_pip_requires_line(self, fn, line):
     # We handle these ourselves in anvil
     if utils.has_any(line.lower(), 'quantumclient', 'cinder', 'glance',
                      'ldap', 'keystoneclient'):
         return None
     return line
示例#21
0
 def _filter_pip_requires_line(self, fn, line):
     # We handle these ourselves in anvil
     if utils.has_any(line.lower(), 'quantumclient', 'cinder', 'glance', 'ldap'):
         return None
     return line
示例#22
0
 def _filter_pip_requires(self, fn, lines):
     return [l for l in lines
             if not utils.has_any(l.lower(), 'keystoneclient',
                                  'ldap', 'http://tarballs.openstack.org', 'memcached')]
示例#23
0
 def _filter_pip_requires_line(self, fn, line):
     if utils.has_any(line.lower(), 'quantumclient', 'glance'):
         return None
     return line
示例#24
0
 def _filter_pip_requires_line(self, fn, line):
     if utils.has_any(line.lower(), "keystoneclient", "ldap", "http://tarballs.openstack.org", "memcached"):
         return None
     return line
示例#25
0
 def _filter_pip_requires_line(self, fn, line):
     if utils.has_any(line.lower(), 'swift', 'keystoneclient'):
         return None
     return line
示例#26
0
 def _filter_pip_requires(self, fn, lines):
     return [l for l in lines
             if not utils.has_any(l.lower(), 'quantumclient',
                                  'cinder', 'glance', 'ldap', 'keystoneclient')]
示例#27
0
 def _filter_pip_requires_line(self, fn, line):
     if utils.has_any(line.lower(), 'swift', 'keystoneclient'):
         return None
     return line
示例#28
0
 def _filter_pip_requires(self, fn, lines):
     return [
         l
         for l in lines
         if not utils.has_any(l.lower(), "quantumclient", "cinder", "glance", "ldap", "keystoneclient")
     ]
示例#29
0
 def _filter_pip_requires(self, fn, lines):
     return [l for l in lines
             if not utils.has_any(l.lower(), 'swift', 'keystoneclient')]
示例#30
0
 def _filter_pip_requires(self, fn, lines):
     return [
         l for l in lines
         if not utils.has_any(l.lower(), 'keystoneclient', 'ldap',
                              'http://tarballs.openstack.org', 'memcached')
     ]
示例#31
0
 def _filter_pip_requires(self, fn, lines):
     return [
         l for l in lines
         if not utils.has_any(l.lower(), 'quantumclient', 'cinder',
                              'glance', 'ldap', 'keystoneclient')
     ]
示例#32
0
 def _filter_pip_requires_line(self, fn, line):
     # We handle these ourselves in anvil
     if utils.has_any(line.lower(), "quantumclient", "cinder", "glance", "ldap"):
         return None
     return line
示例#33
0
 def _filter_pip_requires_line(self, fn, line):
     if utils.has_any(line.lower(), 'keystoneclient', 'ldap',
                      'http://tarballs.openstack.org', 'memcached'):
         return None
     return line
示例#34
0
 def _filter_pip_requires(self, fn, lines):
     return [l for l in lines
             if not utils.has_any(l.lower(), 'swift', 'keystoneclient')]
示例#35
0
 def _filter_pip_requires_line(self, fn, line):
     if utils.has_any(line.lower(), 'keystoneclient', 'ldap', 'http://tarballs.openstack.org', 'memcached'):
         return None
     return line