723
731
self.assertEquals(write_file.call_args_list, expected)
725
733
@patch.object(cinder_utils, 'services')
726
@patch.object(cinder_utils, 'git_src_dir')
727
@patch.object(cinder_utils, 'service_restart')
728
@patch.object(cinder_utils, 'render')
729
@patch.object(cinder_utils, 'pip_install')
730
734
@patch('os.path.join')
731
735
@patch('os.path.exists')
732
736
@patch('shutil.copytree')
733
737
@patch('shutil.rmtree')
734
@patch('pwd.getpwnam')
735
@patch('grp.getgrnam')
736
738
@patch('os.chown')
737
739
@patch('os.chmod')
738
740
@patch('os.symlink')
739
def test_git_post_install(self, symlink, chmod, chown, grp, pwd, rmtree,
740
copytree, exists, join, pip_install, render,
741
service_restart, git_src_dir, services):
741
def test_git_post_install_upstart(self, symlink, chmod, chown, rmtree,
742
copytree, exists, join, services):
742
743
services.return_value = ['svc1']
743
744
projects_yaml = openstack_origin_git
744
745
join.return_value = 'joined-string'
746
self.lsb_release.return_value = {'DISTRIB_RELEASE': '15.04'}
745
747
cinder_utils.git_post_install(projects_yaml)
746
pip_install('mysql-python', venv='joined-string')
748
self.pip_install('mysql-python', venv='joined-string')
748
750
call('joined-string', '/etc/cinder'),
821
823
cinder_volume_context, perms=0o644,
822
824
templates_dir='joined-string'),
824
self.assertEquals(render.call_args_list, expected)
826
self.assertEquals(self.render.call_args_list, expected)
825
827
expected = [call('tgtd'), call('svc1')]
826
self.assertEquals(service_restart.call_args_list, expected)
828
self.assertEquals(self.service_restart.call_args_list, expected)
830
@patch.object(cinder_utils, 'services')
831
@patch('os.path.join')
832
@patch('shutil.copytree')
833
@patch('shutil.rmtree')
834
@patch('pwd.getpwnam')
835
@patch('grp.getgrnam')
839
def test_git_post_install_systemd(self, symlink, chmod, chown, grp, pwd,
840
rmtree, copytree, join, services):
841
projects_yaml = openstack_origin_git
842
join.return_value = 'joined-string'
843
self.lsb_release.return_value = {'DISTRIB_RELEASE': '15.10'}
844
cinder_utils.git_post_install(projects_yaml)
847
call('cinder.conf', '/etc/cinder/cinder.conf', {},
848
group='cinder', owner='cinder', perms=420),
849
call('git/cinder_tgt.conf', '/etc/tgt/conf.d', {},
850
group='cinder', owner='cinder', perms=420),
851
call('git/logging.conf', '/etc/cinder/logging.conf', {},
852
group='cinder', owner='cinder', perms=420),
853
call('git/cinder_sudoers', '/etc/sudoers.d/cinder_sudoers', {},
854
group='root', owner='root', perms=288),
855
call('git/cinder-api.init.in.template', 'joined-string',
856
{'daemon_path': 'joined-string'}, perms=420),
857
call('git/cinder-backup.init.in.template', 'joined-string',
858
{'daemon_path': 'joined-string'}, perms=420),
859
call('git/cinder-scheduler.init.in.template', 'joined-string',
860
{'daemon_path': 'joined-string'}, perms=420),
861
call('git/cinder-volume.init.in.template', 'joined-string',
862
{'daemon_path': 'joined-string'}, perms=420),
864
self.assertEquals(self.render.call_args_list, expected)
828
866
@patch.object(cinder_utils, 'local_unit', lambda *args: 'unit/0')
829
867
def test_check_db_initialised_by_self(self):