def run(self, result): """ Run the test suite on all the virtual machines """ for base_box in self.base_boxes: # Start a virtual machine using this base box self.current_box = base_box self.start_box() # Clear fabric connection cache with self.settings(): if env.host_string in connections: del connections[env.host_string] # Make sure the vagrant user can sudo to any user with self.settings(): require.sudoer('vagrant') # Make sure the package index is up to date with self.settings(): fabtools.deb.update_index() # Run the test suite unittest.BaseTestSuite.run(self, result) # Stop the virtual machine and clean up self.stop_box()
def run(self, result): """ Run the test suite on all the virtual machines """ # Clean up with lcd(os.path.dirname(__file__)): local('vagrant halt') local('vagrant destroy') for base_box in self.base_boxes: # Start a virtual machine using this base box self.current_box = base_box self.start_box() # Clear fabric connection cache with self.settings(): if env.host_string in connections: del connections[env.host_string] # Make sure the vagrant user can sudo to any user with self.settings(): require.sudoer('vagrant') # Run the test suite unittest.TestSuite.run(self, result) # Stop the virtual machine and clean up self.stop_box()
def run(self, result): """ Run the test suite on all the virtual machines """ for base_box in self.base_boxes: # Start a virtual machine using this base box self.current_box = base_box self.start_box() # Clear fabric connection cache with self.settings(): if env.host_string in connections: del connections[env.host_string] # Make sure the vagrant user can sudo to any user with self.settings(): require.sudoer('vagrant') # Make sure the package index is up to date with self.settings(): if fabtools.system.distrib_family() == 'debian': fabtools.deb.update_index() # Run the test suite unittest.BaseTestSuite.run(self, result) # Stop the virtual machine and clean up self.stop_box()
def setup_user(): """ Require user belonging to www-data and sudo groups that will be in charge of this project on remote server (all further actions should be executed as him) """ require.user(env.username, group="www-data", password=env.username, shell="/bin/bash") require.sudoer(env.username) env.user = env.username
def setup(self): ''' Prepare droplet for deployment. ''' import fabtools from fabtools import require droplet = self.get_or_create_droplet(self.name) print droplet.to_json() ip_address = droplet.ip_address with settings(host_string='root@{}'.format(ip_address)): run('uname -a') require.user('volkhin') require.sudoer('volkhin')
def _add_users(): for user in tg.USERS: username, password = user require.user(username, password=password, shell='/bin/bash') require.sudoer(username)
def adduser(username, password, pubkey): require.user(username, password=password, ssh_public_keys=pubkey, shell="/bin/bash") require.sudoer(username)
def setup(): require.user('rview', create_home=True, shell='/bin/bash', ssh_public_keys=[os.path.expanduser('~/.ssh/id_rsa.pub')]) require.sudoer('rview')