add_self_service_xml
 add the correct XML indicating whether or not we're even in SSvc
543785
def add_in_self_service_xml(doc_root)
      return unless @self_service_data_config[:in_self_service_data_path]

      in_ss_section, in_ss_elem = @self_service_data_config[:in_self_service_data_path]

      in_ss_value = @in_self_service ? @self_service_data_config[:in_self_service] : @self_service_data_config[:not_in_self_service]

      in_ss_section_xml = doc_root.elements[in_ss_section.to_s]
      in_ss_section_xml ||= doc_root.add_element(in_ss_section.to_s)
      in_ss_section_xml.add_element(in_ss_elem.to_s).text = in_ss_value.to_s
    end
321544
static void checkJAXPAvailability() {
        try {
            XmlConfigurator.class.getName();
        }
        catch (NoClassDefFoundError error) {
            Error tmp=new NoClassDefFoundError(JAXP_MISSING_ERROR_MSG);
            tmp.initCause(error);
            throw tmp;
        }
    }
1180154
def update(nsc)
      xml = nsc.make_xml('DiscoveryConnectionUpdateRequest')
      xml.add_element(as_xml)

      response = nsc.execute(xml, '1.2')
      response.success
    end
1214200
def add_missing_xml_attributes(dom, volume_counter=0):
    
    mods_tag = get_mods_tag(dom)

    if mods_tag:
        params = mods_tag.params

        # add missing attributes
        params["ID"] = "MODS_VOLUME_%04d" % (volume_counter + 1)
        params["xmlns:mods"] = "http://www.loc.gov/mods/v3"
        params["xmlns:xlink"] = "http://www.w3.org/1999/xlink"
        params["xmlns:xsi"] = "http://www.w3.org/2001/XMLSchema-instance"
        params["xsi:schemaLocation"] = " ".join((
            "http://www.w3.org/2001/XMLSchema-instance",
            "http://www.w3.org/2001/XMLSchema.xsd",
            "http://www.loc.gov/mods/v3",
            "http://www.loc.gov/standards/mods/v3/mods-3-4.xsd",
            "http://www.w3.org/1999/xlink http://www.w3.org/1999/xlink.xsd",
        ))
1354902
def parse_self_service_notifications(ss_data)
      return unless @self_service_data_config[:notifications_supported]

      # oldstyle/broken, we need the XML to know if notifications are turned on
      if @self_service_data_config[:notifications_supported] == :ssvc_only && @in_jss
        ssrsrc = "#{rest_rsrc}/subset/selfservice"
        raw_xml = api.get_rsrc(ssrsrc, :xml)
        @self_service_notifications_enabled = raw_xml.include? '<notification>true</notification>'
        @self_service_notification_type = NOTIFICATION_TYPES.invert[ss_data[:notification]]
        @self_service_notification_subject = ss_data[:notification_subject]
        @self_service_notification_message = ss_data[:notification_message]
        return
      end

      # newstyle, 'notifications' subset
      notif_data = ss_data[:notifications]
      notif_data ||= {}

      @self_service_notifications_enabled = notif_data[:notification_enabled]
      @self_service_notification_type = NOTIFICATION_TYPES.invert[notif_data[:notification_type]]
      @self_service_notification_type ||= DFT_NOTIFICATION_TYPE
      @self_service_notification_subject = notif_data[:notification_subject]
      @self_service_notification_message = notif_data[:notification_message]

      reminders = notif_data[:reminders]
      reminders ||= {}
      @self_service_reminders_enabled = reminders[:notification_reminders_enabled]
      @self_service_reminder_frequency = reminders[:notification_reminder_frequency]
    end
907551
def _add_identities_xml(self, document):
        
        for fingerprint in self.identities:
            identity_element = document.createElement(
                'allow-access-from-identity'
            )
            signatory_element = document.createElement(
                'signatory'
            )
            certificate_element = document.createElement(
                'certificate'
            )
            certificate_element.setAttribute(
                'fingerprint',
                fingerprint)
            certificate_element.setAttribute(
                'fingerprint-algorithm',
                'sha-1')
            signatory_element.appendChild(certificate_element)
            identity_element.appendChild(signatory_element)
            document.documentElement.appendChild(identity_element)
447459
def vserver_sslcert_add(v_name, sc_name, **connection_args):
    '''
    
    '''
    ret = True
    if vserver_sslcert_exists(v_name, sc_name, **connection_args):
        return False
    nitro = _connect(**connection_args)
    if nitro is None:
        return False
    sslcert = NSSSLVServerSSLCertKeyBinding()
    sslcert.set_vservername(v_name)
    sslcert.set_certkeyname(sc_name)
    try:
        NSSSLVServerSSLCertKeyBinding.add(nitro, sslcert)
    except NSNitroError as error:
        log.debug('netscaler module error - NSSSLVServerSSLCertKeyBinding.add() failed: %s', error)
        ret = False
    _disconnect(nitro)
    return ret
1217123
def add_asset_linking_to_xml(xml, enabled)
      elem = REXML::XPath.first(xml, '//AssetCorrelation')
      return nil unless elem

      elem.attributes['enabled'] = enabled ? '1' : '0'
    end
1142358
protected void addNs(final XmlEmit xml,
                       final String val) throws Throwable {
    if (xml.getNameSpace(val) == null) {
      xml.addNs(new NameSpace(val, null), false);
    }
  }
113461
def tag_myself(project='cwc', **other_tags):
    """"""
    base_url = "http://169.254.169.254"
    try:
        resp = requests.get(base_url + "/latest/meta-data/instance-id")
    except requests.exceptions.ConnectionError:
        logger.warning("Could not connect to service. Note this should only "
                       "be run from within a batch job.")
        return
    instance_id = resp.text
    tag_instance(instance_id, project=project, **other_tags)
    return
832368
def r_sa_check(template, tag_type, is_standalone):
    """"""

    # Check right side if we might be a standalone
    if is_standalone and tag_type not in ['variable', 'no escape']:
        on_newline = template.split('\n', 1)

        # If the stuff to the right of us are spaces we're a standalone
        if on_newline[0].isspace() or not on_newline[0]:
            return True
        else:
            return False

    # If we're a tag can't be a standalone
    else:
        return False
1014979
def rest_xml
      doc = REXML::Document.new JSS::APIConnection::XML_HEADER
      group = doc.add_element self.class::RSRC_OBJECT_KEY.to_s
      group.add_element('name').text = @name
      group.add_element('is_smart').text = @is_smart
      if @is_smart
        group << @criteria.rest_xml if @criteria
      else
        group << self.class::MEMBER_CLASS.xml_list(@members, :id)
      end

      add_site_to_xml(doc)

      doc.to_s
    end
564869
def build_xml(opts = {})
      opts = {:bus => @bus, :os_type => :hvm}.merge!(opts)

      builder = Builder::XmlMarkup.new(:indent => 2)

      xml = builder.domain(:type => opts[:domain_type].to_s) do |domain|
        domain.name(@appliance_name)
        domain.description(@appliance_config.summary)
        domain.memory(@appliance_config.hardware.memory * 1024) #KB
        domain.vcpu(@appliance_config.hardware.cpus)
        domain.os do |os|
          os.type(opts[:os_type].to_s, :arch => @appliance_config.hardware.arch)
          os.boot(:dev => 'hd')
        end
        domain.devices do |devices|
          devices.disk(:type => 'file', :device => 'disk') do |disk|
            disk.source(:file => "#{@libvirt_image_uri}/#{File.basename(@previous_deliverables.disk)}")
            disk.target(:dev => 'hda', :bus => opts[:bus].to_s)
          end
          devices.interface(:type => 'network') do |interface|
            interface.source(:network => @network)
            interface.mac(:address => @mac) if @mac
          end
          devices.console(:type => 'pty') unless @noautoconsole
          devices.graphics(:type => 'vnc', :port => -1) unless @novnc
        end
        domain.features do |features|
          features.pae if @appliance_config.os.pae
        end
      end
      @log.debug xml

      # Let the user modify the XML specification to their requirements
      if @script
        @log.info "Attempting to run user provided script for modifying libVirt XML..."
        xml = IO::popen("#{@script} --domain '#{xml}'").read
        @log.debug "Response was: #{xml}"
      end
      xml
    end
199566
def add_vnic_template(self, vlan_id, ucsm_ip, vnic_template, physnet):
        """"""
        if not self.get_vnic_template_vlan_entry(vlan_id, vnic_template,
            ucsm_ip, physnet):
            vnic_t = ucsm_model.VnicTemplate(vlan_id=vlan_id,
                                             vnic_template=vnic_template,
                                             device_id=ucsm_ip,
                                             physnet=physnet,
                                             updated_on_ucs=False)
            with self.session.begin(subtransactions=True):
                self.session.add(vnic_t)
            return vnic_t
1280017
protected function checkForSSHClientOrInstall()
    {
        if (! File::exists(self::USR_BIN_SSH)) {
            $this->info('No SSH client found on your system (' . self::USR_BIN_SSH .')!');
            $this->installSshClient();
        } else {
            $this->info('SSH client found in your system (' . self::USR_BIN_SSH .')...');
        }
    }
162344
def parse_self_service
      @self_service_data_config = SELF_SERVICE_CLASSES[self.class]

      subset_key = @self_service_data_config[:self_service_subset] ? @self_service_data_config[:self_service_subset] : :self_service

      ss_data = @init_data[subset_key]
      ss_data ||= {}

      @in_self_service = in_self_service_at_init?

      @self_service_description = ss_data[:self_service_description]

      @icon = JSS::Icon.new(ss_data[:self_service_icon]) if ss_data[:self_service_icon]

      @self_service_feature_on_main_page = ss_data[:feature_on_main_page]

      @self_service_categories = ss_data[:self_service_categories]
      @self_service_categories ||= []

      parse_self_service_profile ss_data

      return unless self_service_targets.include? :macos

      # Computers only...
      @self_service_display_name = ss_data[:self_service_display_name]
      @self_service_display_name ||= name
      @self_service_install_button_text = ss_data[:install_button_text]
      @self_service_reinstall_button_text = ss_data[:reinstall_button_text]
      @self_service_force_users_to_view_description = ss_data[:force_users_to_view_description]

      parse_self_service_notifications ss_data
    end
581814
def rest_xml
      doc = REXML::Document.new JSS::APIConnection::XML_HEADER
      tmpl = doc.add_element self.class::RSRC_OBJECT_KEY.to_s
      tmpl.add_element('name').text = @name
      doc.to_s
    end