module Chef::Knife::Cloud::OpenstackServerCreateOptions

Public Class Methods

included(includer) click to toggle source
# File lib/chef/knife/cloud/openstack_server_create_options.rb, line 24
def self.included(includer)
  includer.class_eval do
    include ServerCreateOptions

    # Openstack Server create params.
    option :private_network,
      long: "--openstack-private-network",
      description: "Use the private IP for bootstrapping rather than the public IP",
      boolean: true,
      default: false

    option :openstack_floating_ip,
      short: "-a [IP]",
      long: "--openstack-floating-ip [IP]",
      default: "-1",
      description: "Request to associate a floating IP address to the new OpenStack node. Assumes IPs have been allocated to the project. Specific IP is optional."

    option :openstack_volumes,
      long: "--openstack-volumes VOLUME1,VOLUME2,VOLUME3",
      description: "Comma separated list of the UUID(s) of the volume(s) to attach to the server",
      proc: proc { |volumes| volumes.split(",") }

    option :openstack_scheduler_hints,
      long: "--scheduler-hints HINTS",
      description: "A scheduler group hint to OpenStack"

    option :openstack_security_groups,
      short: "-G X,Y,Z",
      long: "--openstack-groups X,Y,Z",
      description: "The security groups for this server",
      default: ["default"],
      proc: proc { |groups| groups.split(",") }

    option :openstack_ssh_key_id,
      short: "-S KEY",
      long: "--openstack-ssh-key-id KEY",
      description: "The OpenStack SSH keypair id"

    option :user_data,
      long: "--user-data USER_DATA",
      description: "The file path containing user data information for this server",
      proc: proc { |user_data| open(user_data, &:read) }

    option :bootstrap_network,
      long: "--bootstrap-network NAME",
      default: "public",
      description: "Specify network for bootstrapping. Default is 'public'."

    option :network,
      long: "--no-network",
      boolean: true,
      default: true,
      description: "Use first available network for bootstrapping if 'public' and 'private' are unavailable."

    option :network_ids,
      long: "--network-ids NETWORK_ID_1,NETWORK_ID_2,NETWORK_ID_3",
      description: "Comma separated list of the UUID(s) of the network(s) for the server to attach",
      proc: proc { |networks| networks.split(",") }

    option :availability_zone,
      short: "-Z ZONE_NAME",
      long: "--availability-zone ZONE_NAME",
      description: "The availability zone for this server"

    option :metadata,
      short: "-M X=1",
      long: "--metadata X=1",
      description: "Metadata information for this server (may pass multiple times)",
      proc: proc { |data, accumulator|
        accumulator ||= {}
        accumulator.merge!(data.split("=")[0] => data.split("=")[1])
      }

    option :secret_file,
      long: "--secret-file SECRET_FILE",
      description: "A file containing the secret key to use to encrypt data bag item values"

    option :secret,
      long: "--secret ",
      description: "The secret key to use to encrypt data bag item values"
  end
end