def _delete_cloud_files(self, usernames, do_confirm=True):
        for username in usernames:
            if do_confirm and not confirm(
                    'Delete Cloud Files username {0}?'.format(username)):
                continue

            self.delete_cloud_files(username)
    def _delete_ssh_credentials(self, cluster_id, keynames, wait=False,
                                force=False):
        if not force:
            if not confirm('Remove these keys from this cluster?'):
                return

        return self.delete_ssh_credentials(cluster_id, keynames, wait)
Beispiel #3
0
    def _delete(self, cluster_id):
        display_result(self.get(cluster_id), ClusterDetail)

        if not confirm('Delete this cluster?'):
            return

        self.delete(cluster_id)
    def _delete_s3(self, access_key_ids, do_confirm=True):
        for access_key_id in access_key_ids:
            if do_confirm and not confirm(
                    'Delete S3 access key {0}?'.format(access_key_id)):
                continue

            self.delete_s3(access_key_id)
    def _delete_ambari(self, usernames, do_confirm=True):
        for username in usernames:
            if do_confirm and not confirm(
                    'Delete Ambari user {0}?'.format(username)):
                continue

            self.delete_ambari(username)
    def _delete(self, script_ids, do_confirm=True):
        for script_id in script_ids:
            prompt = 'Delete script {0}?'.format(script_id)
            if do_confirm and not confirm(prompt):
                continue

            self.delete(script_id)
    def _delete(self, stack_id, force=False):
        if not force:
            display_result(self.get(stack_id), StackDetail)

            if not confirm('Delete this stack?'):
                return

        self.delete(stack_id)
    def _delete(self, cluster_id, force=False):
        if not force:
            display_result(self.get(cluster_id), ClusterDetail)

            if not confirm('Delete this cluster?'):
                return

        self.delete(cluster_id)
    def _delete(self, stack_id, force=False):
        if not force:
            display_result(self.get(stack_id), StackDetail)

            if not confirm('Delete this stack?'):
                return

        self.delete(stack_id)
    def _delete(self, cluster_ids, force=False):
        for cluster_id in cluster_ids:
            if not force:
                display_result(self.get(cluster_id), ClusterDetail)

                if not confirm('Delete this cluster?'):
                    continue

            self.delete(cluster_id)
    def _delete(self, stack_ids, force=False):
        for stack_id in stack_ids:
            if not force:
                display_result(self.get(stack_id), StackDetail)

                if not confirm('Delete this stack?'):
                    continue

            self.delete(stack_id)
    def _delete_ssh_credentials(self,
                                cluster_id,
                                keynames,
                                wait=False,
                                force=False):
        if not force:
            if not confirm('Remove these keys from this cluster?'):
                return

        return self.delete_ssh_credentials(cluster_id, keynames, wait)
    def _delete(self, cluster_ids, force=False):
        for cluster_id in cluster_ids:
            if not force:
                cluster = self._get_by_name_or_id(cluster_id)
                cluster_id = cluster.id

                display_result(cluster, ClusterDetail)

                if not confirm('Delete this cluster?'):
                    continue

            self.delete(cluster_id)
    def _services(self, action, cluster_id, service_names, force=False):
        if not force:
            if service_names:
                services_str = 'service{0} {1}'.format(
                    's' if len(service_names) > 1 else '',
                    ', '.join(service_names))
            else:
                services_str = 'all services'

            dialog = '{0} {1} on cluster {2}?'.format(action.capitalize(),
                                                      services_str, cluster_id)

            if not confirm(dialog):
                return

        return self.services(action, cluster_id, service_names)
    def _create_default_ssh_credential(self):
        if not confirm('You have not uploaded any SSH key credentials; do '
                       'you want to upload {0} now?'.format(
                           DEFAULT_SSH_PUBKEY)):
            sys.exit(1)

        try:
            with open(expand(DEFAULT_SSH_PUBKEY)) as f:
                six.print_('SSH key does not exist; creating...')
                self._client.credentials.create_ssh_key(
                    DEFAULT_SSH_KEY,
                    f.read().strip())
        except IOError:
            six.print_('No SSH keypair found; to generate a keypair, run '
                       '`ssh-keygen`')
            sys.exit(1)

        return DEFAULT_SSH_KEY
    def _services(self, action, cluster_id, service_names, force=False):
        if not force:
            if service_names:
                services_str = 'service{0} {1}'.format(
                    's' if len(service_names) > 1 else '',
                    ', '.join(service_names))
            else:
                services_str = 'all services'

            dialog = '{0} {1} on cluster {2}?'.format(
                action.capitalize(),
                services_str,
                cluster_id)

            if not confirm(dialog):
                return

        return self.services(action, cluster_id, service_names)
    def _create_default_ssh_credential(self):
        if not confirm(
                'You have not uploaded any SSH key credentials; do '
                'you want to upload {0} now?'.format(DEFAULT_SSH_PUBKEY)):
            sys.exit(1)

        try:
            with open(expand(DEFAULT_SSH_PUBKEY)) as f:
                six.print_('SSH key does not exist; creating...')
                self._client.credentials.create_ssh_key(
                    DEFAULT_SSH_KEY,
                    f.read().strip())
        except IOError:
            six.print_('No SSH keypair found; to generate a keypair, run '
                       '`ssh-keygen`')
            sys.exit(1)

        return DEFAULT_SSH_KEY
Beispiel #18
0
    def _delete_ambari(self, username, do_confirm=True):
        if do_confirm and not confirm(
                'Delete Ambari user {0}?'.format(username)):
            return

        return self.delete_ambari(username)
    def _delete_ssh_key(self, name):
        if not confirm('Delete SSH key {0}?'.format(name)):
            return

        return self.delete_ssh_key(name)
    def _delete_ssh_key(self, names, do_confirm=True):
        for name in names:
            if do_confirm and not confirm('Delete SSH key {0}?'.format(name)):
                continue

            self.delete_ssh_key(name)
    def _delete_ambari(self, username, do_confirm=True):
        if do_confirm and not confirm(
                'Delete Ambari user {0}?'.format(username)):
            return

        return self.delete_ambari(username)
    def _delete_s3(self, access_key_id, do_confirm=True):
        if do_confirm and not confirm(
                'Delete S3 access key {0}?'.format(access_key_id)):
            return

        return self.delete_s3(access_key_id)
    def _delete_cloud_files(self, username, do_confirm=True):
        if do_confirm and not confirm(
                'Delete Cloud Files username {0}?'.format(username)):
            return

        return self.delete_cloud_files(username)
    def _delete_s3(self, access_key_id):
        if not confirm('Delete S3 access key {0}?'.format(access_key_id)):
            return

        return self.delete_s3(access_key_id)
Beispiel #25
0
    def _delete(self, script_id, do_confirm=True):
        if do_confirm and not confirm('Delete script {0}?'.format(script_id)):
            return

        return self.delete(script_id)
Beispiel #26
0
    def _delete_cloud_files(self, username, do_confirm=True):
        if do_confirm and not confirm(
                'Delete Cloud Files username {0}?'.format(username)):
            return

        return self.delete_cloud_files(username)
Beispiel #27
0
    def _delete_s3(self, access_key_id, do_confirm=True):
        if do_confirm and not confirm(
                'Delete S3 access key {0}?'.format(access_key_id)):
            return

        return self.delete_s3(access_key_id)
    def _delete_ssh_key(self, name, do_confirm=True):
        if do_confirm and not confirm('Delete SSH key {0}?'.format(name)):
            return

        return self.delete_ssh_key(name)
Beispiel #29
0
    def _delete_ssh_key(self, name, do_confirm=True):
        if do_confirm and not confirm('Delete SSH key {0}?'.format(name)):
            return

        return self.delete_ssh_key(name)
Beispiel #30
0
    def _delete(self, cluster_id, node_id, force=False):
        if not force and not confirm('Delete this node?'):
            return

        self.delete(cluster_id, node_id)