Sha256: 12726ca364897ddebe0eb8e4e1700b7d7dd4e3c10f9f78ea9933589c3c881d81
Contents?: true
Size: 1.78 KB
Versions: 2
Compression:
Stored size: 1.78 KB
Contents
# -*- coding: utf-8 -*- module Dcmgr::Cli class Vlan < Base namespace :vlan M = Dcmgr::Models desc "add [options]", "Create a new vlan lease" method_option :uuid, :type => :string, :desc => "The UUID for the new vlan lease" method_option :account_id, :type => :string, :desc => "The UUID of the account for this vlan lease" method_option :tag_id, :type => :numeric, :desc => "The ethernet tag for this vlan lease" def add UnknownUUIDError.raise(options[:account_id]) if M::Account[options[:account_id]].nil? Error.raise("Tag_id already exists",100) unless M::VlanLease.find(:tag_id => options[:tag_id]).nil? puts super(M::VlanLease,options) end desc "del UUID", "Delete an existing vlan lease" def del(uuid) super(M::VlanLease,uuid) end desc "modify UUID [options]", "Modify an existing vlan lease" method_option :account_id, :type => :string, :desc => "The UUID of the account for this vlan lease" method_option :tag_id, :type => :numeric, :desc => "The ethernet tag for this vlan lease" def modify(uuid) UnknownUUIDError.raise(options[:account_id]) if options[:account_id] && M::Account[options[:account_id]].nil? super(M::VlanLease,uuid,options) end desc "show [UUID]", "Show existing vlan lease(s)" def show(uuid=nil) if uuid lease = M::VlanLease[uuid] || UnknownUUIDError.raise(uuid) puts ERB.new(<<__END, nil, '-').result(binding) Vlan Lease UUID: <%= lease.canonical_uuid %> Account id: <%= lease.account_id %> Tag id: <%= lease.tag_id %> __END else puts ERB.new(<<__END, nil, '-').result(binding) <%- M::VlanLease.each { |row| -%> <%= row.canonical_uuid %>\t<%= row.account_id %>\t<%= row.tag_id %> <%- } -%> __END end end end end
Version data entries
2 entries across 2 versions & 2 rubygems
Version | Path |
---|---|
wakame-vdc-agents-11.12.0 | lib/dcmgr/cli/vlan.rb |
wakame-vdc-dcmgr-11.12.0 | lib/dcmgr/cli/vlan.rb |