Skip to content

Commit

Permalink
Move target iteration to core baseline CLI method.
Browse files Browse the repository at this point in the history
  • Loading branch information
forestmonster committed Feb 2, 2019
1 parent a746d8e commit 1a6eae2
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 3 deletions.
2 changes: 1 addition & 1 deletion diffy/plugins/bases/inventory.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,5 @@ class InventoryPlugin(Plugin):
type = "inventory"
_schema = PluginOptionSchema

def process(self, **kwargs):
def get(self, **kwargs):
raise NotImplementedError
21 changes: 19 additions & 2 deletions diffy_cli/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -140,21 +140,38 @@ def new():
@new.command('baseline')
@click.argument('target-key')
@click.option('--target-plugin', default='local-target', callback=get_plugin_callback)
# TODO: Make 'target' and 'inventory' plugins mutually exclusive
# TODO: Consider an 'async' flag
@click.option('--inventory-plugin', callback=get_plugin_callback)
@click.option('--persistence-plugin', default='local-file', callback=get_plugin_callback)
@click.option('--payload-plugin', default='local-command', callback=get_plugin_callback)
@click.option('--collection-plugin', default='local-shell-collection', callback=get_plugin_callback)
@click.option('--incident-id', default='None')
@add_plugins_args
def baseline_command(
target_key,
incident_id,
target_plugin,
inventory_plugin,
persistence_plugin,
collection_plugin,
payload_plugin,
collection_plugin,
incident_id,
**kwargs,
):
"""Creates a new baseline based on the given ASG."""
if inventory_plugin:
for item in inventory_plugin['plugin'].get():
target_plugin['options'] = item['options']
baseline(
item['target'],
item['target_plugin'],
payload_plugin,
collection_plugin,
persistence_plugin,
incident_id=incident_id,
**kwargs,
)

baselines = baseline(
target_key,
target_plugin,
Expand Down

0 comments on commit 1a6eae2

Please sign in to comment.