Skip to content

"Config Create" Attempts to Overwrite Default Configuration File #44

@mattroark

Description

@mattroark

A permissions error is encountered when executing config create as:

  1. A unique filename is not generated as per the config name passed.
  2. The default configuration file is owned by root:root.
ubuntu@pmkft-cli:~$ pf9ctl config create
Config name: pmkft-1573762631
Platform9 management URL: https://pmkft-1573762631.platform9.horse/
Platform9 user: matthew.roark@platform9.com
Platform9 password:
Platform9 region: RegionOne
Platform9 tenant [service]: service
Traceback (most recent call last):
  File "/usr/bin/pf9ctl", line 8, in <module>
    sys.exit(cli())
  File "/opt/pf9/cli/lib/python3.6/site-packages/click/core.py", line 764, in __call__
    return self.main(*args, **kwargs)
  File "/opt/pf9/cli/lib/python3.6/site-packages/click/core.py", line 717, in main
    rv = self.invoke(ctx)
  File "/opt/pf9/cli/lib/python3.6/site-packages/click/core.py", line 1137, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/opt/pf9/cli/lib/python3.6/site-packages/click/core.py", line 1137, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/opt/pf9/cli/lib/python3.6/site-packages/click/core.py", line 956, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/opt/pf9/cli/lib/python3.6/site-packages/click/core.py", line 555, in invoke
    return callback(*args, **kwargs)
  File "/opt/pf9/cli/lib/python3.6/site-packages/click/decorators.py", line 17, in new_func
    return f(get_current_context(), *args, **kwargs)
  File "/opt/pf9/cli/lib/python3.6/site-packages/pf9/config/commands.py", line 54, in create
    shutil.copyfile(pf9_exp_conf_dir + 'express.conf', pf9_exp_conf_dir + filename)
  File "/usr/lib/python3.6/shutil.py", line 121, in copyfile
    with open(dst, 'wb') as fdst:
PermissionError: [Errno 13] Permission denied: '/home/ubuntu/pf9/pf9-express/config/pf9-express.conf'
ubuntu@pmkft-cli:~$ stat /home/ubuntu/pf9/pf9-express/config/pf9-express.conf
  File: /home/ubuntu/pf9/pf9-express/config/pf9-express.conf
  Size: 265       	Blocks: 8          IO Block: 4096   regular file
Device: fc01h/64513d	Inode: 272636      Links: 1
Access: (0644/-rw-r--r--)  Uid: (    0/    root)   Gid: (    0/    root)
Access: 2019-11-22 21:43:43.298790878 +0000
Modify: 2019-11-22 21:43:43.298790878 +0000
Change: 2019-11-22 21:43:43.298790878 +0000
 Birth: -

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions