def generate_user_data(lxd_params, options)
      logger.info("Calling <#{__method__.to_s}>")

      lxd_params[:config] = {}

      if options[:'no-maas']
        lxd_params[:config][:"user.user-data"] = {}
      else
        sshkeys = maas.get_sshkeys
        pkg_repos = maas.get_package_repos

        lxd_params[:config][:'user.user-data'] = { 'ssh_authorized_keys' => [] }

        sshkeys.each do |key|
          lxd_params[:config][:'user.user-data']['ssh_authorized_keys'].push(key['key'])
        end

        pkg_repos.each do |repo|
          if repo['name'] == 'main_archive'
            lxd_params[:config][:'user.user-data']['apt_mirror'] = repo['url']
          end
        end

        lxd_params[:config][:"user.user-data"]['source_image_alias'] = lxd_params[:alias]
        lxd_params[:config][:"user.user-data"]['maas'] = true
      end

      if options[:'maas-on-lxc']
        lxd_params[:config][:"security.privileged"] = "true"
      end

      if options[:'lxd-in-lxd']
        lxd_params[:config][:"security.privileged"] = "true"
        lxd_params[:config][:"security.nesting"] = "true"
      end

      if options[:'kvm-in-lxd']
        lxd_params[:config][:"security.nesting"] = "true"
        lxd_params[:config][:"linux.kernel_modules"] = "iptable_nat, ip6table_nat, ebtables, openvswitch, kvm, kvm_intel, tap, vhost, vhost_net, vhost_scsi, vhost_vsock"
      end

      lxd_params[:config][:"user.user-data"]['gogetit'] = true

      # To disable to update apt database on first boot
      # so chef client can keep doing its job.
      lxd_params[:config][:'user.user-data']['package_update'] = false
      lxd_params[:config][:'user.user-data']['package_upgrade'] = false

      lxd_params[:config][:'user.user-data'] = generate_cloud_init_config(
        options,
        config,
        lxd_params[:config][:'user.user-data']
      )

      lxd_params[:config][:"user.user-data"] = \
        "#cloud-config\n" + YAML.dump(lxd_params[:config][:"user.user-data"])[4..-1]

      return lxd_params
    end
def generate_user_data(lxd_params, options)
      logger.info("Calling <#{__method__.to_s}>")

      lxd_params[:config] = {}

      if options[:'no-maas']
        lxd_params[:config][:"user.user-data"] = {}
      else
        sshkeys = maas.get_sshkeys
        pkg_repos = maas.get_package_repos

        lxd_params[:config][:'user.user-data'] = { 'ssh_authorized_keys' => [] }

        sshkeys.each do |key|
          lxd_params[:config][:'user.user-data']['ssh_authorized_keys'].push(key['key'])
        end

        pkg_repos.each do |repo|
          if repo['name'] == 'main_archive'
            lxd_params[:config][:'user.user-data']['apt_mirror'] = repo['url']
          end
        end

        lxd_params[:config][:"user.user-data"]['source_image_alias'] = lxd_params[:alias]
        lxd_params[:config][:"user.user-data"]['maas'] = true
      end

      if options[:'maas-on-lxc']
        lxd_params[:config][:"security.privileged"] = "true"
      end

      if options[:'lxd-in-lxd']
        lxd_params[:config][:"security.privileged"] = "true"
        lxd_params[:config][:"security.nesting"] = "true"
      end

      if options[:'kvm-in-lxd']
        lxd_params[:config][:"security.nesting"] = "true"
        lxd_params[:config][:"linux.kernel_modules"] = "iptable_nat, ip6table_nat, ebtables, openvswitch, kvm, kvm_intel, tap, vhost, vhost_net, vhost_scsi, vhost_vsock"
      end

      lxd_params[:config][:"user.user-data"]['gogetit'] = true

      # To disable to update apt database on first boot
      # so chef client can keep doing its job.
      lxd_params[:config][:'user.user-data']['package_update'] = false
      lxd_params[:config][:'user.user-data']['package_upgrade'] = false

      lxd_params[:config][:'user.user-data'] = generate_cloud_init_config(
        options,
        config,
        lxd_params[:config][:'user.user-data']
      )

      lxd_params[:config][:"user.user-data"] = \
        "#cloud-config\n" + YAML.dump(lxd_params[:config][:"user.user-data"])[4..-1]

      return lxd_params
    end
to generate 'user.user-data'