''' from django.utils.encoding import python_2_unicode_compatible from django.template.loader import render_to_string from django.utils.translation import ugettext as _ from django.utils.html import escape import cbhooks from accounts.models import Role from orders.models import Order, get_current_time import orders.mail from utilities.logger import ThreadLogger from utilities.exceptions import CloudBoltException from quota.exceptions import QuotaError from quota.quota_set import QuotaSetError logger = ThreadLogger(__name__) @python_2_unicode_compatible class CustomOrder(Order): class Meta: app_label = 'orders' def approve_my_grms(self, profile=None): ''' in a multilevel approval, we need a user to partially (or fully) approve an order based on the GroupRoleMembership mappings (excluding) "approvers" (the default/single-level approval role) ''' if self.status != 'PENDING': return
from common.methods import set_progress from sst_custom_modules import sst_ansible_commons from utilities.logger import ThreadLogger logger = ThreadLogger('__name__') def run(job, logger=None, **kwargs): resource = kwargs.get('resource') inventory_group_id = kwargs.get("inventory_group", "{{inventory_group}}") playbook_path = kwargs.get("playbook_path", "{{playbook_path}}") extra_vars = kwargs.get("extra_vars", "{{extra_vars}}") server_name_regex_filter = None timeout_as_string = kwargs.get("timeout", "{{script_timeout}}") return sst_ansible_commons.run_playbooks( current_job=job, playbook_paths=playbook_path, extra_vars=extra_vars, server_name_regex_filter=server_name_regex_filter, timeout_as_string=timeout_as_string, resource=resource) def generate_options_for_inventory_group(profile=None, form_data=None, form_prefix=None, control_value=None, **kwargs):