]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
Merge pull request #39436 from rhcs-dashboard/wip-48654-octopus
authorYuri Weinstein <yweinste@redhat.com>
Fri, 12 Mar 2021 17:05:07 +0000 (09:05 -0800)
committerGitHub <noreply@github.com>
Fri, 12 Mar 2021 17:05:07 +0000 (09:05 -0800)
octopus: mgr/dashboard: CLI commands: read passwords from file

Reviewed-by: Avan Thakkar <athakkar@redhat.com>
Reviewed-by: Laura Paduano <lpaduano@suse.com>
1  2 
qa/tasks/mgr/dashboard/helper.py
qa/tasks/mgr/dashboard/test_auth.py
src/cephadm/cephadm
src/pybind/mgr/mgr_module.py

index 7c491968259ac09d8bdcf58c5d5d46fd2755d647,93d755937151aa3323c3c005d5ed748a2ad58b5d..4c5cd8d72e72cdad29337afffc299656262f540e
@@@ -429,9 -433,25 +432,25 @@@ class DashboardTestCase(MgrTestCase)
      @classmethod
      def _ceph_cmd_result(cls, cmd):
          exitstatus = cls.mgr_cluster.mon_manager.raw_cluster_cmd_result(*cmd)
 -        log.info("command exit status: %d", exitstatus)
 +        log.debug("command exit status: %d", exitstatus)
          return exitstatus
  
+     @classmethod
+     def _ceph_cmd_with_secret(cls, cmd: List[str], secret: str, return_exit_code: bool = False):
+         cmd.append('-i')
+         cmd.append('{}'.format(cls._ceph_create_tmp_file(secret)))
+         if return_exit_code:
+             return cls._ceph_cmd_result(cmd)
+         return cls._ceph_cmd(cmd)
+     @classmethod
+     def _ceph_create_tmp_file(cls, content: str) -> str:
+         """Create a temporary file in the remote cluster"""
+         file_name = ''.join(random.choices(string.ascii_letters + string.digits, k=20))
+         file_path = '/tmp/{}'.format(file_name)
+         cls._cmd(['sh', '-c', 'echo -n {} > {}'.format(content, file_path)])
+         return file_path
      def set_config_key(self, key, value):
          self._ceph_cmd(['config-key', 'set', key, value])
  
Simple merge
Simple merge
Simple merge