Example #1
0
def install_packages(*roles):
    """Install packages for the given roles."""
    roles = list(roles)
    if roles == ["all"]:
        roles = SERVER_ROLES
    if "base" not in roles:
        roles.insert(0, "base")
    config_file = os.path.join(CONF_ROOT, u"packages.conf")
    config = ConfigParser.SafeConfigParser()
    config.read(config_file)
    for role in roles:
        if config.has_section(role):
            # Get ppas
            if config.has_option(role, "ppas"):
                for ppa in config.get(role, "ppas").split(" "):
                    system.add_ppa(ppa, update=False)
            # Get sources
            if config.has_option(role, "sources"):
                for section in config.get(role, "sources").split(" "):
                    source = config.get(section, "source")
                    key = config.get(section, "key")
                    system.add_apt_source(source=source, key=key, update=False)
            sudo(u"apt-get update")
            sudo(u"apt-get install -y %s" % config.get(role, "packages"))
            sudo(u"apt-get upgrade -y")
Example #2
0
def install_packages(*roles):
    """Install packages for the given roles."""
    config_file = os.path.join(CONF_ROOT, u'packages.conf')
    config = ConfigParser.SafeConfigParser()
    config.read(config_file)
    for role in roles:
        if config.has_section(role):
            # Get ppas
            if config.has_option(role, 'ppas'):
                for ppa in config.get(role, 'ppas').split(' '):
                    system.add_ppa(ppa, update=False)
            # Get sources
            if config.has_option(role, 'sources'):
                for section in config.get(role, 'sources').split(' '):
                    source = config.get(section, 'source')
                    key = config.get(section, 'key')
                    system.add_apt_source(source=source, key=key, update=False)
            # sudo(u"apt-get update")
            sudo(u"apt-get install -y %s" % config.get(role, 'packages'))
Example #3
0
def install_packages(*roles):
    """Install packages for the given roles."""
    config_file = os.path.join(CONF_ROOT, u'packages.conf')
    config = ConfigParser.SafeConfigParser()
    config.read(config_file)
    for role in roles:
        if config.has_section(role):
            # Get ppas
            if config.has_option(role, 'ppas'):
                for ppa in config.get(role, 'ppas').split(' '):
                    system.add_ppa(ppa, update=False)
            # Get sources
            if config.has_option(role, 'sources'):
                for section in config.get(role, 'sources').split(' '):
                    source = config.get(section, 'source')
                    key = config.get(section, 'key')
                    system.add_apt_source(source=source, key=key, update=False)
            sudo(u"apt-get update")
            sudo(u"apt-get install -y %s" % config.get(role, 'packages'))
            sudo(u"apt-get upgrade -y")
Example #4
0
 def test_add_ppa_no_update(self):
     "Add PPA without updating sources."
     with patch('argyle.system.update_apt_sources') as update:
         system.add_ppa('ppa:nginx/stable', update=False)
         self.assertSudoCommand('add-apt-repository ppa:nginx/stable')
         self.assertFalse(update.called)
Example #5
0
 def test_add_ppa(self):
     "Add PPA and refresh apt-sources."
     with patch('argyle.system.update_apt_sources') as update:
         system.add_ppa('ppa:nginx/stable')
         self.assertSudoCommand('add-apt-repository ppa:nginx/stable')
         self.assertTrue(update.called)
Example #6
0
 def test_add_ppa_no_update(self):
     "Add PPA without updating sources."
     with patch('argyle.system.update_apt_sources') as update:
         system.add_ppa('ppa:nginx/stable', update=False)
         self.assertSudoCommand('add-apt-repository ppa:nginx/stable')
         self.assertFalse(update.called)
Example #7
0
 def test_add_ppa(self):
     "Add PPA and refresh apt-sources."
     with patch('argyle.system.update_apt_sources') as update:
         system.add_ppa('ppa:nginx/stable')
         self.assertSudoCommand('add-apt-repository ppa:nginx/stable')
         self.assertTrue(update.called)