Module: OsCtl::Cli::Attributes

Included in:
Container, Group, IdRange, Pool, Repository, User
Defined in:
lib/osctl/cli/attributes.rb

Instance Method Summary collapse

Instance Method Details

#do_set_attr(cmd, opts, name, value) ⇒ Object

Parameters:

  • cmd (Symbol)

    osctld command to use

  • opts (Hash)

    options for the osctld command

  • name (String)

    attribute name

  • value (String)

    attribute value



7
8
9
10
11
12
13
14
# File 'lib/osctl/cli/attributes.rb', line 7

def do_set_attr(cmd, opts, name, value)
  if /^[^:]+:.+$/ !~ name
    raise GLI::BadCommandLine,
          "attribute name is not in the required format '<vendor>:<key>'"
  end

  osctld_fmt(cmd, cmd_opts: opts.merge(attrs: { name => value }))
end

#do_unset_attr(cmd, opts, name) ⇒ Object

Parameters:

  • cmd (Symbol)

    osctld command to use

  • opts (Hash)

    options for the osctld command

  • name (String)

    attribute name



19
20
21
# File 'lib/osctl/cli/attributes.rb', line 19

def do_unset_attr(cmd, opts, name)
  osctld_fmt(cmd, cmd_opts: opts.merge(attrs: [name]))
end