Beispiel #1
0
 def test_inject_auth(self, mock_get_vm, mock_create, mock_vutils):
     uc = Undercloud('img_path', 'tplt_path', external_network=True)
     uc.root_pw = 'test'
     uc.inject_auth()
     test_ops = [{'--root-password': '******'},
                 {'--run-command': 'mkdir -p /root/.ssh'},
                 {'--upload':
                  '/root/.ssh/id_rsa.pub:/root/.ssh/authorized_keys'},
                 {'--run-command': 'chmod 600 /root/.ssh/authorized_keys'},
                 {'--run-command': 'restorecon '
                                   '-R -v /root/.ssh'},
                 {'--run-command': 'id -u stack || useradd -m stack'},
                 {'--run-command': 'mkdir -p /home/stack/.ssh'},
                 {'--run-command': 'chown stack:stack /home/stack/.ssh'},
                 {'--run-command':
                  'cp /root/.ssh/authorized_keys /home/stack/.ssh/'},
                 {'--run-command':
                  'chown stack:stack /home/stack/.ssh/authorized_keys'},
                 {'--run-command':
                  'chmod 600 /home/stack/.ssh/authorized_keys'},
                 {'--run-command':
                  'echo "stack       ALL = (ALL) NOPASSWD: ALL" >> '
                  '/etc/sudoers'},
                 {'--run-command': 'touch /etc/cloud/cloud-init.disabled'}]
     mock_vutils.virt_customize.assert_called_with(test_ops, uc.volume)
Beispiel #2
0
 def test_inject_auth(self, mock_get_vm, mock_create, mock_vutils):
     uc = Undercloud('img_path', 'tplt_path', external_network=True)
     uc.root_pw = 'test'
     uc.inject_auth()
     test_ops = [{
         '--root-password': '******'
     }, {
         '--run-command': 'mkdir -p /root/.ssh'
     }, {
         '--upload':
         '/root/.ssh/id_rsa.pub:/root/.ssh/authorized_keys'
     }, {
         '--run-command': 'chmod 600 /root/.ssh/authorized_keys'
     }, {
         '--run-command': 'restorecon /root/.ssh/authorized_keys'
     }, {
         '--run-command':
         'cp /root/.ssh/authorized_keys /home/stack/.ssh/'
     }, {
         '--run-command':
         'chown stack:stack /home/stack/.ssh/authorized_keys'
     }, {
         '--run-command':
         'chmod 600 /home/stack/.ssh/authorized_keys'
     }]
     mock_vutils.virt_customize.assert_called_with(test_ops, uc.volume)