def verify_handler(self): ok = Ccp_Script_Args.verify_handler(self) if self.cli_opts.recipient_file and self.cli_opts.bug_number: log.error( 'Please specify either --output or --bug-number, not both') ok = False elif self.cli_opts.bug_number: # Use the server name in the path. hostname = socket.gethostname() # E.g., 'runic', 'my.home.domain' dot_index = hostname.find('.') if dot_index > 0: hostname = hostname[0:dot_index] # else, dot_index is 0 (unexpected, e.g., ".home.domain"?) # or dot_index is -1 (not found) self.cli_opts.recipient_file = ( #'/ccp/bin/ccpdev/private/runic/schema/bug_%s/recipient_file' '/ccp/bin/ccpdev/private/%s/schema/bug_%s/recipient_file' % ( socket.gethostname(), self.cli_opts.bug_number, )) elif not self.cli_opts.recipient_file: log.error('Please specify either --output or --bug-number.') ok = False num_inputs = 0 num_inputs += 1 if self.cli_opts.email_addrs else 0 num_inputs += 1 if self.cli_opts.usernames else 0 num_inputs += 1 if self.cli_opts.userids else 0 if num_inputs > 1: log.error( 'Cannot specify more than one of --emails, --usernames, --userids' ) ok = False g.assurt(self.cli_opts.split_count >= 1) return ok
def verify_handler(self): ok = Ccp_Script_Args.verify_handler(self) if self.cli_opts.recipient_file and self.cli_opts.bug_number: log.error( 'Please specify either --output or --bug-number, not both') ok = False elif self.cli_opts.bug_number: # Use the server name in the path. hostname = socket.gethostname() # E.g., 'runic', 'my.home.domain' dot_index = hostname.find('.') if dot_index > 0: hostname = hostname[0:dot_index] # else, dot_index is 0 (unexpected, e.g., ".home.domain"?) # or dot_index is -1 (not found) self.cli_opts.recipient_file = ( #'/ccp/bin/ccpdev/private/runic/schema/bug_%s/recipient_file' '/ccp/bin/ccpdev/private/%s/schema/bug_%s/recipient_file' % (socket.gethostname(), self.cli_opts.bug_number,)) elif not self.cli_opts.recipient_file: log.error('Please specify either --output or --bug-number.') ok = False num_inputs = 0 num_inputs += 1 if self.cli_opts.email_addrs else 0 num_inputs += 1 if self.cli_opts.usernames else 0 num_inputs += 1 if self.cli_opts.userids else 0 if num_inputs > 1: log.error( 'Cannot specify more than one of --emails, --usernames, --userids') ok = False g.assurt(self.cli_opts.split_count >= 1) return ok
def verify_handler(self): ok = Ccp_Script_Args.verify_handler(self) # if ((self.cli_opts.recipient_file or self.cli_opts.content_plain or self.cli_opts.content_html) and self.cli_opts.bug_number): log.error('%s%s' % ('Please specify either recipient_file, content_plain, and ', 'content_html, or --bug-number, not both',)) ok = False elif self.cli_opts.bug_number: self.cli_opts.recipient_file = ( '/ccp/bin/ccpdev/schema/runic/bug_%s/recipient_file' % (self.cli_opts.bug_number,)) if self.cli_opts.file_number: self.cli_opts.recipient_file += ( '.%d' % (self.cli_opts.file_number,)) self.cli_opts.content_plain = ( '/ccp/bin/ccpdev/schema/runic/bug_%s/content_plain' % (self.cli_opts.bug_number,)) self.cli_opts.content_html = ( '/ccp/bin/ccpdev/schema/runic/bug_%s/content_html' % (self.cli_opts.bug_number,)) elif (not (self.cli_opts.recipient_file and self.cli_opts.content_plain and self.cli_opts.content_html)): log.error('%s%s' % ('Please specify either --recipient-file, --plain, ', 'and --html, or --bug-number.',)) # file_paths = [ self.cli_opts.recipient_file, self.cli_opts.content_plain, self.cli_opts.content_html, ] if self.cli_opts.send_test_emails: file_paths.append(self.cli_opts.test_emails_file) for fpath in file_paths: if not os.path.exists(fpath): log.error('File does not exist: "%s"' % (fpath,)) ok = False # if self.cli_opts.send_test_emails: self.cli_opts.recipient_file = self.cli_opts.test_emails_file # return ok
def verify_handler(self): ok = Ccp_Script_Args.verify_handler(self) # if ((self.cli_opts.recipient_file or self.cli_opts.content_plain or self.cli_opts.content_html) and self.cli_opts.bug_number): log.error('%s%s' % ( 'Please specify either recipient_file, content_plain, and ', 'content_html, or --bug-number, not both', )) ok = False elif self.cli_opts.bug_number: self.cli_opts.recipient_file = ( '/ccp/bin/ccpdev/schema/runic/bug_%s/recipient_file' % (self.cli_opts.bug_number, )) if self.cli_opts.file_number: self.cli_opts.recipient_file += ('.%d' % (self.cli_opts.file_number, )) self.cli_opts.content_plain = ( '/ccp/bin/ccpdev/schema/runic/bug_%s/content_plain' % (self.cli_opts.bug_number, )) self.cli_opts.content_html = ( '/ccp/bin/ccpdev/schema/runic/bug_%s/content_html' % (self.cli_opts.bug_number, )) elif (not (self.cli_opts.recipient_file and self.cli_opts.content_plain and self.cli_opts.content_html)): log.error('%s%s' % ( 'Please specify either --recipient-file, --plain, ', 'and --html, or --bug-number.', )) # file_paths = [ self.cli_opts.recipient_file, self.cli_opts.content_plain, self.cli_opts.content_html, ] if self.cli_opts.send_test_emails: file_paths.append(self.cli_opts.test_emails_file) for fpath in file_paths: if not os.path.exists(fpath): log.error('File does not exist: "%s"' % (fpath, )) ok = False # if self.cli_opts.send_test_emails: self.cli_opts.recipient_file = self.cli_opts.test_emails_file # return ok
def verify_handler(self): ok = Ccp_Script_Args.verify_handler(self) if self.cli_opts.username == conf.anonymous_username: log.error('Please specify a real username (no anonymous cowards).') ok = False op_count = ( (1 if (self.cli_opts.update_branch is not None) else 0) + (1 if (self.cli_opts.new_branch_name) else 0) + (1 if (self.cli_opts.purge_branch) else 0)) if op_count != 1: log.error( 'Specify one: --update-branch, --new-branch-name, or --purge-branch.') ok = False if self.cli_opts.purge_branch: if not self.cli_opts.branch: log.error('Please use --branch to specify the branch to purge.') ok = False if self.cli_opts.last_merge_rid and self.cli_opts.is_basemap: log.error('Please specify either --last-merge-rid or --is-basemap.') ok = False return ok
def verify_handler(self): ok = Ccp_Script_Args.verify_handler(self) return ok