bin/pwn_bdba_groups in pwn-0.4.770 vs bin/pwn_bdba_groups in pwn-0.4.771

- old
+ new

@@ -9,11 +9,11 @@ OptionParser.new do |options| options.banner = "USAGE: #{$PROGRAM_NAME} [opts] " - options.on('-cCONFIG', '--config=CONFG', '<Required - Black Duck Binary Analysis YAML config>') do |c| + options.on('-cCONFIG', '--config=CONFIG', '<Required - Black Duck Binary Analysis YAML config>') do |c| opts[:config] = c end options.on('-CGROUP', '--create=GROUP', '<Required - Group/Sub-Group to Create>') do |g| opts[:group_name] = g @@ -21,11 +21,11 @@ options.on('-lNAME', '--list-group=NAME', '<Optional - List Group Details>') do |l| opts[:list_group_name] = l end - options.on('-pNAME', '--parent-group=NAME', '<Optional - Black Duck Binary Analysis Parent Group Name to Associate with Group>') do |p| + options.on('-pPNAME', '--parent-group=PNAME', '<Optional - Black Duck Binary Analysis Parent Group Name to Associate with Group>') do |p| opts[:parent_group_name] = p end end.parse! if opts.empty? @@ -43,12 +43,16 @@ yaml_config = YAML.load_file(config, symbolize_names: true) token = yaml_config[:token] raise "ERROR: BDBA Token Not Found: #{token}" if token.nil? + group_name = opts[:group_name] + raise "ERROR: BDBA Group Name Not Provided: #{group_name}" if group_name.nil? + list_group_name = opts[:list_group_name] parent_group_name = opts[:parent_group_name] + parent_id = nil if list_group_name || parent_group_name groups_resp = PWN::Plugins::BlackDuckBinaryAnalysis.get_groups( token: token ) @@ -75,12 +79,9 @@ ) puts group_details_resp.to_json exit 0 end end - - group_name = opts[:group_name] - raise "ERROR: BDBA Group Name Not Provided: #{group_name}" if group_name.nil? PWN::Plugins::BlackDuckBinaryAnalysis.create_group( token: token, name: group_name, parent_id: parent_id