Example #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
Example #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
Example #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
Example #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
Example #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()),
     ]
Example #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})]
 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()),
     ]
Example #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()),
     ]
Example #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()),
     ]
Example #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,
                                }),
     ]
Example #11
0
 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,
                            }),
     ]
Example #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,
                            }),
     ]
Example #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()),
     ]
Example #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,
                            }),
     ]
Example #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))
Example #17
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 = 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))
Example #19
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 = 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
                                })
     ]
Example #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
Example #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
Example #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')]
Example #23
0
 def _filter_pip_requires_line(self, fn, line):
     if utils.has_any(line.lower(), 'quantumclient', 'glance'):
         return None
     return line
Example #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
Example #25
0
 def _filter_pip_requires_line(self, fn, line):
     if utils.has_any(line.lower(), 'swift', 'keystoneclient'):
         return None
     return line
Example #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')]
Example #27
0
 def _filter_pip_requires_line(self, fn, line):
     if utils.has_any(line.lower(), 'swift', 'keystoneclient'):
         return None
     return line
Example #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")
     ]
Example #29
0
 def _filter_pip_requires(self, fn, lines):
     return [l for l in lines
             if not utils.has_any(l.lower(), 'swift', 'keystoneclient')]
Example #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')
     ]
Example #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')
     ]
Example #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
Example #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
Example #34
0
 def _filter_pip_requires(self, fn, lines):
     return [l for l in lines
             if not utils.has_any(l.lower(), 'swift', 'keystoneclient')]
Example #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