Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WIP *DO NOT MERGE*: new-script/httpcrtsrv #15

Open
wants to merge 29 commits into
base: master
Choose a base branch
from
Open
Changes from 1 commit
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
e7d78b2
Add gitignore
jbh Jan 2, 2018
4710e00
Add files for httpcrtsrv
jbh Jan 2, 2018
15a4635
Rename httpsrv script and define README.md
jbh Jan 2, 2018
e470816
Add code with working directory and file generation
jbh Jan 2, 2018
7700b95
Add working template code
jbh Jan 10, 2018
f87a787
Fix typos
jbh Jan 10, 2018
ea09f78
Remove unnecessary whitespace
jbh Jan 10, 2018
a1dbbdb
Use argparse in favor of optparse
jbh Jan 10, 2018
772bf4a
Simplify verification condition
jbh Jan 10, 2018
d5a8313
Rename httpcrtsrv to httpsrv
jbh Jan 10, 2018
b4b0893
Fix typo
jbh Jan 10, 2018
0aacb52
Use 'with' to create context for opening and using files
jbh Jan 10, 2018
57eb0fa
Split two SQL statements so they run properly
jbh Jan 11, 2018
f262026
Use pyformat to format strings
jbh Jan 11, 2018
2e03444
Make -cdr mutually exclusive group
jbh Jan 11, 2018
d669a58
Use subparsers
jbh Jan 11, 2018
d4f07b7
Add keepalivetimeout value for Apache config
jbh Jan 11, 2018
25b72b9
Fix typo
jbh Jan 11, 2018
bf0e89d
Conditionally set require all statement in apache
jbh Jan 11, 2018
fa08585
Only use .format when necessary
jbh Jan 11, 2018
80e2893
Add ideas for delete and rename
jbh Jan 11, 2018
cc83f00
Add start, restart, and stop commands
jbh Jan 11, 2018
eb80e7b
Add start of qzui create instance code
jbh Jan 11, 2018
0e56ad8
Add delete HTTP Server Instance with RMVM
jbh Jan 12, 2018
1ee3db7
Add rename HTTP Server Instance with RNMM
jbh Jan 12, 2018
b486d86
Do not manipulate the directory when renaming or deleting an instance
jbh Jan 12, 2018
b008d19
Prompt user before deletion
jbh Jan 12, 2018
329f82e
Add force flag to deletion
jbh Jan 12, 2018
f9688ae
Add TODOs
jbh Jan 12, 2018
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 30 additions & 3 deletions non-wheel/httpsrv/httpsrv.py
Original file line number Diff line number Diff line change
Expand Up @@ -409,12 +409,24 @@ def delete_with_qzui_api(name):


def rename(name, newname):
print ('rename')
print('rename')
# Could not find a command for this one. Only idea is to use CHGPF or some command to change the member name
# rerun command to update update apache configuration path
# Then mv directory to rename directory


def start(name):
os.system("system 'STRTCPSVR SERVER(*HTTP) HTTPSVR(" + name.upper() + ")'")
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I thought I could just write:

os.system('STRTCPSVR SERVER(*HTTP) HTTPSVR(' + name.upper() + ')')

The above wouldn't work, though. It seems to be running system commands under bash instead of IBM i level.



def restart(name):
os.system("system 'STRTCPSVR SERVER(*HTTP) RESTART(*HTTP) HTTPSVR(" + name.upper() + ")'")


def stop(name):
os.system("system 'ENDTCPSVR SERVER(*HTTP) HTTPSVR(" + name.upper() + ")'")


def main():
p = argparse.ArgumentParser()
sp = p.add_subparsers(title='commands', dest='command')
Expand All @@ -428,8 +440,17 @@ def main():
p_rename.add_argument('--name', '-n', required=True)
p_rename.add_argument('--newname', '-e', required=True)

p_rename = sp.add_parser('delete', help='Delete HTTP Server Instance')
p_rename.add_argument('--name', '-n', required=True)
p_delete = sp.add_parser('delete', help='Delete HTTP Server Instance')
p_delete.add_argument('--name', '-n', required=True)

p_start = sp.add_parser('start', help='Start HTTP Server Instance')
p_start.add_argument('--name', '-n', required=True)

p_restart = sp.add_parser('restart', help='Restart HTTP Server Instance')
p_restart.add_argument('--name', '-n', required=True)

p_stop = sp.add_parser('stop', help='Stop HTTP Server Instance')
p_stop.add_argument('--name', '-n', required=True)

args = p.parse_args()

Expand All @@ -439,6 +460,12 @@ def main():
rename(args.name, args.newname)
elif args.command == 'delete':
delete_with_qzui_api(args.name)
elif args.command == 'start':
start(args.name)
elif args.command == 'restart':
restart(args.name)
elif args.command == 'stop':
stop(args.name)


if __name__ == '__main__':
Expand Down