Project

General

Profile

Feature #8015

Ability to use user's default Org/Location in hammer CLI

Added by Dominic Cleal almost 5 years ago. Updated about 3 years ago.

Status:
Closed
Priority:
Normal
Assignee:
Category:
Foreman commands (obsolete)
Target version:
Team Backlog:
Fixed in Releases:
Found in Releases:

Description

Cloned from https://bugzilla.redhat.com/show_bug.cgi?id=1154383
Description of problem:
This RFE requests the ability to set the default organization/location of a user that is leveraging Hammer CLI. This would save the user a great deal of typing when accessing the CLI.

This value can potentially be:

  • Set within the cli_config.yml file.
  • Inherited from the user's 'Default Organization | Default Locaiton' setting in the UI

Version-Release number of selected component (if applicable):
rubygem-hammer_cli-0.1.1-12.el6sat.noarch

Associated revisions

Revision 417e7163 (diff)
Added by Alon Goldboim over 3 years ago

Fixes #8015 - Added defaults options in hammer cli

First patch

replacing tabs with spaces

reuse directory constant

- it should be defined at a single place to avoid complications when
there's need to rename
- such constants should be extracted from translation strings

fixed indentation

variables renamed to more meaningful names

- just a cosmetic thing - you had the file contents named file which I
found confusing

removed comment that was no longer true

defaults moved to context

- avoids mocking the global defaults class which makes testing a lot easier. See my next commit with tests.

adding tests for the commands

- before they weren't tested at all

assert_equal takes expected value as the first parameter

- in assertions the first parameter is always the expected one
- see for example
http://ruby-doc.org/stdlib-2.0.0/libdoc/minitest/rdoc/MiniTest/Assertions.html

fixing test that actually tested only the mocking mechanism

- changed data of one test to make sure the tested modification actually
happens. Before it was in the expected state already.
- "should get the default param, with provider" actually only tested
mocking

use specific exceptions

- formerly used NameError can be raised also when a method is missing,
which makes debugging more difficult
- similar goes for StandardError

use instance of defaults

- allows for injecting the filename
- no need to pollute the global defaults when testing it

Revision 31b7822c
Added by Martin Bacovsky over 3 years ago

Merge pull request #174 from alongoldboim/8015

Fixes #8015 - Enable adding defaults options for commands.

Revision 32cd78bc (diff)
Added by Martin Bacovsky about 3 years ago

Refs #8015 - allow param names to contain dashes

Refs #8015 - allow param names to contain dashes

It seems more intuitive to use the param names in form they appear on
the command-line (organization_id vs. organization-id). This patch is
adding support for names with dashes.

History

#1 Updated by Dominic Cleal almost 5 years ago

  • Category set to Foreman commands (obsolete)

This'll depend on API enhancements I expect. I think it's possible to set the org context, but not to automatically use the default org specified on the user. You'd also want a clear way to set "any context".

#2 Updated by Ohad Levy about 4 years ago

  • Assignee set to Alon Goldboim

#3 Updated by The Foreman Bot about 4 years ago

  • Status changed from New to Ready For Testing
  • Pull request https://github.com/theforeman/hammer-cli-foreman/pull/186 added
  • Pull request deleted ()

#4 Updated by Dominic Cleal about 4 years ago

  • Status changed from Ready For Testing to Assigned
  • Pull request added
  • Pull request deleted (https://github.com/theforeman/hammer-cli-foreman/pull/186)

#5 Updated by The Foreman Bot about 4 years ago

  • Status changed from Assigned to Ready For Testing
  • Pull request https://github.com/theforeman/hammer-cli/pull/174 added
  • Pull request deleted ()

#6 Updated by Tomáš Strachota almost 4 years ago

  • Target version set to hammer-cli 0.5.0

#7 Updated by Alon Goldboim over 3 years ago

  • Status changed from Ready For Testing to Closed
  • % Done changed from 0 to 100

#8 Updated by The Foreman Bot over 3 years ago

  • Pull request https://github.com/theforeman/hammer-cli/pull/203 added

Also available in: Atom PDF